summaryrefslogtreecommitdiff
path: root/recordmydesktop
diff options
context:
space:
mode:
authoriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2006-09-28 10:43:54 +0000
committeriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2006-09-28 10:43:54 +0000
commit6d529d133342903f66532231daa301c39784d521 (patch)
treeed333340139c18e886aa19f6af1a42362789f946 /recordmydesktop
parent73c3a8ab5131d11927d84fd19a566770486c00bb (diff)
fix, in order to not hang on the encoder
git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@74 f606c939-3180-4ac9-a4b8-4b8779d57d0a
Diffstat (limited to 'recordmydesktop')
-rw-r--r--recordmydesktop/src/encode_image_buffer.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/recordmydesktop/src/encode_image_buffer.c b/recordmydesktop/src/encode_image_buffer.c
index d3cabab..92df5fe 100644
--- a/recordmydesktop/src/encode_image_buffer.c
+++ b/recordmydesktop/src/encode_image_buffer.c
@@ -29,6 +29,7 @@ void *EncodeImageBuffer(void *pdata){
pthread_mutex_t pmut,imut;
pthread_mutex_init(&pmut,NULL);
pthread_mutex_init(&imut,NULL);
+ int counter=0;
while(((ProgData *)pdata)->running){
encoder_busy=1;
pthread_cond_wait(&((ProgData *)pdata)->image_buffer_ready,&imut);
@@ -37,14 +38,16 @@ void *EncodeImageBuffer(void *pdata){
pthread_mutex_lock(&((ProgData *)pdata)->yuv_mutex);
//code duplication is evil.
//almost as evil as globals...
+ counter=((ProgData *)pdata)->args.fps;
while(((ProgData *)pdata)->avd<=0){
if(!theora_encode_YUVin(&((ProgData *)pdata)->enc_data->m_th_st,&((ProgData *)pdata)->enc_data->yuv)){
if(theora_encode_packetout(&((ProgData *)pdata)->enc_data->m_th_st,0,&((ProgData *)pdata)->enc_data->m_ogg_pckt1)==1)
ogg_stream_packetin(&((ProgData *)pdata)->enc_data->m_ogg_ts,&((ProgData *)pdata)->enc_data->m_ogg_pckt1);
((ProgData *)pdata)->avd+=((ProgData *)pdata)->frametime*2*((ProgData *)pdata)->args.channels;
}
- if(!((ProgData *)pdata)->running)
+ if(!((ProgData *)pdata)->running || counter<=0)
break;
+ counter--;
}
if(theora_encode_YUVin(&((ProgData *)pdata)->enc_data->m_th_st,&((ProgData *)pdata)->enc_data->yuv)){
fprintf(stderr,"Encoder not ready!\n");
© All Rights Reserved