Thanks also from me. It worked for me too.
Attached is a patch against the latest mplayer CVS, this should apply
more cleanly.
Dave
Patrick Dixon wrote:
bglad Wrote:
great news neil, thanks for pushing this
Thanks from me too.
Index: demux_real.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_real.c,v
retrieving revision 1.73
diff -u -r1.73 demux_real.c
--- demux_real.c 2 Sep 2005 08:32:32 -0000 1.73
+++ demux_real.c 28 Sep 2005 07:17:10 -0000
@@ -92,6 +92,13 @@
int a_bitrate; ///< Audio bitrate
int v_bitrate; ///< Video bitrate
int stream_switch; ///< Flag used to switch audio/video demuxing
+/******************************/
+ /* Variables to fix missing buffer in stream audio */
+ int live_stream; // Flag to indicate that it is a live audio
only stream
+ int ms_per_packet; // millisec per pack - used to detect if a
packet is missed
+ int ms_per_block; // millsec per block (usually made up 16
packets)
+ int ms_per_packet_safety; // Since timing is not precise - a safety
margin is needed - guess about 20% of packet time.
+/********************************/
} real_priv_t;
/* originally from FFmpeg */
@@ -687,6 +694,25 @@
priv->audio_need_keyframe = 0;
}else
dp->pts = (priv->a_pts==timestamp) ? 0 : (timestamp/1000.0f);
+/********************************/
+ if ( (priv->live_stream == 1) && (((sh_audio_t*)ds->sh)->format ==
mmioFOURCC('c','o','o','k')) ){
+ // Not sure if missingpacket happen the same way for other
formats
+ demux_packet_t *dp1;
+ if (((timestamp - priv->a_pts) >
priv->ms_per_packet_safety)&& ((timestamp - priv->a_pts) < priv->ms_per_block))
+ mp_msg(MSGT_DEMUX,MSGL_V, "Packet timestamp gap
Actual %7d msec Expected %7d Flags %02X\n",
timestamp-priv->a_pts,priv->ms_per_packet,dp->flags);
+ if (((timestamp - priv->a_pts) < priv->ms_per_packet))
+ mp_msg(MSGT_DEMUX,MSGL_V, "Packet timestamp gap too
short Actual %7d msec Expected %7d Flags %02X\n",
timestamp-priv->a_pts,priv->ms_per_packet,dp->flags);
+
+ while( ((timestamp - priv->a_pts) >
priv->ms_per_packet_safety) && (timestamp - priv->a_pts) < priv->ms_per_block) {
+ dp1 = new_demux_packet(len);
+ memcpy(dp1->buffer,dp->buffer,len);
+ priv->a_pts=priv->a_pts + priv->ms_per_packet;
+ dp1->pos = demuxer->filepos;
+ dp1->flags = 0;
+ ds_add_packet(ds, dp1);
+ }
+ }
+/********************************************/
priv->a_pts=timestamp;
dp->pos = demuxer->filepos;
dp->flags = (flags & 0x2) ? 0x10 : 0;
@@ -1130,6 +1156,12 @@
if (!strncmp(mimet,"audio/",6)) {
if (strstr(mimet,"x-pn-realaudio") ||
strstr(mimet,"x-pn-multirate-realaudio")) {
+/****************************/
+ if (strstr(mimet,"x-pn-multirate-realaudio-live" )) {
+ priv->live_stream = 1;
+ } else
+ priv->live_stream = 0;
+/***************************/
// skip unknown shit - FIXME: find a better/cleaner way!
len=codec_data_size;
tmp = stream_read_dword(demuxer->stream);
@@ -1358,6 +1390,16 @@
((short*)(sh->wf+1))[4]=codecdata_length;
// stream_read(demuxer->stream, ((char*)(sh->wf+1))+6,
24); // extras
stream_read(demuxer->stream,
((char*)(sh->wf+1))+10, codecdata_length); // extras
+/********************************/
+ priv->ms_per_packet = (long)
((coded_frame_size*8*1000L)/(sh->wf->nAvgBytesPerSec)); // I think variable
should be avgbits/sec
+ priv->ms_per_packet_safety = priv->ms_per_packet +
(priv->ms_per_packet/5) ; // Add 20% for the safety margin
+ priv->ms_per_block = priv->ms_per_packet *
sub_packet_h;
+ priv->ms_per_packet--; // Empircally - round down
to suit observed actual gaps
+ if (priv->live_stream == 1){
+ mp_msg(MSGT_DEMUX,MSGL_V,"Live stream:
Subpacksize %d sub packet h %d Flavour %d coded frame size %d codecdatalength
%d avg byte/sec %d channels
%d\n",sub_packet_size,sub_packet_h,flavor,coded_frame_size,codecdata_length,
sh->wf->nAvgBytesPerSec, sh->channels);
+ mp_msg(MSGT_DEMUX,MSGL_V,"Live
stream: Expected range ms/packet %d to %d ms per block
%d\n",priv->ms_per_packet,priv->ms_per_packet_safety, priv->ms_per_block);
+ }
+/**************************************/
break;
case MKTAG('r', 'a', 'a', 'c'):
case MKTAG('r', 'a', 'c', 'p'):
_______________________________________________
Discuss mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/discuss