mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-03 09:01:50 -05:00
Fix misuse of 'frame.joint' when estimating the frame length.
'frame.joint' is not the flag for joint stereo mode, it is a set of bits which show for which subbands channels joining was actually used.
This commit is contained in:
parent
f80a1f6d31
commit
b03c545850
1 changed files with 12 additions and 17 deletions
|
|
@ -1004,7 +1004,7 @@ ssize_t sbc_decode(sbc_t *sbc, const void *input, size_t input_len,
|
||||||
sbc->bitpool = priv->frame.bitpool;
|
sbc->bitpool = priv->frame.bitpool;
|
||||||
|
|
||||||
priv->frame.codesize = sbc_get_codesize(sbc);
|
priv->frame.codesize = sbc_get_codesize(sbc);
|
||||||
priv->frame.length = sbc_get_frame_length(sbc);
|
priv->frame.length = framelen;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!output)
|
if (!output)
|
||||||
|
|
@ -1136,30 +1136,25 @@ void sbc_finish(sbc_t *sbc)
|
||||||
size_t sbc_get_frame_length(sbc_t *sbc)
|
size_t sbc_get_frame_length(sbc_t *sbc)
|
||||||
{
|
{
|
||||||
size_t ret;
|
size_t ret;
|
||||||
uint8_t subbands, channels, blocks, joint;
|
uint8_t subbands, channels, blocks, joint, bitpool;
|
||||||
struct sbc_priv *priv;
|
struct sbc_priv *priv;
|
||||||
|
|
||||||
priv = sbc->priv;
|
priv = sbc->priv;
|
||||||
if (!priv->init) {
|
if (priv->init)
|
||||||
subbands = sbc->subbands ? 8 : 4;
|
return priv->frame.length;
|
||||||
blocks = 4 + (sbc->blocks * 4);
|
|
||||||
channels = sbc->mode == SBC_MODE_MONO ? 1 : 2;
|
subbands = sbc->subbands ? 8 : 4;
|
||||||
joint = sbc->mode == SBC_MODE_JOINT_STEREO ? 1 : 0;
|
blocks = 4 + (sbc->blocks * 4);
|
||||||
} else {
|
channels = sbc->mode == SBC_MODE_MONO ? 1 : 2;
|
||||||
subbands = priv->frame.subbands;
|
joint = sbc->mode == SBC_MODE_JOINT_STEREO ? 1 : 0;
|
||||||
blocks = priv->frame.blocks;
|
bitpool = sbc->bitpool;
|
||||||
channels = priv->frame.channels;
|
|
||||||
joint = priv->frame.joint;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = 4 + (4 * subbands * channels) / 8;
|
ret = 4 + (4 * subbands * channels) / 8;
|
||||||
|
|
||||||
/* This term is not always evenly divide so we round it up */
|
/* This term is not always evenly divide so we round it up */
|
||||||
if (channels == 1)
|
if (channels == 1)
|
||||||
ret += ((blocks * channels * sbc->bitpool) + 7) / 8;
|
ret += ((blocks * channels * bitpool) + 7) / 8;
|
||||||
else
|
else
|
||||||
ret += (((joint ? subbands : 0) + blocks * sbc->bitpool) + 7)
|
ret += (((joint ? subbands : 0) + blocks * bitpool) + 7) / 8;
|
||||||
/ 8;
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue