Commit 9fce93c5 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk Committed by Adrien Béraud

player: fix frame time

Handle cases when pts is smaller than start time.
(Usually should not happens).

Change-Id: Ia0687237764cef54d6830ab95169f21f295d041d
parent f03e2f62
......@@ -579,7 +579,8 @@ MediaDecoder::decode(AVPacket& packet)
| AV_ROUND_PASS_MINMAX));
lastTimestamp_ = frame->pts;
if (emulateRate_ and packetTimestamp != AV_NOPTS_VALUE) {
auto frame_time = getTimeBase() * (packetTimestamp - avStream_->start_time);
auto startTime = avStream_->start_time == AV_NOPTS_VALUE ? 0 : avStream_->start_time;
rational<double> frame_time = rational<double>(getTimeBase()) * (packetTimestamp - startTime);
auto target_relative = static_cast<std::int64_t>(frame_time.real() * 1e6);
auto target_absolute = startTime_ + target_relative;
if (target_relative < seekTime_) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment