[FFmpeg-devel] [PATCH 1/2] mux: simplify chunking interleaver code

Michael Niedermayer michaelni at gmx.at
Wed Jan 16 00:16:00 CET 2013


Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavformat/mux.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/libavformat/mux.c b/libavformat/mux.c
index d939315..0648b3f 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -551,11 +551,10 @@ int ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt,
 
     if (chunked) {
         uint64_t max= av_rescale_q_rnd(s->max_chunk_duration, AV_TIME_BASE_Q, st->time_base, AV_ROUND_UP);
-        if (   st->interleaver_chunk_size     + pkt->size     <= s->max_chunk_size-1U
-            && st->interleaver_chunk_duration + pkt->duration <= max-1U) {
-            st->interleaver_chunk_size     += pkt->size;
-            st->interleaver_chunk_duration += pkt->duration;
-        } else {
+        st->interleaver_chunk_size     += pkt->size;
+        st->interleaver_chunk_duration += pkt->duration;
+        if (   st->interleaver_chunk_size     > s->max_chunk_size-1U
+            || st->interleaver_chunk_duration > max-1U) {
             st->interleaver_chunk_size     =
             st->interleaver_chunk_duration = 0;
             this_pktl->pkt.flags |= CHUNK_START;
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list