Skip to content

Commit 0c0fc4a

Browse files
committed
fix playback stuck
Playback can get stuck, if we have a frame currently displayed and the next frames e.g. after a jump are too late and would result in a framedrop. Skip the drop in this case.
1 parent 76a0ffb commit 0c0fc4a

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

videorender.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,15 @@ int cVideoRender::HandleDropDup(int64_t videoPts, int64_t audioPts)
476476
}
477477

478478
if (diff < -5 && !(abs(diff) > 5000)) { // video is more than 5ms behind audio, drop video frame
479+
// don't drop the frame, if we are waiting for a flush
480+
if (m_flushLastFrame) {
481+
LOGDEBUG2(L_AV_SYNC, "Video too late, but skip sync (drop %d, dup %d) audio %s video %s Delay %dms diff %dms",
482+
m_framesDropped, m_framesDuped,
483+
Timestamp2String(audioPts), Timestamp2String(videoPts),
484+
m_pDevice->GetVideoAudioDelay(), diff);
485+
return 0;
486+
}
487+
479488
LOGDEBUG2(L_AV_SYNC, "FrameDropped (drop %d, dup %d) Pkts %d deint %d Frames %d UsedBytes %d audio %s video %s Delay %dms diff %dms",
480489
m_framesDropped, m_framesDuped,
481490
m_pDevice->VideoStream()->GetPacketsFilled(), m_pFilterThread->GetRbFramesFilled(),

0 commit comments

Comments
 (0)