diff options
-rw-r--r-- | libhb/muxcommon.c | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/libhb/muxcommon.c b/libhb/muxcommon.c index 7ea3c7933..95e1ab168 100644 --- a/libhb/muxcommon.c +++ b/libhb/muxcommon.c @@ -279,59 +279,59 @@ void muxClose( hb_work_object_t * w ) hb_track_t * track; int i; - // we're all done muxing -- print final stats and cleanup. - if( job->pass == 0 || job->pass == 2 ) + hb_lock( mux->mutex ); + if ( --mux->ref == 0 ) { - struct stat sb; - uint64_t bytes_total, frames_total; - - /* Update the UI */ - hb_state_t state; - state.state = HB_STATE_MUXING; - state.param.muxing.progress = 0; - hb_set_state( job->h, &state ); + if( mux->m ) + { + mux->m->end( mux->m ); + free( mux->m ); + } - if( !stat( job->file, &sb ) ) + // we're all done muxing -- print final stats and cleanup. + if( job->pass == 0 || job->pass == 2 ) { - hb_deep_log( 2, "mux: file size, %"PRId64" bytes", (uint64_t) sb.st_size ); + struct stat sb; + uint64_t bytes_total, frames_total; + + /* Update the UI */ + hb_state_t state; + state.state = HB_STATE_MUXING; + state.param.muxing.progress = 0; + hb_set_state( job->h, &state ); - bytes_total = 0; - frames_total = 0; - for( i = 0; i < mux->ntracks; ++i ) + if( !stat( job->file, &sb ) ) { - track = mux->track[i]; - hb_log( "mux: track %d, %"PRId64" frames, %"PRId64" bytes, %.2f kbps, fifo %d", - i, track->frames, track->bytes, - 90000.0 * track->bytes / mux->pts / 125, - track->mf.flen ); - if( !i && ( job->vquality < 0.0 || job->vquality > 1.0 ) ) + hb_deep_log( 2, "mux: file size, %"PRId64" bytes", (uint64_t) sb.st_size ); + + bytes_total = 0; + frames_total = 0; + for( i = 0; i < mux->ntracks; ++i ) { - /* Video */ - hb_deep_log( 2, "mux: video bitrate error, %+"PRId64" bytes", - (int64_t)(track->bytes - mux->pts * job->vbitrate * 125 / 90000) ); + track = mux->track[i]; + hb_log( "mux: track %d, %"PRId64" frames, %"PRId64" bytes, %.2f kbps, fifo %d", + i, track->frames, track->bytes, + 90000.0 * track->bytes / mux->pts / 125, + track->mf.flen ); + if( !i && ( job->vquality < 0.0 || job->vquality > 1.0 ) ) + { + /* Video */ + hb_deep_log( 2, "mux: video bitrate error, %+"PRId64" bytes", + (int64_t)(track->bytes - mux->pts * job->vbitrate * 125 / 90000) ); + } + bytes_total += track->bytes; + frames_total += track->frames; } - bytes_total += track->bytes; - frames_total += track->frames; - } - if( bytes_total && frames_total ) - { - hb_deep_log( 2, "mux: overhead, %.2f bytes per frame", - (float) ( sb.st_size - bytes_total ) / - frames_total ); + if( bytes_total && frames_total ) + { + hb_deep_log( 2, "mux: overhead, %.2f bytes per frame", + (float) ( sb.st_size - bytes_total ) / + frames_total ); + } } } - } - hb_lock( mux->mutex ); - if ( --mux->ref == 0 ) - { - if( mux->m ) - { - mux->m->end( mux->m ); - free( mux->m ); - } - for( i = 0; i < mux->ntracks; ++i ) { track = mux->track[i]; |