[MPlayer-dev-eng] [PATCH] fix premature end of stream download

trevor-b at ovi.com trevor-b at ovi.com
Fri Mar 23 17:59:17 CET 2012


Hi all,

I have been listening to a BBC program, but mplayer nearly always aborts before finishing the download with this error message:

    read error:: Resource temporarily unavailable3% 1% 
    pre-header read failed
    Stream not seekable!

In the sample output below, you can see the error occurred 11 mins into a 2 hr program.

>From the eror message, I'm guessing the problem happens because the data doesn't arrive fast enough, 

so mplayer gives up.

The corresponding code is in stream/asf_mmst_streaming.c, in function get_data():

    len = recv (s, &buf[total], count-total, 0);
    if (len<=0) {
      perror ("read error:");
      return 0;
    }


So it does give up as soon as there is no data available.

Wouldn't it make sense to keep trying a few more times if there is no data available?

I modified the code to this ....

    nr_tries = 10;
    do
        len = recv (s, &buf[total], count-total, 0);
    while( len = EAGAIN && nr_tries-- > 0);
    if (len<=0) {
      perror ("read error:");
      return 0;
    }

.... and now I can consistently download the whole program without a hitch.  So it works for me.

I've attached the corresponding patch.


Best Regards

Here's the above mentioned log: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
libavcodec version 54.10.100 (internal)
AUDIO: 44100 Hz, 2 ch, s16le, 96.0 kbit/6.80% (ratio: 12003->176400)
Selected audio codec: [ffwmav2] afm: ffmpeg (DivX audio v2 (FFmpeg))
==========================================================================
[AO PCM] File: stream.pipe (WAVE)
PCM: Samplerate: 44100Hz Channels: Stereo Format s16le
[AO PCM] Info: Faster dumping is achieved with -benchmark -vc null -vo null -ao pcm:fast
[AO PCM] Info: To write WAVE files use -ao pcm:waveheader (default).
AO: [pcm] 44100Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...
read error:: Resource temporarily unavailable3% 1% 
pre-header read failed
Stream not seekable!
A: 712.6 (11:52.6) of 7140.0 ( 1:59:00.0) 94.6% 0% 

Could not seek to start, WAV size headers not updated!

Exiting... (End of file)

xxxxxxxxxxxxxxxxxxxxxxxx
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MPlayer-retry.patch
Type: text/x-patch
Size: 501 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20120323/1aabdcbc/attachment.bin>


More information about the MPlayer-dev-eng mailing list