Commit 42a095d0 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '3c3b8003'

* commit '3c3b8003':
  rtmpproto: Simplify code for copying data into the output packet

Conflicts:
	libavformat/rtmpproto.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents a105c1f2 3c3b8003
......@@ -2954,7 +2954,7 @@ static int rtmp_write(URLContext *s, const uint8_t *buf, int size)
{
RTMPContext *rt = s->priv_data;
int size_temp = size;
int pktsize, pkttype;
int pktsize, pkttype, copy;
uint32_t ts;
const uint8_t *buf_temp = buf;
uint8_t c;
......@@ -2972,9 +2972,9 @@ static int rtmp_write(URLContext *s, const uint8_t *buf, int size)
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;
......@@ -3040,15 +3040,10 @@ 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);
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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment