Merge commit '3c3b8003a13d9c3668c0bb6d79d2376da3b2b352'
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 28 Nov 2014 10:57:33 +0000 (11:57 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 28 Nov 2014 10:57:33 +0000 (11:57 +0100)
* commit '3c3b8003a13d9c3668c0bb6d79d2376da3b2b352':
  rtmpproto: Simplify code for copying data into the output packet

Conflicts:
libavformat/rtmpproto.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavformat/rtmpproto.c

@@@ -2970,11 -2949,9 +2970,11 @@@ static int rtmp_write(URLContext *s, co
          }
  
          if (rt->flv_header_bytes < RTMP_HEADER) {
 +            int set_data_frame = 0;
              const uint8_t *header = rt->flv_header;
-             int copy = FFMIN(RTMP_HEADER - rt->flv_header_bytes, size_temp);
              int channel = RTMP_AUDIO_CHANNEL;
 +
+             copy = FFMIN(RTMP_HEADER - rt->flv_header_bytes, size_temp);
              bytestream_get_buffer(&buf_temp, rt->flv_header + rt->flv_header_bytes, copy);
              rt->flv_header_bytes += copy;
              size_temp            -= copy;
              rt->out_pkt.extra = rt->stream_id;
              rt->flv_data = rt->out_pkt.data;
  
 -            if (pkttype == RTMP_PT_NOTIFY)
 +            if (set_data_frame) {
                  ff_amf_write_string(&rt->flv_data, "@setDataFrame");
 +            }
          }
  
-         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);
-             size_temp   -= rt->flv_size - rt->flv_off;
-             rt->flv_off += rt->flv_size - rt->flv_off;
-         }
+         copy = FFMIN(rt->flv_size - rt->flv_off, size_temp);
+         bytestream_get_buffer(&buf_temp, rt->flv_data + rt->flv_off, copy);
+         rt->flv_off += copy;
+         size_temp   -= copy;
  
          if (rt->flv_off == rt->flv_size) {
              rt->skip_bytes = 4;