diff options
Diffstat (limited to 'recordmydesktop/src')
-rw-r--r-- | recordmydesktop/src/encode_image_buffer.c | 2 | ||||
-rw-r--r-- | recordmydesktop/src/get_frame.c | 7 | ||||
-rw-r--r-- | recordmydesktop/src/recordmydesktop.c | 3 | ||||
-rw-r--r-- | recordmydesktop/src/register_callbacks.c | 5 |
4 files changed, 17 insertions, 0 deletions
diff --git a/recordmydesktop/src/encode_image_buffer.c b/recordmydesktop/src/encode_image_buffer.c index 4ee34b0..315ad5c 100644 --- a/recordmydesktop/src/encode_image_buffer.c +++ b/recordmydesktop/src/encode_image_buffer.c @@ -32,6 +32,7 @@ void *EncodeImageBuffer(void *pdata){ pthread_mutex_init(&imut,NULL); while(((ProgData *)pdata)->running){ + encoder_busy=1; pthread_cond_wait(&((ProgData *)pdata)->image_buffer_ready,&imut); if(Paused) pthread_cond_wait(&((ProgData *)pdata)->pause_cond,&pmut);//this may not be needed @@ -44,6 +45,7 @@ void *EncodeImageBuffer(void *pdata){ theora_encode_packetout(&((ProgData *)pdata)->enc_data->m_th_st,0,&((ProgData *)pdata)->enc_data->m_ogg_pckt1); 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; + encoder_busy=0; } //last packet if(theora_encode_YUVin(&((ProgData *)pdata)->enc_data->m_th_st,&((ProgData *)pdata)->enc_data->yuv)){ diff --git a/recordmydesktop/src/get_frame.c b/recordmydesktop/src/get_frame.c index ff935c0..2a55ba2 100644 --- a/recordmydesktop/src/get_frame.c +++ b/recordmydesktop/src/get_frame.c @@ -48,6 +48,8 @@ void *GetFrame(void *pdata){ if(Paused){ pthread_cond_wait(&((ProgData *)pdata)->pause_cond,&pmut); } + capture_busy=1; + /*pthread_cond_wait(&((ProgData *)pdata)->pause_cond,&((ProgData *)pdata)->pause_cond_mutex);*/ //mutexes and lists with changes are useless when full_shots is enabled if(!((ProgData *)pdata)->args.full_shots){ @@ -187,7 +189,12 @@ void *GetFrame(void *pdata){ ClearList(&((ProgData *)pdata)->rect_root[tlist_sel]); pthread_mutex_unlock(&((ProgData *)pdata)->list_mutex[tlist_sel]); } + if(encoder_busy){ + frames_lost++; + frames_to_add++; + } pthread_cond_broadcast(&((ProgData *)pdata)->image_buffer_ready); + capture_busy=0; } pthread_cond_broadcast(&((ProgData *)pdata)->image_buffer_ready); pthread_exit(&errno); diff --git a/recordmydesktop/src/recordmydesktop.c b/recordmydesktop/src/recordmydesktop.c index fda74f9..3ebdd6a 100644 --- a/recordmydesktop/src/recordmydesktop.c +++ b/recordmydesktop/src/recordmydesktop.c @@ -73,6 +73,9 @@ int main(int argc,char **argv){ //init data + //these are globals, look for them at the header + frames_total=frames_lost=frames_to_add=encoder_busy=capture_busy=0; + if(!pdata.args.scshot){ fprintf(stderr,"Initializing...\n"); MakeMatrices(); diff --git a/recordmydesktop/src/register_callbacks.c b/recordmydesktop/src/register_callbacks.c index d7fa00b..262e3ae 100644 --- a/recordmydesktop/src/register_callbacks.c +++ b/recordmydesktop/src/register_callbacks.c @@ -27,6 +27,11 @@ #include <recordmydesktop.h> void SetExpired(int signum){ + frames_total++; + if(capture_busy){ + frames_to_add++; + frames_lost++; + } pthread_cond_broadcast(time_cond); } |