decoder/opus: allocate buffer only in the first chained song
Fixes memory leak. That's what we get for
This commit is contained in:
parent
5ca137c73c
commit
46eab05045
1
NEWS
1
NEWS
@ -6,6 +6,7 @@ ver 0.21.25 (not yet released)
|
|||||||
- smbclient: don't send credentials to MPD clients
|
- smbclient: don't send credentials to MPD clients
|
||||||
* decoder
|
* decoder
|
||||||
- opus: apply pre-skip
|
- opus: apply pre-skip
|
||||||
|
- opus: fix memory leak
|
||||||
* output
|
* output
|
||||||
- osx: improve sample rate selection
|
- osx: improve sample rate selection
|
||||||
* Windows/Android:
|
* Windows/Android:
|
||||||
|
@ -192,8 +192,12 @@ MPDOpusDecoder::OnOggBeginning(const ogg_packet &packet)
|
|||||||
client.Ready(audio_format, eos_granulepos > 0, duration);
|
client.Ready(audio_format, eos_granulepos > 0, duration);
|
||||||
frame_size = audio_format.GetFrameSize();
|
frame_size = audio_format.GetFrameSize();
|
||||||
|
|
||||||
output_buffer = new opus_int16[opus_output_buffer_frames
|
if (output_buffer == nullptr)
|
||||||
* audio_format.channels];
|
/* note: if we ever support changing the channel count
|
||||||
|
in chained streams, we need to reallocate this
|
||||||
|
buffer instead of keeping it */
|
||||||
|
output_buffer = new opus_int16[opus_output_buffer_frames
|
||||||
|
* audio_format.channels];
|
||||||
|
|
||||||
auto cmd = client.GetCommand();
|
auto cmd = client.GetCommand();
|
||||||
if (cmd != DecoderCommand::NONE)
|
if (cmd != DecoderCommand::NONE)
|
||||||
|
Loading…
Reference in New Issue
Block a user