summaryrefslogtreecommitdiff
path: root/libavformat/rtmpproto.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-10-13 12:17:24 +0300
committerLuca Barbato <lu_zero@gentoo.org>2015-10-14 14:35:33 +0200
commite55376a1fd5abebbb0a082aa20739d58c2260a37 (patch)
tree2d99fa68574ab7a31b91e514091fcc4e22220fc6 /libavformat/rtmpproto.c
parent6a23a34274b747280c1e4a00ad22f97f99bbb48a (diff)
rtmpproto: Write correct flv packet sizes at the end of packets
In one case it was written as zero, one case left it uninitialized, missed the 11 bytes for the flv header. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavformat/rtmpproto.c')
-rw-r--r--libavformat/rtmpproto.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index ec4b0e73f3..77a801d11c 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -2213,7 +2213,7 @@ static int append_flv_data(RTMPContext *rt, RTMPPacket *pkt, int skip)
bytestream2_put_byte(&pbc, ts >> 24);
bytestream2_put_be24(&pbc, 0);
bytestream2_put_buffer(&pbc, data, size);
- bytestream2_put_be32(&pbc, 0);
+ bytestream2_put_be32(&pbc, size + RTMP_HEADER);
return 0;
}
@@ -2363,8 +2363,9 @@ static int handle_metadata(RTMPContext *rt, RTMPPacket *pkt)
bytestream_put_be24(&p, ts);
bytestream_put_byte(&p, ts >> 24);
memcpy(p, next, size + 3 + 4);
+ p += size + 3;
+ bytestream_put_be32(&p, size + RTMP_HEADER);
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 "
@@ -2554,7 +2555,7 @@ static int inject_fake_duration_metadata(RTMPContext *rt)
// Finalise object
bytestream_put_be16(&p, 0); // Empty string
bytestream_put_byte(&p, AMF_END_OF_OBJECT);
- bytestream_put_be32(&p, 40); // size of data part (sum of all parts below)
+ bytestream_put_be32(&p, 40 + RTMP_HEADER); // size of data part (sum of all parts above)
return 0;
}