Skip to content

Commit

Permalink
Ensure channel layouts are cleaned up
Browse files Browse the repository at this point in the history
  • Loading branch information
Nevcairiel committed Aug 23, 2022
1 parent 9c30b15 commit f3d1c56
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion decoder/LAVAudio/PostProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,9 +585,11 @@ HRESULT CLAVAudio::PerformAVRProcessing(BufferDetails *buffer)
if (!m_swrContext)
{
DbgLog((LOG_ERROR, 10, L"swresample context missing?"));
return E_FAIL;
goto setuperr;
}

av_channel_layout_uninit(&chMixingLayout);

LAVAudioSampleFormat bufferFormat =
(m_sfRemixFormat == SampleFormat_24) ? SampleFormat_32 : m_sfRemixFormat; // avresample always outputs 32-bit

Expand Down Expand Up @@ -616,6 +618,7 @@ HRESULT CLAVAudio::PerformAVRProcessing(BufferDetails *buffer)
setuperr:
swr_free(&m_swrContext);
m_bAVResampleFailed = TRUE;
av_channel_layout_uninit(&chMixingLayout);
return E_FAIL;
}

Expand Down Expand Up @@ -755,5 +758,6 @@ HRESULT CLAVAudio::PostProcess(BufferDetails *buffer)
Truncate32Buffer(buffer);
}

av_channel_layout_uninit(&chMixingLayout);
return S_OK;
}

0 comments on commit f3d1c56

Please sign in to comment.