@ -451,12 +451,21 @@ static int packet_queue_put_nullpacket(PacketQueue *q, int stream_index)
}
}
/* packet queue handling */
/* packet queue handling */
static void packet_queue_init ( PacketQueue * q )
static int packet_queue_init ( PacketQueue * q )
{
{
memset ( q , 0 , sizeof ( PacketQueue ) ) ;
memset ( q , 0 , sizeof ( PacketQueue ) ) ;
q - > mutex = SDL_CreateMutex ( ) ;
q - > mutex = SDL_CreateMutex ( ) ;
if ( ! q - > mutex ) {
av_log ( q , AV_LOG_FATAL , " SDL_CreateMutex(): %s \n " , SDL_GetError ( ) ) ;
return AVERROR ( ENOMEM ) ;
}
q - > cond = SDL_CreateCond ( ) ;
q - > cond = SDL_CreateCond ( ) ;
if ( ! q - > cond ) {
av_log ( q , AV_LOG_FATAL , " SDL_CreateCond(): %s \n " , SDL_GetError ( ) ) ;
return AVERROR ( ENOMEM ) ;
}
q - > abort_request = 1 ;
q - > abort_request = 1 ;
return 0 ;
}
}
static void packet_queue_flush ( PacketQueue * q )
static void packet_queue_flush ( PacketQueue * q )
@ -3136,9 +3145,10 @@ static VideoState *stream_open(const char *filename, AVInputFormat *iformat)
if ( frame_queue_init ( & is - > sampq , & is - > audioq , SAMPLE_QUEUE_SIZE , 1 ) < 0 )
if ( frame_queue_init ( & is - > sampq , & is - > audioq , SAMPLE_QUEUE_SIZE , 1 ) < 0 )
goto fail ;
goto fail ;
packet_queue_init ( & is - > videoq ) ;
if ( packet_queue_init ( & is - > videoq ) < 0 | |
packet_queue_init ( & is - > audioq ) ;
packet_queue_init ( & is - > audioq ) < 0 | |
packet_queue_init ( & is - > subtitleq ) ;
packet_queue_init ( & is - > subtitleq ) < 0 )
goto fail ;
is - > continue_read_thread = SDL_CreateCond ( ) ;
is - > continue_read_thread = SDL_CreateCond ( ) ;