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:
Tim Sheridan 2016-01-12 14:54:23 +00:00 committed by Tim-Philipp Müller
parent ffba31b7b2
commit 95a14fd470

View file

@ -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;
}