[FFmpeg-soc] [soc]: r4480 - rtmp/rtmpdec.c
kostya
subversion at mplayerhq.hu
Thu Jun 18 06:30:49 CEST 2009
Author: kostya
Date: Thu Jun 18 06:30:49 2009
New Revision: 4480
Log:
Handle ping from server
Modified:
rtmp/rtmpdec.c
Modified: rtmp/rtmpdec.c
==============================================================================
--- rtmp/rtmpdec.c Thu Jun 18 06:28:28 2009 (r4479)
+++ rtmp/rtmpdec.c Thu Jun 18 06:30:49 2009 (r4480)
@@ -172,6 +172,19 @@ static void gen_play(AVFormatContext *s,
rtmp_packet_destroy(&pkt);
}
+static void gen_pong(AVFormatContext *s, RTMPState *rt, RTMPPacket *ppkt)
+{
+ RTMPPacket pkt;
+ uint8_t *p;
+
+ rtmp_packet_create(&pkt, RTMP_NETWORK_CHANNEL, RTMP_PT_PING, ppkt->timestamp + 1, 6);
+ p = pkt.data;
+ bytestream_put_be16(&p, 7);
+ bytestream_put_be32(&p, AV_RB32(ppkt->data+2) + 1);
+ rtmp_packet_write(s, rt->rtmp_hd, &pkt, &rt->whist);
+ rtmp_packet_destroy(&pkt);
+}
+
//TODO: Move HMAC code somewhere. Eventually.
#define HMAC_IPAD_VAL 0x36
#define HMAC_OPAD_VAL 0x5C
@@ -482,6 +495,11 @@ static int rtmp_parse_result(AVFormatCon
rt->whist.chunk_size[i] = t;
}
break;
+ case RTMP_PT_PING:
+ t = AV_RB16(pkt->data);
+ if (t == 6)
+ gen_pong(s, rt, pkt);
+ break;
case RTMP_PT_INVOKE:
if (!memcmp(pkt->data, "\002\000\006_error", 9)) {//TODO: search data for error description
return -1;
More information about the FFmpeg-soc
mailing list