From 1c4d7309b2924c283f9922adda37d93ad1beca88 Mon Sep 17 00:00:00 2001 From: van Date: Mon, 18 Aug 2008 01:54:15 +0000 Subject: - patch a reference picture leak in ffmpeg/libavcodec/mpegvideo.c that caused aborts on h264 transport stream encodes. - patch the log level of some h264 decoder error messages so we don't fill our log with messages about stuff that's a very likely & not terribly significant. - don't let hb.c set the ffmpeg av_log level to AV_LOG_DEBUG -- it fills the HB activity log with junk. - add a count of the decoder errors to decavcodec's final report. - when we don't have any chapter text (i.e., during a typical cli encode) just print the chapter number rather than empty quote marks. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1639 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- libhb/decavcodec.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'libhb/decavcodec.c') diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c index a945680e0..62eca6566 100644 --- a/libhb/decavcodec.c +++ b/libhb/decavcodec.c @@ -92,8 +92,9 @@ struct hb_work_private_s int64_t chap_time; // time of next chap mark (if new_chap != 0) int new_chap; int ignore_pts; // workaround M$ bugs - int nframes; - int ndrops; + uint32_t nframes; + uint32_t ndrops; + uint32_t decode_errors; double duration; // frame duration (for video) }; @@ -340,8 +341,16 @@ static int get_frame_buf( AVCodecContext *context, AVFrame *frame ) static void log_chapter( hb_work_private_t *pv, int chap_num, int64_t pts ) { hb_chapter_t *c = hb_list_item( pv->job->title->list_chapter, chap_num - 1 ); - hb_log( "%s: \"%s\" (%d) at frame %u time %lld", pv->context->codec->name, - c->title, chap_num, pv->nframes, pts ); + if ( c && c->title ) + { + hb_log( "%s: \"%s\" (%d) at frame %u time %lld", + pv->context->codec->name, c->title, chap_num, pv->nframes, pts ); + } + else + { + hb_log( "%s: Chapter %d at frame %u time %lld", + pv->context->codec->name, chap_num, pv->nframes, pts ); + } } static int decodeFrame( hb_work_private_t *pv, uint8_t *data, int size ) @@ -349,7 +358,10 @@ static int decodeFrame( hb_work_private_t *pv, uint8_t *data, int size ) int got_picture; AVFrame frame; - avcodec_decode_video( pv->context, &frame, &got_picture, data, size ); + if ( avcodec_decode_video( pv->context, &frame, &got_picture, data, size ) < 0 ) + { + ++pv->decode_errors; + } if( got_picture ) { // ffmpeg makes it hard to attach a pts to a frame. if the MPEG ES @@ -498,7 +510,8 @@ static int decavcodecvWork( hb_work_object_t * w, hb_buffer_t ** buf_in, decodeVideo( pv, in->data, in->size, pts, dts ); hb_list_add( pv->list, in ); *buf_out = link_buf_list( pv ); - hb_log( "%s done: %d frames", pv->context->codec->name, pv->nframes ); + hb_log( "%s done: %u frames, %u decoder errors", + pv->context->codec->name, pv->nframes, pv->decode_errors ); return HB_WORK_DONE; } @@ -710,8 +723,9 @@ static int decavcodecviWork( hb_work_object_t * w, hb_buffer_t ** buf_in, } hb_list_add( pv->list, in ); *buf_out = link_buf_list( pv ); - hb_log( "%s done: %d frames %d drops", pv->context->codec->name, - pv->nframes, pv->ndrops ); + hb_log( "%s done: %u frames, %u decoder errors, %u drops", + pv->context->codec->name, pv->nframes, pv->decode_errors, + pv->ndrops ); return HB_WORK_DONE; } -- cgit v1.2.3