1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

rtmp: implement bandwidth notification

Improve compatibility with some servers.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This commit is contained in:
Raffaele Sena 2012-03-07 10:21:16 -08:00 committed by Luca Barbato
parent faba4a9b88
commit 34d908c083

View File

@ -346,6 +346,21 @@ static void gen_pong(URLContext *s, RTMPContext *rt, RTMPPacket *ppkt)
ff_rtmp_packet_destroy(&pkt); ff_rtmp_packet_destroy(&pkt);
} }
/**
* Generate server bandwidth message and send it to the server.
*/
static void gen_server_bw(URLContext *s, RTMPContext *rt)
{
RTMPPacket pkt;
uint8_t *p;
ff_rtmp_packet_create(&pkt, RTMP_NETWORK_CHANNEL, RTMP_PT_SERVER_BW, 0, 4);
p = pkt.data;
bytestream_put_be32(&p, 2500000);
ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
ff_rtmp_packet_destroy(&pkt);
}
/** /**
* Generate report on bytes read so far and send it to the server. * Generate report on bytes read so far and send it to the server.
*/ */
@ -607,6 +622,7 @@ static int rtmp_parse_result(URLContext *s, RTMPContext *rt, RTMPPacket *pkt)
gen_fcpublish_stream(s, rt); gen_fcpublish_stream(s, rt);
rt->state = STATE_RELEASING; rt->state = STATE_RELEASING;
} else { } else {
gen_server_bw(s, rt);
rt->state = STATE_CONNECTING; rt->state = STATE_CONNECTING;
} }
gen_create_stream(s, rt); gen_create_stream(s, rt);