From 205565ccd9f93968265e76019426d9b048e2d3eb Mon Sep 17 00:00:00 2001 From: Tim Sheridan Date: Mon, 11 Jan 2016 16:29:55 +0000 Subject: [PATCH] sbcparse: 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. Incorrect frame length calculation causes frame coalescing to fail, as subsequent frames in the stream aren't found in the expected locations. https://bugzilla.gnome.org/show_bug.cgi?id=742446 --- gst/audioparsers/gstsbcparse.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gst/audioparsers/gstsbcparse.c b/gst/audioparsers/gstsbcparse.c index 5776511934..f7374f509e 100644 --- a/gst/audioparsers/gstsbcparse.c +++ b/gst/audioparsers/gstsbcparse.c @@ -423,13 +423,13 @@ gst_sbc_calc_framelen (guint subbands, GstSbcChannelMode ch_mode, { switch (ch_mode) { case GST_SBC_CHANNEL_MODE_MONO: - return 4 + (subbands * 1) / 2 + (blocks * 1 * bitpool) / 8; + return 4 + (subbands * 1) / 2 + ((blocks * 1 * bitpool) + 7) / 8; case GST_SBC_CHANNEL_MODE_DUAL: - return 4 + (subbands * 2) / 2 + (blocks * 2 * bitpool) / 8; + return 4 + (subbands * 2) / 2 + ((blocks * 2 * bitpool) + 7) / 8; case GST_SBC_CHANNEL_MODE_STEREO: - return 4 + (subbands * 2) / 2 + (blocks * bitpool) / 8; + return 4 + (subbands * 2) / 2 + ((blocks * bitpool) + 7) / 8; case GST_SBC_CHANNEL_MODE_JOINT_STEREO: - return 4 + (subbands * 2) / 2 + (subbands + blocks * bitpool) / 8; + return 4 + (subbands * 2) / 2 + ((subbands + blocks * bitpool) + 7) / 8; default: break; }