diff options
Diffstat (limited to 'src/mov_encoder_thread.cc')
-rw-r--r-- | src/mov_encoder_thread.cc | 65 |
1 files changed, 12 insertions, 53 deletions
diff --git a/src/mov_encoder_thread.cc b/src/mov_encoder_thread.cc index 59e3c84..dab308d 100644 --- a/src/mov_encoder_thread.cc +++ b/src/mov_encoder_thread.cc @@ -93,7 +93,7 @@ MovEncoderThread::MovEncoderThread(const char *cpr, Info *i) frame_number = 0; } -#include <unistd.h> +//#include <unistd.h> MovEncoderThread::~MovEncoderThread() { info->info("~MovEncoderThread"); @@ -123,56 +123,6 @@ MovEncoderThread::~MovEncoderThread() info->info("Deleted the writer"); - /* - // These should not be deleted here... its done elsewhere. - // inputqueue = NULL; - - // sem_post(&video_out_sem); - // sem_post(&audio_out_sem); - - // Tell the encoding threads to stop. - for(int cnt = 0; cnt < threads; cnt++) { - encs[cnt]->running = false; - } - - // Kick them to initiate the exit. - for(int cnt = 0; cnt < threads; cnt++) { - sem_post(&in_sem); - } - - // They should be exited now, so we can delete them. - for(int cnt = 0; cnt < threads; cnt++) { - // Wait for it to stop - encs[cnt]->wait_stop(); - // Delete it - delete encs[cnt]; - } - - // Tell the audio encoder to stop - audioenc->running = false; - - // Kick it to make it stop. - sem_post(&audio_in_sem); - - // Wait for it to stop. - audioenc->wait_stop(); - - // delete the audio encoder - delete audioenc; - - // Tell the writer to stop - writer->running = false; - - // Kick it to make it stop. - sem_post(&video_out_sem); - sem_post(&audio_out_sem); - - // Wait for it to stop. - writer->wait_stop(); - - // delete the writer (end thereby close the file) - delete writer; - */ // Destroy the semaphores. sem_destroy(&in_sem); sem_destroy(&video_out_sem); @@ -180,12 +130,21 @@ MovEncoderThread::~MovEncoderThread() sem_destroy(&audio_out_sem); sem_destroy(&read_sem); - - info->info("MovEncoderThread done deinitializing."); + info->info("~MovEncoderThread::done"); } +static int output = 0; void MovEncoderThread::encode(Frame* frame) { + if(output % 250 == 0) // 25 * 24 + info->info("inputqueue: %d\tvideo_outputqueue: %d\taudio_inputqueue: %d\taudio_outputqueue: %d.", + inputqueue->size(), + video_outputqueue->size(), + audio_inputqueue->size(), + audio_outputqueue->size()); + output++; + + if(frame == NULL) { info->info("MovEncoderThread::encode - NULL frame detected."); // Terminate |