summaryrefslogtreecommitdiff
path: root/src/mov_encoder_thread.cc
diff options
context:
space:
mode:
authordeva <deva>2005-06-16 21:28:57 +0000
committerdeva <deva>2005-06-16 21:28:57 +0000
commite0592745a40dae2e14e5b6d9226f41a293ababc9 (patch)
treeb3640c07fd6af71aa01bed384613ffda6c03bf41 /src/mov_encoder_thread.cc
parentc397f2dcdc399b43cf150f8000e711fc20613deb (diff)
Rewrote thread object
Fixed bug in mov_encoder (pushed read_sem too many times, whihc lead to growing server queue)
Diffstat (limited to 'src/mov_encoder_thread.cc')
-rw-r--r--src/mov_encoder_thread.cc32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/mov_encoder_thread.cc b/src/mov_encoder_thread.cc
index 600a351..49ba24c 100644
--- a/src/mov_encoder_thread.cc
+++ b/src/mov_encoder_thread.cc
@@ -31,6 +31,11 @@
/*
* $Log$
+ * Revision 1.12 2005/06/16 21:28:57 deva
+ * Rewrote thread object
+ * Fixed bug in mov_encoder (pushed read_sem too many times, whihc lead to
+ * growing server queue)
+ *
* Revision 1.11 2005/06/14 18:58:35 deva
* *** empty log message ***
*
@@ -96,19 +101,21 @@ MovEncoderThread::MovEncoderThread(const char *cpr, Info *i)
pthread_mutex_init (&output_mutex, NULL);
writer = new MovEncoderWriter(cpr, outputqueue, &out_sem, &output_mutex, info);
- writer_tid = new pthread_t;
- pthread_create (writer_tid, NULL, thread_run, writer);
+ writer->run();
+ // writer_tid = new pthread_t;
+ //pthread_create (writer_tid, NULL, thread_run, writer);
for(int cnt = 0; cnt < threads; cnt++) {
- encs.push_back(new MovEncoder(&read_sem,
+ MovEncoder *movenc = new MovEncoder(&read_sem,
inputqueue, &in_sem, &input_mutex,
outputqueue, &out_sem, &output_mutex,
- info));
- tids.push_back(new pthread_t);
- pthread_create (tids[cnt], NULL, thread_run, encs[cnt]);
+ info);
+ movenc->run();
+ encs.push_back(movenc);
+ // tids.push_back(new pthread_t);
+ // pthread_create (tids[cnt], NULL, thread_run, encs[cnt]);
}
- current_frame = 0;
frame_number = 0;
}
@@ -133,11 +140,11 @@ MovEncoderThread::~MovEncoderThread()
// They should be exited now, so we can delete them.
for(int cnt = 0; cnt < threads; cnt++) {
- pthread_join(*tids[cnt], NULL);
+ // pthread_join(*tids[cnt], NULL);
delete encs[cnt];
- delete tids[cnt];
+ // delete tids[cnt];
}
-
+
// Tell the writer to stop
writer->running = false;
@@ -145,8 +152,8 @@ MovEncoderThread::~MovEncoderThread()
sem_post(&out_sem);
// Destroy the thread
- pthread_join(*writer_tid, NULL);
- delete writer_tid;
+ // pthread_join(*writer_tid, NULL);
+ // delete writer_tid;
// delete the writer (end thereby close the file)
delete writer;
@@ -193,7 +200,6 @@ void MovEncoderThread::encode(Frame* frame)
sem_post(&in_sem);
// Start new block
- current_frame = 0;
block = new FrameVector;
}