From 41f5e7af68350233f135a393cf8c7e20bdd3372e Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Sun, 12 Jun 2005 08:07:30 +0000 Subject: [PATCH] The queue for native MPEG4 must also be flushed if it contains two I/P frames and the next frame is an I or P frame. --- src/output/p_video.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/output/p_video.cpp b/src/output/p_video.cpp index b32ae144b..53237f90f 100644 --- a/src/output/p_video.cpp +++ b/src/output/p_video.cpp @@ -414,20 +414,24 @@ void mpeg4_p2_video_packetizer_c::flush_frames_maybe(frame_type_e next_frame) { int i, num_bframes; - if (0 == queued_frames.size()) + if ((0 == queued_frames.size()) || (FRAME_TYPE_B == next_frame)) return; + if ((FRAME_TYPE_I == next_frame) || + (FRAME_TYPE_P == queued_frames[0].type)) { + flush_frames(); + return; + } + num_bframes = 0; for (i = 0; i < queued_frames.size(); ++i) if (FRAME_TYPE_B == queued_frames[i].type) ++num_bframes; - if ((FRAME_TYPE_I == next_frame) || - (num_bframes > 0) || (FRAME_TYPE_P == queued_frames[0].type)) + if ((0 < num_bframes) || (2 <= queued_frames.size())) flush_frames(); } - void mpeg4_p2_video_packetizer_c::flush_frames() { int i, num_bframes, b_offset;