summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-01-15 19:58:23 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-01-16 20:22:58 +0100
commit1191db31c1ed02255590ee5e9c0c836589f6508a (patch)
tree38fa48c35d97e87170d35e5002b6579eac5c7a02
parentb7bc49a957a11d666e9b3a6838bee774652748ae (diff)
downloadffmpeg-streaming-1191db31c1ed02255590ee5e9c0c836589f6508a.zip
ffmpeg-streaming-1191db31c1ed02255590ee5e9c0c836589f6508a.tar.gz
mux: fix chunked interleaver
The code did not account properly for packets that where added to the end of the packet list. Also flags for such packets where not set correctly leading to incorrect chunked interleaving. Reported-by: bcoudurier Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/mux.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/libavformat/mux.c b/libavformat/mux.c
index ae5e691..d939315 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -549,20 +549,21 @@ int ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt,
next_point = &s->packet_buffer;
}
- if (*next_point) {
- 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;
- goto next_non_null;
- } else {
- st->interleaver_chunk_size =
- st->interleaver_chunk_duration = 0;
- this_pktl->pkt.flags |= CHUNK_START;
- }
+ 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 =
+ st->interleaver_chunk_duration = 0;
+ this_pktl->pkt.flags |= CHUNK_START;
}
+ }
+ if (*next_point) {
+ if (chunked && !(this_pktl->pkt.flags & CHUNK_START))
+ goto next_non_null;
if (compare(s, &s->packet_buffer_end->pkt, pkt)) {
while ( *next_point
OpenPOWER on IntegriCloud