[FFmpeg-devel] [PATCH] WMA Lossless: reset channel residues between subframes

Mashiat Sarker Shakkhar mashiat.sarker at gmail.com
Sat Apr 14 19:29:30 CEST 2012

On 4/14/2012 8:25 PM, Jakub Stachowski wrote:
> By the way: does anybody know if WMA stream contains exact number of
> samples? I tried to fix decoder cutting off last packet from decoded
> data (due not not handling 'flush'), but now have opposite problem -
> last frame is always full length (2048 samples) padded with zeros and I
> found no good way of determining how many samples are valid.

Supposedly there is a way, although I don't know if it works that way in 
practice. Let me know if the following method works for you:

Every WMAL frame has a fixed number of samples - samples_per_frame in 
our decoder. Now after you have finished decoding the very last frame, 
you may have additional rounding-off samples. In theory, the get_bits1() 
at line 1056 will return 1 in such cases. Then you will know how many 
samples to prune from the end of the last frame. (So the last frame size 
will be samples_per_frame - skip in this case.)

I'd be glad if you could try it and reply with result.



More information about the ffmpeg-devel mailing list