diff options
-rw-r--r-- | recordmydesktop/src/capture_sound.c | 2 | ||||
-rw-r--r-- | recordmydesktop/src/encode_sound_buffer.c | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/recordmydesktop/src/capture_sound.c b/recordmydesktop/src/capture_sound.c index d9ffa91..4314984 100644 --- a/recordmydesktop/src/capture_sound.c +++ b/recordmydesktop/src/capture_sound.c @@ -124,7 +124,7 @@ void *CaptureSound(ProgData *pdata){ do{ int temp_sret=read(pdata->sound_handle, &newbuf->data[sret], - pdata->args.buffsize); + pdata->args.buffsize-sret); if(temp_sret<0){ fprintf(stderr,"An error occured while reading from soundcard" "%s\n" diff --git a/recordmydesktop/src/encode_sound_buffer.c b/recordmydesktop/src/encode_sound_buffer.c index f20d98e..0e8fa2c 100644 --- a/recordmydesktop/src/encode_sound_buffer.c +++ b/recordmydesktop/src/encode_sound_buffer.c @@ -31,7 +31,7 @@ void *EncodeSoundBuffer(ProgData *pdata){ #ifdef HAVE_LIBASOUND int sampread=pdata->periodsize; #else - int sampread=pdata->args.buffsize>>1; + int sampread=(pdata->args.buffsize>>1)/pdata->args.channels; #endif pdata->v_encoding_clean=0; while((pdata->running)){ @@ -106,7 +106,8 @@ void SyncEncodeSoundBuffer(ProgData *pdata,signed char *buff){ #ifdef HAVE_LIBASOUND int sampread=(buff!=NULL)?pdata->periodsize:0; #else - int sampread=(buff!=NULL)?(pdata->args.buffsize>>1):0; + int sampread=(buff!=NULL)?((pdata->args.buffsize>>1)/ + pdata->args.channels):0; #endif vorbis_buffer=vorbis_analysis_buffer(&pdata->enc_data->m_vo_dsp,sampread); for(i=0;i<sampread;i++){ |