ffmpeg set timeout

The code in xl_player is copied directly, but the timeout time in the project is too short, so I will find it and change it
static int av_format_interrupt_cb(void *data) {
    xl_play_data *pd = data;
if (pd->timeout_start == 0) {    
        pd-> timeout_start = xl_clock_get_current_time() ; // start time
 return 0 ;
 } else {
         uint64_t time_use = xl_clock_get_current_time() - pd-> timeout_start ;
 if (time_use > 10000000 ) { // time, 6 0s should be 1 second , 10 seconds timeout
             // timeout
 return 1 ;
 } else {
             return 0 ;
 }                                                
    }
}
set after avformat_alloc_context
pd->format_context = avformat_alloc_context();
pd->format_context->interrupt_callback.callback = av_format_interrupt_cb;
pd->format_context->interrupt_callback.opaque = pd;
xl_clock_get_current_time should get the current time, the unit should be milliseconds
uint64_t xl_clock_get_current_time() {
    struct timeval tv;
    gettimeofday(&tv, NULL);
return (uint64_t)tv.tv_sec * 1000000 + (uint64_t)tv.tv_usec;
}    


 
 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325675974&siteId=291194637