[FFmpeg-devel] [PATCH] nellymoserdec: Allow using unusual input block sizes
Michael Niedermayer
michaelni
Mon Jun 14 14:36:33 CEST 2010
On Mon, Jun 14, 2010 at 02:27:20PM +0300, Martin Storsj? wrote:
> Hi,
>
> Currently, the nellymoser decoder tries to decode all blocks in a packet
> at once (for efficiency?), instead of only decoding the first one (as many
> other decoders do). The audio decoders that work in that way are able to
> decode a long stream of data without any framing, as long as they're fed
> with enough data to decode one packet.
>
> If the amount of blocks in the packet isn't one of the ones the decoder is
> familiar with, it simply errors out (with a message at the AV_LOG_DEBUG
> level, btw) - even if it would have decoded just fine if it would decode
> only one frame at a time.
>
> The attached patch is one way of solving it, another (less efficient) way
> would be to only decode the first block of a packet per call.
>
> // Martin
> nellymoserdec.c | 4 ++++
> 1 file changed, 4 insertions(+)
> 4ba350fbb466f70d56cb8d033e030408cadac936 0001-nellymoserdec-Allow-using-unusual-input-block-sizes.patch
> From ed6b4da0a8752b3ac1cd1e612522b3f2c43caaf4 Mon Sep 17 00:00:00 2001
> From: Martin Storsjo <martin at martin.st>
> Date: Mon, 14 Jun 2010 14:20:32 +0300
> Subject: [PATCH] nellymoserdec: Allow using unusual input block sizes
>
> ---
> libavcodec/nellymoserdec.c | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/libavcodec/nellymoserdec.c b/libavcodec/nellymoserdec.c
> index 82a3f07..cda8d11 100644
> --- a/libavcodec/nellymoserdec.c
> +++ b/libavcodec/nellymoserdec.c
> @@ -178,8 +178,12 @@ static int decode_tag(AVCodecContext * avctx,
> case 512: // 44100Hz
> blocks = 8; break;
> default:
> + if (buf_size % 64) {
> av_log(avctx, AV_LOG_DEBUG, "Tag size %d.\n", buf_size);
> return buf_size;
> + }
> + blocks = buf_size / 64;
> + break;
> }
the switch/case is unneeed
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100614/1905fe09/attachment.pgp>
More information about the ffmpeg-devel
mailing list