[FFmpeg-devel] [PATCH] brstm: Fix last packet samples calculation

jamal jamrial at gmail.com
Sun Dec 16 00:21:26 CET 2012


On 15/12/12 8:06 PM, Derek Buitenhuis wrote:
> On 14/12/2012 1:15 PM, jamal wrote:
>> From: James Almer <jamrial at gmail.com>
>> Date: Fri, 14 Dec 2012 15:10:40 -0300
>> Subject: [PATCH] brstm: Fix last packet samples calculation
>>
>>
>> Signed-off-by: James Almer <jamrial at gmail.com>
>> ---
>>  libavformat/brstm.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavformat/brstm.c b/libavformat/brstm.c
>> index 0a874d3..80f73ed 100644
>> --- a/libavformat/brstm.c
>> +++ b/libavformat/brstm.c
>> @@ -245,7 +245,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
>>      b->current_block++;
>>      if (b->current_block == b->block_count) {
>>          size    = b->last_block_used_bytes;
>> -        samples = size / 16 * 14;
>> +        samples = size / (8 * codec->channels) * 14;
> 
> So previously we assumed 2 channels here, it seems. Can you document
> the reason for this change properly in the commit message?
> 
> - Derek

Sure, here it is.

Regards.
-------------- next part --------------
>From 97cabdf197314b2d04acce31202879ce8efd4d89 Mon Sep 17 00:00:00 2001
From: James Almer <jamrial at gmail.com>
Date: Sat, 15 Dec 2012 20:16:10 -0300
Subject: [PATCH] brstm: Fix last packet samples calculation

This fixes the calculation of samples in the last packet
of non-stereo streams.

Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavformat/brstm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/brstm.c b/libavformat/brstm.c
index 0a874d3..80f73ed 100644
--- a/libavformat/brstm.c
+++ b/libavformat/brstm.c
@@ -245,7 +245,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
     b->current_block++;
     if (b->current_block == b->block_count) {
         size    = b->last_block_used_bytes;
-        samples = size / 16 * 14;
+        samples = size / (8 * codec->channels) * 14;
     } else if (b->current_block < b->block_count) {
         size    = b->block_size;
         samples = b->samples_per_block;
-- 
1.8.0.msysgit.0



More information about the ffmpeg-devel mailing list