[FFmpeg-cvslog] rtmpproto: Readjust the end of the flv buffer if handle_metadata exited early

Martin Storsjö git at videolan.org
Fri Oct 4 14:29:34 CEST 2013


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Thu Oct  3 13:44:38 2013 +0200| [8921e32f730c191543b84e61338bc9d549aa05a3] | committer: Martin Storsjö

rtmpproto: Readjust the end of the flv buffer if handle_metadata exited early

If the embedded flv packets were incomplete and we aborted the
copying loop early, make sure the flv buffer is trimmed to
only contain full packets.

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8921e32f730c191543b84e61338bc9d549aa05a3
---

 libavformat/rtmpproto.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index bc6cd3f..e7e37a3 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -2229,6 +2229,11 @@ static int handle_metadata(RTMPContext *rt, RTMPPacket *pkt)
         next += size + 3 + 4;
         p    += size + 3 + 4;
     }
+    if (p != rt->flv_data + rt->flv_size) {
+        av_log(NULL, AV_LOG_WARNING, "Incomplete flv packets in "
+                                     "RTMP_PT_METADATA packet\n");
+        rt->flv_size = p - rt->flv_data;
+    }
 
     return 0;
 }



More information about the ffmpeg-cvslog mailing list