Skip to content

Commit

Permalink
sync: fix size of silence buffer
Browse files Browse the repository at this point in the history
It was not an even number of sample size * num channels in some cases
  • Loading branch information
jstebbins committed Jul 12, 2017
1 parent 0024d5a commit 7263ff2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions libhb/sync.c
Expand Up @@ -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);
Expand Down

0 comments on commit 7263ff2

Please sign in to comment.