OSDN Git Service

fix fps logging when there is no audio track.
authorjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Thu, 22 Apr 2010 01:57:09 +0000 (01:57 +0000)
committerjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Thu, 22 Apr 2010 01:57:09 +0000 (01:57 +0000)
where there's no audio, the muxer closes earlier than when there is audio
due to reference counting.  upon close, the muxer sets the muxing
state which overwrites the current state that includes the avg fps.
so log the avg fps before closing mux.

git-svn-id: svn://localhost/HandBrake/trunk@3251 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/muxcommon.c
libhb/work.c

index 702285b..b6b5a2a 100644 (file)
@@ -289,6 +289,19 @@ void muxClose( hb_work_object_t * w )
     hb_lock( mux->mutex );
     if ( --mux->ref == 0 )
     {
+        // Update state before closing muxer.  Closing the muxer
+        // may initiate optimization which can take a while and
+        // we want the muxing state to be visible while this is
+        // happening.
+        if( job->pass == 0 || job->pass == 2 )
+        {
+            /* 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 );
@@ -301,12 +314,6 @@ void muxClose( hb_work_object_t * w )
             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( !stat( job->file, &sb ) )
             {
                 hb_deep_log( 2, "mux: file size, %"PRId64" bytes", (uint64_t) sb.st_size );
index eea492b..935ffa4 100644 (file)
@@ -939,6 +939,12 @@ static void do_job( hb_job_t * job, int cpu_count )
         }
     }
 
+    hb_handle_t * h = job->h;
+    hb_state_t state;
+    hb_get_state( h, &state );
+    
+    hb_log("work: average encoding speed for job is %f fps", state.param.working.rate_avg);
+
     job->done = 1;
     if( muxer != NULL )
     {
@@ -953,12 +959,6 @@ static void do_job( hb_job_t * job, int cpu_count )
         free( sync );
     }
 
-    hb_handle_t * h = job->h;
-    hb_state_t state;
-    hb_get_state( h, &state );
-    
-    hb_log("work: average encoding speed for job is %f fps", state.param.working.rate_avg);
-
 cleanup:
     /* Stop the write thread (thread_close will block until the muxer finishes) */
     job->done = 1;