summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Sheridan <tim.sheridan@imgtec.com>2016-01-12 14:54:23 +0000
committerTim-Philipp Müller <tim@centricular.com>2016-01-12 21:45:05 +0000
commit95a14fd470e7b89a9a5e7476c03e710066ce2b46 (patch)
treebbc5cf7ce97beec2a2220c58b4ae0d8551cbe91c
parentffba31b7b2b23e031dd7570d08c6baddb10c83c2 (diff)
downloadgstreamer-plugins-bad-95a14fd470e7b89a9a5e7476c03e710066ce2b46.tar.gz
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
-rw-r--r--ext/sbc/gstsbcdec.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/sbc/gstsbcdec.c b/ext/sbc/gstsbcdec.c
index 5031dd922..086fe1fc0 100644
--- a/ext/sbc/gstsbcdec.c
+++ b/ext/sbc/gstsbcdec.c
@@ -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;
}