diff --git a/rpcs3/Emu/SysCalls/Modules/cellAdec.cpp b/rpcs3/Emu/SysCalls/Modules/cellAdec.cpp index fec5d753be..d8e9ac18f7 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellAdec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellAdec.cpp @@ -690,7 +690,12 @@ int cellAdecGetPcm(u32 handle, u32 outBuffer_addr) if (!Memory.IsGoodAddr(outBuffer_addr, af.size)) { result = CELL_ADEC_ERROR_FATAL; - goto end; + if (af.data) + { + av_frame_unref(af.data); + av_frame_free(&af.data); + } + return result; } if (!af.data) // fake: empty data @@ -699,13 +704,10 @@ int cellAdecGetPcm(u32 handle, u32 outBuffer_addr) memset(buf, 0, 4096); Memory.CopyFromReal(outBuffer_addr, buf, 4096); free(buf);*/ - goto end; + return result; } // copy data SwrContext* swr = nullptr; - u8* out = nullptr; - - out = (u8*)malloc(af.size); /*swr = swr_alloc_set_opts(NULL, AV_CH_LAYOUT_STEREO, AV_SAMPLE_FMT_FLT, 48000, frame->channel_layout, (AVSampleFormat)frame->format, frame->sample_rate, 0, NULL); @@ -714,10 +716,17 @@ int cellAdecGetPcm(u32 handle, u32 outBuffer_addr) { ConLog.Error("cellAdecGetPcm(%d): swr_alloc_set_opts() failed", handle); Emu.Pause(); - goto end; - } + free(out); + if (af.data) + { + av_frame_unref(af.data); + av_frame_free(&af.data); + } + return result; + }*/ + u8* out = (u8*)malloc(af.size); // something is wrong - swr_convert(swr, &out, frame->nb_samples, (const u8**)frame->extended_data, frame->nb_samples); */ + //swr_convert(swr, &out, frame->nb_samples, (const u8**)frame->extended_data, frame->nb_samples); // reverse byte order, extract data: float* in_f[2]; @@ -736,8 +745,7 @@ int cellAdecGetPcm(u32 handle, u32 outBuffer_addr) Emu.Pause(); } -end: - if (out) free(out); + free(out); if (swr) swr_free(&swr); if (af.data) @@ -815,4 +823,4 @@ void cellAdec_init() av_register_all(); avcodec_register_all(); -} \ No newline at end of file +}