summaryrefslogtreecommitdiff
path: root/recordmydesktop/src
diff options
context:
space:
mode:
Diffstat (limited to 'recordmydesktop/src')
-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