summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
authorRodeo <[email protected]>2012-08-15 15:43:33 +0000
committerRodeo <[email protected]>2012-08-15 15:43:33 +0000
commit7cd3b216443482163c68e01fe48755f5763a7053 (patch)
treec929233dfecf243784a3e03f0402340755e99bed /libhb
parent6254327d7932b0a33a533453ac11f66e0915a123 (diff)
Don't send empty audio packets downstream, as empty buffers are assumed to mark the end of stream.
Such packets can result from samplerate or other types of audio conversion. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4906 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r--libhb/audio_resample.c6
-rw-r--r--libhb/sync.c7
2 files changed, 11 insertions, 2 deletions
diff --git a/libhb/audio_resample.c b/libhb/audio_resample.c
index 94ab3b531..ced6d69fd 100644
--- a/libhb/audio_resample.c
+++ b/libhb/audio_resample.c
@@ -174,9 +174,11 @@ hb_buffer_t* hb_audio_resample(hb_audio_resample_t *resample,
(void**)&samples,
resample->in.linesize, nsamples);
- if (out_samples < 0)
+ if (out_samples <= 0)
{
- hb_log("hb_audio_resample: avresample_convert() failed");
+ if (out_samples < 0)
+ hb_log("hb_audio_resample: avresample_convert() failed");
+ // don't send empty buffers downstream (EOF)
hb_buffer_close(&out);
return NULL;
}
diff --git a/libhb/sync.c b/libhb/sync.c
index 73a1071e3..9c202c250 100644
--- a/libhb/sync.c
+++ b/libhb/sync.c
@@ -1085,6 +1085,13 @@ static hb_buffer_t * OutputAudioFrame( hb_audio_t *audio, hb_buffer_t *buf,
}
hb_buffer_close( &buf_raw );
+ if (sync->data.output_frames_gen <= 0)
+ {
+ // XXX: don't send empty buffers downstream (EOF)
+ // possibly out-of-sync audio is better than no audio at all
+ hb_buffer_close(&buf);
+ return NULL;
+ }
buf->size = sync->data.output_frames_gen * sample_size;
duration = (double)( sync->data.output_frames_gen * 90000 ) /
audio->config.out.samplerate;