diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2009-12-01 15:13:23 +0000 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2009-12-01 15:13:23 +0000 |
commit | b1eb53ab59414b23a26f6e4af28bd3cd54b06220 (patch) | |
tree | e5f770a3c8d9c2f7d97bf5555e8833af58d13c24 /libavformat | |
parent | 59b6482a04fcf2d45383cf5a700e9fddcd0c00b5 (diff) | |
download | ffmpeg-b1eb53ab59414b23a26f6e4af28bd3cd54b06220.tar.gz |
Write header for RTMP packets with channel_id >= 64 correctly
Originally committed as revision 20684 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/rtmppkt.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libavformat/rtmppkt.c b/libavformat/rtmppkt.c index 7e7670e2b6..6c2e2f5b37 100644 --- a/libavformat/rtmppkt.c +++ b/libavformat/rtmppkt.c @@ -151,7 +151,15 @@ int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt, int off = 0; //TODO: header compression - bytestream_put_byte(&p, pkt->channel_id | (mode << 6)); + if (pkt->channel_id < 64) { + bytestream_put_byte(&p, pkt->channel_id | (mode << 6)); + } else if (pkt->channel_id < 64 + 256) { + bytestream_put_byte(&p, 0 | (mode << 6)); + bytestream_put_byte(&p, pkt->channel_id - 64); + } else { + bytestream_put_byte(&p, 1 | (mode << 6)); + bytestream_put_le16(&p, pkt->channel_id - 64); + } if (mode != RTMP_PS_ONEBYTE) { bytestream_put_be24(&p, pkt->timestamp >= 0xFFFFFF ? 0xFFFFFF : pkt->timestamp); if (mode != RTMP_PS_FOURBYTES) { |