c++ - Error in ffmpeg when reading from UDP stream -
i'm trying process frames udp stream using ffmpeg. run fine while av_read_frame()
return either averror_exit
(immeditate exit requested) or -5
(error number -5 occurred) while stream should still running fine. right before error prints following message console
[mpeg2video @ 0caf6600] ac-tex damaged @ 14 10 [mpeg2video @ 0caf6600] warning mvs not available [mpeg2video @ 0caf6600] concealing 800 dc, 800 ac, 800 mv errors in frame
(the numbers in message vary run run)
i have suspicion error related calling av_read_frame
quickly. if have run fast possible, error within 10-20 frames, if put sleep before reading run fine minute or , exit error. realize hacky , assume there better solution. bottom line: there way dynamically check if 'av_read_frame()' ready called? or way supress error?
psuedo code of i'm doing below. in advance help!
void getframe() { //wait here?? seems hacky... //boost::this_thread::sleep(boost::posix_time::milliseconds(25)); int av_read_frame_error = av_read_frame(m_input_format_context, &m_input_packet); if(av_read_frame_error == 0){ //do stuff - works fine when gets here } else{ //error char errorbuf[av_error_max_string_size]; av_make_error_string(errorbuf, av_error_max_string_size, av_read_frame_error); cout << "ffmpeg input stream exit code: " << av_read_frame_error << " message: " << errorbuf << endl; } }
incoming frames needs handled in callback function. mechanism should such callback gets called whenever there new frame. in way there no need manually fine tune delay.
disclaimer: have not used ffmpeg apis.
Comments
Post a Comment