Skip to content

Commit

Permalink
decoder: Properly take into account minimum buffer size
Browse files Browse the repository at this point in the history
The minimum buffer size could be larger than 512K, take this into account.
  • Loading branch information
digetx committed Jan 15, 2022
1 parent 5e53c98 commit 07304d2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ static VdpStatus copy_bitstream_to_dmabuf(tegra_decoder *dec,

/* at first try to allocate / reserve 512KB for common allocations */
if (total_size + 16 <= 512 * 1024) {
aligned_size = ALIGN(total_size + 16, 512 * 1024);
aligned_size = max(total_size + 16, dec->bitstream_min_size);
aligned_size = ALIGN(aligned_size, 512 * 1024);
*bo = alloc_data(dec, (void **)&start, data_fd, aligned_size);
}

Expand Down Expand Up @@ -1089,6 +1090,8 @@ VdpStatus vdp_decoder_create(VdpDevice device,
else
DebugMsg("V4L2 support undetected\n");

dec->bitstream_min_size = ALIGN(dec->bitstream_min_size, 512 * 1024);

*decoder = i;

put_device(dev);
Expand Down

0 comments on commit 07304d2

Please sign in to comment.