diff options
author | Benjamin Otte <otte@gnome.org> | 2008-12-10 13:40:53 +0100 |
---|---|---|
committer | Benjamin Otte <otte@gnome.org> | 2008-12-16 21:38:15 +0100 |
commit | bd504644cd5bfbb8be14bdfbdc8018052bec6207 (patch) | |
tree | bcbb86599784ed2ab3c4215f673f15cb04ccfb37 | |
parent | f0225fd8b22676d3c5ee4436fe357290dba59165 (diff) |
send a buffer time ping message after connecting
-rw-r--r-- | swfdec/swfdec_net_stream.c | 19 | ||||
-rw-r--r-- | swfdec/swfdec_rtmp_connection.c | 8 | ||||
-rw-r--r-- | swfdec/swfdec_rtmp_connection.h | 3 |
3 files changed, 27 insertions, 3 deletions
diff --git a/swfdec/swfdec_net_stream.c b/swfdec/swfdec_net_stream.c index 9fd98d02..b28e1666 100644 --- a/swfdec/swfdec_net_stream.c +++ b/swfdec/swfdec_net_stream.c @@ -304,6 +304,24 @@ swfdec_net_stream_construct (SwfdecAsContext *cx, SwfdecAsObject *object, swfdec_as_object_set_relay (o, SWFDEC_AS_RELAY (stream)); } +static void +swfdec_net_stream_send_buffer_time (SwfdecNetStream *stream) +{ + SwfdecRtmpPacket *packet; + SwfdecBots *bots; + SwfdecBuffer *buffer; + + bots = swfdec_bots_new (); + swfdec_bots_put_bu16 (bots, 3); + swfdec_bots_put_bu32 (bots, stream->stream); + swfdec_bots_put_bu32 (bots, stream->video->buffer_time); + buffer = swfdec_bots_close (bots); + + packet = swfdec_rtmp_packet_new (2, 0, SWFDEC_RTMP_PACKET_PING, 0, buffer); + swfdec_buffer_unref (buffer); + swfdec_rtmp_connection_queue_control_packet (stream->conn, packet); +} + SWFDEC_AS_NATIVE (2101, 201, swfdec_net_stream_onCreate) void swfdec_net_stream_onCreate (SwfdecAsContext *cx, SwfdecAsObject *object, @@ -330,6 +348,7 @@ swfdec_net_stream_onCreate (SwfdecAsContext *cx, SwfdecAsObject *object, packet->header.stream = stream->stream; swfdec_rtmp_connection_send (stream->conn, packet); } + swfdec_net_stream_send_buffer_time (stream); } SWFDEC_AS_NATIVE (2101, 202, swfdec_net_stream_send_connection) diff --git a/swfdec/swfdec_rtmp_connection.c b/swfdec/swfdec_rtmp_connection.c index 83baf8d9..e3dc0134 100644 --- a/swfdec/swfdec_rtmp_connection.c +++ b/swfdec/swfdec_rtmp_connection.c @@ -37,11 +37,13 @@ /*** SwfdecRtmpStream ***/ -static void -swfdec_rtmp_connection_push_control (SwfdecRtmpConnection *conn, +void +swfdec_rtmp_connection_queue_control_packet (SwfdecRtmpConnection *conn, SwfdecRtmpPacket *packet) { + g_return_if_fail (SWFDEC_IS_RTMP_CONNECTION (conn)); g_return_if_fail (packet->header.channel == 2); + g_return_if_fail (packet->header.stream == 0); if (g_queue_is_empty (conn->control_packets)) { g_queue_push_tail (conn->control_packets, NULL); @@ -148,7 +150,7 @@ swfdec_rtmp_connection_handle_server_bandwidth (SwfdecRtmpConnection *conn, org_header->timestamp - diff, buffer); swfdec_buffer_unref (buffer); - swfdec_rtmp_connection_push_control (conn, packet); + swfdec_rtmp_connection_queue_control_packet (conn, packet); } static void diff --git a/swfdec/swfdec_rtmp_connection.h b/swfdec/swfdec_rtmp_connection.h index 4d86cbd5..38d916d1 100644 --- a/swfdec/swfdec_rtmp_connection.h +++ b/swfdec/swfdec_rtmp_connection.h @@ -85,6 +85,9 @@ void swfdec_rtmp_connection_receive (SwfdecRtmpConnection * conn, SwfdecBufferQueue * queue); void swfdec_rtmp_connection_send (SwfdecRtmpConnection * conn, SwfdecRtmpPacket * packet); +void swfdec_rtmp_connection_queue_control_packet + (SwfdecRtmpConnection * conn, + SwfdecRtmpPacket * packet); void swfdec_rtmp_connection_error (SwfdecRtmpConnection * conn, const char * error, |