summaryrefslogtreecommitdiff
path: root/ffplay.c
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2012-01-09 00:23:12 +0100
committerMarton Balint <cus@passwd.hu>2012-01-11 23:10:45 +0100
commit1348420b8ae87f19e1659a9a50e74df6e3791b57 (patch)
tree54664f1891da3fca85f753323bab163a6ed113fd /ffplay.c
parent6f06545b26222000efd96df2371f7c58f5df9b61 (diff)
ffplay: silence buffer size must be a multiple of frame size
Otherwise the audio channels sometimes would be shifted on output. Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'ffplay.c')
-rw-r--r--ffplay.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ffplay.c b/ffplay.c
index 5019fb5dc5..749cfc7b91 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -2163,6 +2163,7 @@ static void sdl_audio_callback(void *opaque, Uint8 *stream, int len)
VideoState *is = opaque;
int audio_size, len1;
int bytes_per_sec;
+ int frame_size = av_samples_get_buffer_size(NULL, is->audio_tgt_channels, 1, is->audio_tgt_fmt, 1);
double pts;
audio_callback_time = av_gettime();
@@ -2173,7 +2174,7 @@ static void sdl_audio_callback(void *opaque, Uint8 *stream, int len)
if (audio_size < 0) {
/* if error, just output silence */
is->audio_buf = is->silence_buf;
- is->audio_buf_size = sizeof(is->silence_buf);
+ is->audio_buf_size = sizeof(is->silence_buf) / frame_size * frame_size;
} else {
if (is->show_mode != SHOW_MODE_VIDEO)
update_sample_display(is, (int16_t *)is->audio_buf, audio_size);