[FFmpeg-devel] [PATCH 2/2] mmst: don't look for a hr field in ping messages

Ronald S. Bultje rsbultje
Sat Feb 12 22:45:06 CET 2011


Hi,

On Sat, Feb 12, 2011 at 5:17 AM, Francesco Cosoleto <cosoleto at gmail.com> wrote:
> This fixes premature closure of connection with mmst streams, as a
> ping message from server get ignored.
>
> According to MMS specification, in case of a SC_PKT_KEEPALIVE server
> message, bytes after the packet id don't contain a 'hr' field, should
> be set to 0, and must be ignored by the client.
>
> In the wild, even servers that initially send ping messages with the
> specified data set to 0, can change the behaviour after some minutes,
> transmitting some arbitrary values[1]. When this occurs, it makes the
> previous code to interpret the data as an error code and returns
> without managing the ping.
>
> [1] mmst://wm.bbc.co.uk/wms/bbc7coyopa/bbc7_-_friday_0430.wma
>
> Signed-off-by: Francesco Cosoleto <cosoleto at gmail.com>
> ---
> ?libavformat/mmst.c | ? ?9 +++++----
> ?1 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/libavformat/mmst.c b/libavformat/mmst.c
> index ad87bbf..10d30ff 100644
> --- a/libavformat/mmst.c
> +++ b/libavformat/mmst.c
> @@ -290,6 +290,10 @@ static MMSSCPacketType get_tcp_server_response(MMSTContext *mmst)
> ? ? ? ? ? ? ? ? return read_result < 0 ? read_result : AVERROR_IO;
> ? ? ? ? ? ? }
> ? ? ? ? ? ? packet_type= AV_RL16(mms->in_buffer+36);
> + ? ? ? ? ? ?if(packet_type == SC_PKT_KEEPALIVE) {
> + ? ? ? ? ? ? ? ?send_keepalive_packet(mmst);
> + ? ? ? ? ? ? ? ?continue;
> + ? ? ? ? ? ?}
> ? ? ? ? ? ? hr = AV_RL32(mms->in_buffer + 40);
> ? ? ? ? ? ? if (hr) {
> ? ? ? ? ? ? ? ? av_log(NULL, AV_LOG_ERROR,
> @@ -356,10 +360,7 @@ static MMSSCPacketType get_tcp_server_response(MMSTContext *mmst)
> ? ? ? ? }
>
> ? ? ? ? // preprocess some packet type
> - ? ? ? ?if(packet_type == SC_PKT_KEEPALIVE) {
> - ? ? ? ? ? ?send_keepalive_packet(mmst);
> - ? ? ? ? ? ?continue;
> - ? ? ? ?} else if(packet_type == SC_PKT_STREAM_CHANGING) {
> + ? ? ? ?if(packet_type == SC_PKT_STREAM_CHANGING) {
> ? ? ? ? ? ? handle_packet_stream_changing_type(mmst);
> ? ? ? ? } else if(packet_type == SC_PKT_ASF_MEDIA) {
> ? ? ? ? ? ? pad_media_packet(mms);
> --
> 1.7.1

The attached patch fixes it also, and is IMO more correct.

Ronald
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-mmst-fix-reading-uninitialized-data-for-ping-packets.patch
Type: application/octet-stream
Size: 1388 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110212/044a3bc0/attachment.obj>



More information about the ffmpeg-devel mailing list