summaryrefslogtreecommitdiffstats
path: root/libhb/muxcommon.c
diff options
context:
space:
mode:
authorvan <vanj.hb@gmail.com>2009-05-06 06:42:21 +0000
committervan <vanj.hb@gmail.com>2009-05-06 06:42:21 +0000
commit6c18f1b2bb0d939bd76a958907b2848db98ba380 (patch)
treeee00b579cd2d2c109cf9bcb8e5adde4a9e7257cd /libhb/muxcommon.c
parent79e3ce78a5d733d559820949e0d43e9769b7dc75 (diff)
Fix several boneheaded mistakes in fifo ready logic.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2391 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/muxcommon.c')
-rw-r--r--libhb/muxcommon.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/libhb/muxcommon.c b/libhb/muxcommon.c
index b64ebff85..813afc863 100644
--- a/libhb/muxcommon.c
+++ b/libhb/muxcommon.c
@@ -265,7 +265,7 @@ static void MuxerFunc( void * _mux )
while( !*job->die )
{
MoveToInternalFifos( mux );
- if ( mux->rdy != mux->allRdy )
+ if ( ( mux->rdy & mux->allRdy ) != mux->allRdy )
{
hb_snooze( thread_sleep_interval );
continue;
@@ -273,22 +273,25 @@ static void MuxerFunc( void * _mux )
// all tracks have at least 'interleave' ticks of data. Output
// all that we can in 'interleave' size chunks.
- while ( mux->rdy == mux->allRdy )
+ while ( ( mux->rdy & mux->allRdy ) == mux->allRdy )
{
for ( i = 0; i < mux->ntracks; ++i )
{
- track = mux->track[i];
- OutputTrackChunk( mux, track, m );
-
- // if the track is at eof or still has data that's past
- // our next interleave point then leave it marked as rdy.
- // Otherwise clear rdy.
- if ( ( mux->eof & (1 << i) ) == 0 &&
- ( track->mf.out == track->mf.in ||
- track->mf.fifo[(track->mf.in-1) & (track->mf.flen-1)]->stop
- < mux->pts + mux->interleave ) )
+ if ( mux->rdy & (1 << i) )
{
- mux->rdy &=~ ( 1 << i );
+ track = mux->track[i];
+ OutputTrackChunk( mux, track, m );
+
+ // if the track is at eof or still has data that's past
+ // our next interleave point then leave it marked as rdy.
+ // Otherwise clear rdy.
+ if ( ( mux->eof & (1 << i) ) == 0 &&
+ ( track->mf.out == track->mf.in ||
+ track->mf.fifo[(track->mf.in-1) & (track->mf.flen-1)]->stop
+ < mux->pts + mux->interleave ) )
+ {
+ mux->rdy &=~ ( 1 << i );
+ }
}
}