aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/rtmpproto.c
diff options
context:
space:
mode:
authorRaffaele Sena <raff367@gmail.com>2012-03-07 10:21:16 -0800
committerLuca Barbato <lu_zero@gentoo.org>2012-04-03 12:37:31 -0700
commit34d908c083361f607879c717d7367109786b858d (patch)
tree87db09f64ebe529ad3349dd193f649a13412d8cc /libavformat/rtmpproto.c
parentfaba4a9b88838e138534570723cf272fd4dc9a03 (diff)
downloadffmpeg-34d908c083361f607879c717d7367109786b858d.tar.gz
rtmp: implement bandwidth notification
Improve compatibility with some servers. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavformat/rtmpproto.c')
-rw-r--r--libavformat/rtmpproto.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index a6917ceeb1..76835592d3 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -347,6 +347,21 @@ static void gen_pong(URLContext *s, RTMPContext *rt, RTMPPacket *ppkt)
}
/**
+ * 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.
*/
static void gen_bytes_read(URLContext *s, RTMPContext *rt, uint32_t ts)
@@ -607,6 +622,7 @@ static int rtmp_parse_result(URLContext *s, RTMPContext *rt, RTMPPacket *pkt)
gen_fcpublish_stream(s, rt);
rt->state = STATE_RELEASING;
} else {
+ gen_server_bw(s, rt);
rt->state = STATE_CONNECTING;
}
gen_create_stream(s, rt);