[FFmpeg-trac] #390(FFplay:new): ffplay cannot select desired audio/video stream, consider there is a bug in the av_read_frame function

FFmpeg trac at avcodec.org
Thu Aug 11 16:21:44 CEST 2011


#390: ffplay cannot select desired audio/video stream, consider there is a bug in
the av_read_frame function
----------------------+----------------------
Reporter:  qrtt1      |       Owner:  michael
    Type:  defect     |      Status:  new
Priority:  important  |   Component:  FFplay
 Version:  git        |  Resolution:
Keywords:             |  Blocked By:
Blocking:             |  Reproduced:  0
Analyzed:  0          |
----------------------+----------------------

Comment (by qrtt1):

 I compared with the request sent by mplayer (packet caught by wireshark).
 In stream selection header, it sent exactly two streams (video and audio):


 {{{
 Pragma: stream-switch-entry=ffff:1:0 ffff:6:0 \r\n
 }}}


 However, libavformat/mmsh.c select all the streams,
 we always get the last two index 8 and 9.

 I test it by hardcode stream index in mmsh.c. The ffprobe can give the
 desired streams:

 {{{
 [asf @ 0x10104e600] pkt idx 0
 [PACKET]
 codec_type=audio
 stream_index=0
 pts=175697
 pts_time=175.697000
 dts=175697
 dts_time=175.697000
 duration=170
 duration_time=0.170000
 size=2731.000000
 pos=1581626
 flags=K
 [/PACKET]
 [asf @ 0x10104e600] pkt idx 4
 [PACKET]
 codec_type=video
 stream_index=4
 pts=177720
 pts_time=177.720000
 dts=177720
 dts_time=177.720000
 duration=0
 duration_time=0.000000
 size=3000.000000
 pos=1578738
 flags=_
 [/PACKET]
 }}}

 It is my test code
 {{{
 qty:ffmpeg_bug qrtt1$ git diff
 diff --git a/libavformat/mmsh.c b/libavformat/mmsh.c
 index 029baed..8b79616 100644
 --- a/libavformat/mmsh.c
 +++ b/libavformat/mmsh.c
 @@ -268,10 +268,14 @@ static int mmsh_open(URLContext *h, const char *uri,
 int flags)
          return AVERROR(ENOMEM);
      for (i = 0; i < mms->stream_num; i++) {
          char tmp[20];
 -        err = snprintf(tmp, sizeof(tmp), "ffff:%d:0 ",
 mms->streams[i].id);
 -        if (err < 0)
 -            goto fail;
 -        av_strlcat(stream_selection, tmp, mms->stream_num * 19 + 1);
 +        if(i==0||i==4)
 +        {
 +            err = snprintf(tmp, sizeof(tmp), "ffff:%d:0 ",
 mms->streams[i].id);
 +            if (err < 0)
 +                goto fail;
 +            av_strlcat(stream_selection, tmp, mms->stream_num * 19 + 1);
 +            av_log(NULL, AV_LOG_ERROR, "stream select %d %d\n", i,
 mms->streams[i].id);
 +        }
      }
      // send play request
      err = snprintf(headers, sizeof(headers),
 @@ -284,7 +288,9 @@ static int mmsh_open(URLContext *h, const char *uri,
 int flags)
                     "Pragma: stream-switch-count=%d\r\n"
                     "Pragma: stream-switch-entry=%s\r\n"
                     "Connection: Close\r\n",
 -                   host, port, mmsh->request_seq++, mms->stream_num,
 stream_selection);
 +                   host, port, mmsh->request_seq++, 2 /*mms->stream_num
 */, stream_selection);
 +
 +    av_log(NULL, AV_LOG_ERROR, "stream select header\n%s\n", headers);
      av_freep(&stream_selection);
      if (err < 0) {
          av_log(NULL, AV_LOG_ERROR, "Build play request failed!\n");
 }}}

 {{{

 }}}

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/390#comment:1>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list