diff options
Diffstat (limited to 'src/mov_encoder.cc')
-rw-r--r-- | src/mov_encoder.cc | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/mov_encoder.cc b/src/mov_encoder.cc index 4e8189c..118a338 100644 --- a/src/mov_encoder.cc +++ b/src/mov_encoder.cc @@ -97,13 +97,14 @@ void MovEncoder::thread_main() LibFAMEWrapper fame(info); // LibLAMEWrapper lame(info); - while(running) { - sem_wait(input_sem); - // Make a new instance for every frame sequence (usually 5) to ensure no // frame dependencies are broken when running multithreaded. LibLAMEWrapper lame(info); + while(running) { + sem_wait(input_sem); + + // Lock inout mutex pthread_mutex_lock(input_mutex); item = inputqueue->front(); @@ -119,16 +120,19 @@ void MovEncoder::thread_main() in_frame = item->at(cnt); // Encode video - out_v_frame = new Frame(in_frame->data, in_frame->size); - out_v_frame->number = in_frame->number; + //out_v_frame = new Frame(in_frame->data, in_frame->size); + //out_v_frame->number = in_frame->number; out_v_frame = fame.encode(in_frame); out_v_frame->number = in_frame->number; // Encode audio - out_a_frame = new Frame(in_frame->data, in_frame->size); - out_a_frame->number = in_frame->number; + //out_a_frame = new Frame(in_frame->data, in_frame->size); + //out_a_frame->number = in_frame->number; out_a_frame = lame.encode(in_frame); out_a_frame->number = in_frame->number; + + // Last frame - we need to close LAME + // if(cnt == item->size() - 1) out_a_frame = lame.close(out_a_frame); delete in_frame; |