From 8583b14252deac71136f1dec231910abab0ba503 Mon Sep 17 00:00:00 2001 From: Josh Allmann Date: Mon, 16 Sep 2013 23:58:48 -0700 Subject: rtmp: Support reading interleaved chunks. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A given packet won't always come in contiguously; sometimes they may be broken up on chunk boundaries by packets of another channel. This support primarily involves tracking information about the data that's been read, so the reader can pick up where it left off for a given channel. As a side effect, we no longer over-report the bytes read if (toread = MIN(size, chunk_size)) == size Signed-off-by: Martin Storsjö --- libavformat/rtmpproto.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libavformat/rtmpproto.c') diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index ab30b19a26..9bdee5dd3f 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -2309,7 +2309,7 @@ static int get_packet(URLContext *s, int for_header) static int rtmp_close(URLContext *h) { RTMPContext *rt = h->priv_data; - int ret = 0; + int ret = 0, i, j; if (!rt->is_input) { rt->flv_data = NULL; @@ -2320,6 +2320,9 @@ static int rtmp_close(URLContext *h) } if (rt->state > STATE_HANDSHAKED) ret = gen_delete_stream(h, rt); + for (i = 0; i < 2; i++) + for (j = 0; j < RTMP_CHANNELS; j++) + ff_rtmp_packet_destroy(&rt->prev_pkt[i][j]); free_tracked_methods(rt); av_freep(&rt->flv_data); -- cgit v1.2.3