mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-21 06:38:19 +00:00
sbc: sbcdec: Fix frame length calculation
SBC frame length calculation wasn't being rounded up to the nearest byte (as specified in the A2DP 1.0 specification, section 12.9). This could cause 'stereo' and 'joint stereo' mode SBC streams to have incorrectly calculated frame lengths. https://bugzilla.gnome.org/show_bug.cgi?id=742446
This commit is contained in:
parent
ffba31b7b2
commit
95a14fd470
1 changed files with 4 additions and 4 deletions
|
@ -159,13 +159,13 @@ gst_sbc_dec_set_format (GstAudioDecoder * audio_dec, GstCaps * caps)
|
|||
return FALSE;
|
||||
|
||||
if (strcmp (channel_mode, "mono") == 0) {
|
||||
dec->frame_len = 4 + (subbands * 1) / 2 + (blocks * 1 * bitpool) / 8;
|
||||
dec->frame_len = 4 + (subbands * 1) / 2 + ((blocks * 1 * bitpool) + 7) / 8;
|
||||
} else if (strcmp (channel_mode, "dual") == 0) {
|
||||
dec->frame_len = 4 + (subbands * 2) / 2 + (blocks * 2 * bitpool) / 8;
|
||||
dec->frame_len = 4 + (subbands * 2) / 2 + ((blocks * 2 * bitpool) + 7) / 8;
|
||||
} else if (strcmp (channel_mode, "stereo") == 0) {
|
||||
dec->frame_len = 4 + (subbands * 2) / 2 + (blocks * bitpool) / 8;
|
||||
dec->frame_len = 4 + (subbands * 2) / 2 + ((blocks * bitpool) + 7) / 8;
|
||||
} else if (strcmp (channel_mode, "joint") == 0) {
|
||||
dec->frame_len = 4 + (subbands * 2) / 2 + (subbands + blocks * bitpool) / 8;
|
||||
dec->frame_len = 4 + (subbands * 2) / 2 + ((subbands + blocks * bitpool) + 7) / 8;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue