diff options
Diffstat (limited to 'src/multiplexer.cc')
-rw-r--r-- | src/multiplexer.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/multiplexer.cc b/src/multiplexer.cc index a94c150..323b33c 100644 --- a/src/multiplexer.cc +++ b/src/multiplexer.cc @@ -125,21 +125,31 @@ int Multiplexer::read_stream(char *buf, unsigned int size, StreamType type) // Lock output mutex pthread_mutex_lock( mutex[type] ); tmpframe = queue[type]->top(); + if(tmpframe && tmpframe->number == frame_number[type] ) { queue[type]->pop(); frame[type] = tmpframe; frame_number[type]++; read[type] = 0; } + /* if(*running == false && frame[type] == NULL) { pthread_mutex_unlock( mutex[type] ); //info->info("Bailed out early %d!", copied); return copied; } + */ + pthread_mutex_unlock( mutex[type] ); // Unlock output mutex } + // check for end of stream + if( frame[type] == endOfFrameStream ) { + info->info("endOfFrameStream in Multiplexer %s-stream.", type==TYPE_VIDEO?"video\0":"audio\0"); + return copied; + } + // If a frame exists in the buffer copy it to the output buffer // (No frame ocurres when *running is set to false) if( frame[type] ) { @@ -455,6 +465,7 @@ void Multiplexer::multiplex() char buf[1024]; do { frmsz = read_stream(buf, sizeof(buf), BYPASS); + info->info("Wrote %d bytes", frmsz); file->Write(buf, frmsz); } while(frmsz == sizeof(buf)); return; |