[FFmpeg-cvslog] rtmpproto.c: Fixed RTMP Stream output issue

Chiranjeevi Melam git at videolan.org
Sun Sep 18 06:37:33 CEST 2011


ffmpeg | branch: master | Chiranjeevi Melam <cmelam at rgbnetworks.com> | Sun Sep 18 05:39:53 2011 +0200| [07631deeeeb4ee805714444c3a0bf9fb4941f8b5] | committer: Michael Niedermayer

rtmpproto.c: Fixed RTMP Stream output issue

Original code had the assumption of only one FLV packet per RTMP packet. But that assumption is incorrect for higher bit rates. Made changes to the code to accommodate more than one FLV packet per RTMP
+packet.

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

 libavformat/rtmpproto.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index e3fce2e..61be5fa 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -925,7 +925,7 @@ static int rtmp_write(URLContext *s, const uint8_t *buf, int size)
     uint32_t ts;
     const uint8_t *buf_temp = buf;
 
-    if (size < 11) {
+    if (!rt->flv_off && size < 11) {
         av_log(s, AV_LOG_DEBUG, "FLV packet too small %d\n", size);
         return 0;
     }
@@ -966,20 +966,22 @@ static int rtmp_write(URLContext *s, const uint8_t *buf, int size)
         if (rt->flv_size - rt->flv_off > size_temp) {
             bytestream_get_buffer(&buf_temp, rt->flv_data + rt->flv_off, size_temp);
             rt->flv_off += size_temp;
+            size_temp = 0;
         } else {
             bytestream_get_buffer(&buf_temp, rt->flv_data + rt->flv_off, rt->flv_size - rt->flv_off);
             rt->flv_off += rt->flv_size - rt->flv_off;
+            size_temp -= (rt->flv_size - rt->flv_off);
         }
 
         if (rt->flv_off == rt->flv_size) {
             bytestream_get_be32(&buf_temp);
-
+            size_temp -= 4;
             ff_rtmp_packet_write(rt->stream, &rt->out_pkt, rt->chunk_size, rt->prev_pkt[1]);
             ff_rtmp_packet_destroy(&rt->out_pkt);
             rt->flv_size = 0;
             rt->flv_off = 0;
         }
-    } while (buf_temp - buf < size_temp);
+    } while (buf_temp - buf < size);
     return size;
 }
 



More information about the ffmpeg-cvslog mailing list