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-16 22:07:07 +0000
commitf719b30815de4239bf58b5ad77a613b4ea1c791d (patch)
tree2c436a0e21b8036ab742bab160fa8ebf30eb875a
parentcaee1d0446122f2afdf74fec9db2846c687d998a (diff)
downloadgstreamer-plugins-bad-f719b30815de4239bf58b5ad77a613b4ea1c791d.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;
}