From: Gildas Bazin Date: Sun, 4 Dec 2005 17:36:24 +0000 (+0000) Subject: * modules/codec/realaudio.c: try to detect dropped subpackets so we don't screw-up... X-Git-Tag: 0.9.0-test0~13073 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=69392aa412e2484ddd25ce78de0fd3dd7e537d9a;p=vlc * modules/codec/realaudio.c: try to detect dropped subpackets so we don't screw-up the subpackets reordering. --- diff --git a/modules/codec/realaudio.c b/modules/codec/realaudio.c index 850505779c..ea44141ce0 100644 --- a/modules/codec/realaudio.c +++ b/modules/codec/realaudio.c @@ -2,7 +2,7 @@ * realaudio.c: a realaudio decoder that uses the realaudio library/dll ***************************************************************************** * Copyright (C) 2005 the VideoLAN team - * $Id: quicktime.c 11664 2005-07-09 06:17:09Z courmisch $ + * $Id$ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -81,6 +81,7 @@ struct decoder_sys_t /* Frame buffer for data reordering */ int i_subpacket; + mtime_t i_packet_pts; int i_frame_size; char *p_frame; int i_frame; @@ -237,6 +238,7 @@ static int Open( vlc_object_t *p_this ) p_sys->i_frame_size = p_dec->fmt_in.audio.i_blockalign * p_sys->i_subpacket_h; p_sys->p_frame = malloc( p_sys->i_frame_size ); + p_sys->i_packet_pts = 0; p_sys->i_subpacket = 0; p_sys->i_frame = 0; @@ -696,6 +698,17 @@ static aout_buffer_t *Decode( decoder_t *p_dec, block_t **pp_block ) //msg_Err( p_dec, "Decode: "I64Fd", %i", p_block->i_pts, p_block->i_buffer ); + /* Detect missing subpackets */ + if( p_sys->i_subpacket && p_block->i_pts > 0 && + p_block->i_pts != p_sys->i_packet_pts ) + { + /* All subpackets in a packet should have the same pts so we must + * have dropped some. Clear current frame buffer. */ + p_sys->i_subpacket = 0; + msg_Dbg( p_dec, "detected dropped subpackets" ); + } + if( p_block->i_pts > 0 ) p_sys->i_packet_pts = p_block->i_pts; + /* Date management */ if( /* !p_sys->i_subpacket && */ p_block && p_block->i_pts > 0 && p_block->i_pts != aout_DateGet( &p_sys->end_date ) )