After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 636245 - [riff] For ADPCM codecs the average bitrate should be calculated instead of trusting the format header
[riff] For ADPCM codecs the average bitrate should be calculated instead of t...
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal minor
: 1.0.8
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 699804 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-12-01 18:58 UTC by Julien MOUTTE
Modified: 2013-05-07 13:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Sample WAV file with ADPCM encoded with Oxelon (1000.00 KB, audio/x-wav)
2010-12-01 19:00 UTC, Julien MOUTTE
  Details
Proposed patch for ADPCM IMA DVI and Microsoft (1.75 KB, patch)
2010-12-01 19:01 UTC, Julien MOUTTE
none Details | Review
Improved ADPCM bitrate calculation patch for riff-media.c (1.95 KB, patch)
2011-01-23 16:04 UTC, Julien MOUTTE
none Details | Review
Improved ADPCM bitrate calculation patch for riff-media.c for MS ADPCM (1.95 KB, patch)
2011-01-23 16:10 UTC, Julien MOUTTE
committed Details | Review

Description Julien MOUTTE 2010-12-01 18:58:00 UTC
Some ADPCM encoding tools like Oxelon generate WAV files with wrong format header declaring an invalid bitrate.

As wavparse uses the average bitrate to calculate timestamps and duration the decoder can be confused by receiving timestamps completely out of sync with the decoded samples.

ADPCM is a CBR audio codec so we can calculate the average bitrate  instead of trusting the format header.
Comment 1 Julien MOUTTE 2010-12-01 19:00:14 UTC
Created attachment 175655 [details]
Sample WAV file with ADPCM encoded with Oxelon
Comment 2 Julien MOUTTE 2010-12-01 19:01:38 UTC
Created attachment 175656 [details] [review]
Proposed patch for ADPCM IMA DVI and Microsoft
Comment 3 Julien MOUTTE 2011-01-23 16:04:27 UTC
Created attachment 179077 [details] [review]
Improved ADPCM bitrate calculation patch for riff-media.c

I did not take in account the preamble bytes in the bitrate calculation. The bitrate now allows wavparse to generate proper timestamps which identity confirms as being a perfect stream.
Comment 4 Julien MOUTTE 2011-01-23 16:10:37 UTC
Created attachment 179078 [details] [review]
Improved ADPCM bitrate calculation patch for riff-media.c for MS ADPCM

Just realized that Microsoft's layout for ADPCM has a 7 bytes preamble instead of 4 bytes like IMA ADPCM variants.
Comment 5 Sebastian Dröge (slomo) 2013-05-07 13:02:02 UTC
commit 6f9006c9b9753f47733ea17f803a63ea5a1500ef
Author: Julien Moutte <julien@moutte.net>
Date:   Tue May 7 15:00:05 2013 +0200

    riff: Manually calculate bitrate of ADPCM streams
    
    Some ADPCM encoding tools like Oxelon generate WAV files with
    wrong format header declaring an invalid bitrate.
    
    As wavparse uses the average bitrate to calculate timestamps
    and duration the decoder can be confused by receiving timestamps
    completely out of sync with the decoded samples.
    
    ADPCM is a CBR audio codec so we can calculate the average bitrate
    instead of trusting the format header.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=636245
Comment 6 Sebastian Dröge (slomo) 2013-05-07 13:02:58 UTC
*** Bug 699804 has been marked as a duplicate of this bug. ***