From: Kostya Shishkov Date: Tue, 1 Dec 2009 15:13:23 +0000 (+0000) Subject: Write header for RTMP packets with channel_id >= 64 correctly X-Git-Tag: v0.6~2498 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b1eb53ab59414b23a26f6e4af28bd3cd54b06220;p=platform%2Fupstream%2Flibav.git Write header for RTMP packets with channel_id >= 64 correctly Originally committed as revision 20684 to svn://svn.ffmpeg.org/ffmpeg/trunk --- diff --git a/libavformat/rtmppkt.c b/libavformat/rtmppkt.c index 7e7670e..6c2e2f5 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) {