OSDN Git Service

fix a rare hang in the muxer.
authorjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Mon, 13 Sep 2010 20:30:02 +0000 (20:30 +0000)
committerjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Mon, 13 Sep 2010 20:30:02 +0000 (20:30 +0000)
git-svn-id: svn://localhost/HandBrake/trunk@3525 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/muxcommon.c

index 05f49d4..cb61739 100644 (file)
@@ -244,10 +244,12 @@ static int muxWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
         return HB_WORK_OK;
     }
 
         return HB_WORK_OK;
     }
 
+    int more = mux->rdy;
     // all tracks have at least 'interleave' ticks of data. Output
     // all that we can in 'interleave' size chunks.
     // all tracks have at least 'interleave' ticks of data. Output
     // all that we can in 'interleave' size chunks.
-    while ( ( mux->rdy & mux->allRdy ) == mux->allRdy )
+    while ( ( mux->rdy & mux->allRdy ) == mux->allRdy && more )
     {
     {
+        more = 0;
         for ( i = 0; i < mux->ntracks; ++i )
         {
             track = mux->track[i];
         for ( i = 0; i < mux->ntracks; ++i )
         {
             track = mux->track[i];
@@ -270,6 +272,10 @@ static int muxWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
             {
                 mux->rdy &=~ ( 1 << i );
             }
             {
                 mux->rdy &=~ ( 1 << i );
             }
+            if ( track->mf.out != track->mf.in )
+            {
+                more |= ( 1 << i );
+            }
         }
 
         // if all the tracks are at eof we're just purging their
         }
 
         // if all the tracks are at eof we're just purging their