[FFmpeg-trac] #2694(avformat:new): interrupt_callback not working

FFmpeg trac at avcodec.org
Thu Jun 20 15:34:12 CEST 2013


#2694: interrupt_callback not working
-------------------------------------+-------------------------------------
             Reporter:  sporn        |                     Type:  defect
               Status:  new          |                 Priority:  critical
            Component:  avformat     |                  Version:  git-
             Keywords:  interrupt    |  master
  callback block                     |               Blocked By:
  avformat_open_input                |  Reproduced by developer:  0
             Blocking:               |
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Summary of the bug:
 How to reproduce:

 This used to work (interrupt on no network connnection) until I updated to
 latest version of ffmpeg, now it hangs indefinitely on avformat_open_input
 and read frame. The interrupt is never fired. (timestamp is something i've
 added myself)



 {{{
 static int interrupt_cb(void *ctx)
         {
                 AVFormatContext* formatContext =
 reinterpret_cast<AVFormatContext*>(ctx);

                 //timeout after 5 seconds of no activity
                 if (formatContext->timestamp>0 && (GetTickCount() -
 formatContext->timestamp >5000))
                         return 1;
                 return 0;
         }

                 static AVFormatContext* open_file( char* fileName )
                 {
                         AVDictionary *options = NULL;
                         av_dict_set(&options, "analyzeduration",
 "1500000", 0);

                         AVFormatContext* formatContext =
 avformat_alloc_context( );

                         formatContext->interrupt_callback.callback =
 interrupt_cb;
                         formatContext->interrupt_callback.opaque =
 formatContext;

                         formatContext->timestamp = GetTickCount();
                         formatContext->flags|=AVFMT_FLAG_NONBLOCK;

                         if ( avformat_open_input( &formatContext,
 fileName, NULL, NULL ) !=0 )
                         {
                                 return NULL;
                         }
                         av_dict_free(&options);
                         return formatContext;
                 }
 }}}






 Patches should be submitted to the ffmpeg-devel mailing list and not this
 bug tracker.

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/2694>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list