summaryrefslogtreecommitdiffstats
path: root/libhb/sync.c
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2017-07-12 13:38:00 -0700
committerJohn Stebbins <[email protected]>2017-07-12 13:38:00 -0700
commit7263ff2d6900fdfa21f0f4a948bc1b5f321617b3 (patch)
tree449d8eabe7dc44593452525a1e7142860e60b740 /libhb/sync.c
parent0024d5ae2af1738962dcbe806274039e04a9deed (diff)
sync: fix size of silence buffer
It was not an even number of sample size * num channels in some cases
Diffstat (limited to 'libhb/sync.c')
-rw-r--r--libhb/sync.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libhb/sync.c b/libhb/sync.c
index 7b9471215..72b779bde 100644
--- a/libhb/sync.c
+++ b/libhb/sync.c
@@ -318,10 +318,11 @@ static hb_buffer_t * CreateSilenceBuf( sync_stream_t * stream,
}
if (duration > 0)
{
- size = sizeof(float) *
- (duration * stream->audio.audio->config.in.samplerate / 90000) *
- av_get_channel_layout_nb_channels(
- stream->audio.audio->config.in.channel_layout );
+ // Make certain size is even multiple of sample size * num channels
+ size = (int)(duration * stream->audio.audio->config.in.samplerate /
+ 90000) * sizeof(float) *
+ av_get_channel_layout_nb_channels(
+ stream->audio.audio->config.in.channel_layout);
if (size > 0)
{
buf = hb_buffer_init(size);