summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/audio/hwopus.cpp
diff options
context:
space:
mode:
authorKelebek1 <eeeedddccc@hotmail.co.uk>2023-05-23 15:45:54 +0200
committerKelebek1 <eeeedddccc@hotmail.co.uk>2023-06-22 09:05:10 +0200
commit5da70f719703084482933e103e561cc98163f370 (patch)
tree1926842ed2b90bf92b89cec6a314bb28c7287fe9 /src/core/hle/service/audio/hwopus.cpp
parentMerge pull request #10086 from Morph1984/coretiming-ng-1 (diff)
downloadyuzu-5da70f719703084482933e103e561cc98163f370.tar
yuzu-5da70f719703084482933e103e561cc98163f370.tar.gz
yuzu-5da70f719703084482933e103e561cc98163f370.tar.bz2
yuzu-5da70f719703084482933e103e561cc98163f370.tar.lz
yuzu-5da70f719703084482933e103e561cc98163f370.tar.xz
yuzu-5da70f719703084482933e103e561cc98163f370.tar.zst
yuzu-5da70f719703084482933e103e561cc98163f370.zip
Diffstat (limited to 'src/core/hle/service/audio/hwopus.cpp')
-rw-r--r--src/core/hle/service/audio/hwopus.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/core/hle/service/audio/hwopus.cpp b/src/core/hle/service/audio/hwopus.cpp
index 451ac224a..c835f6cb7 100644
--- a/src/core/hle/service/audio/hwopus.cpp
+++ b/src/core/hle/service/audio/hwopus.cpp
@@ -68,13 +68,13 @@ private:
ExtraBehavior extra_behavior) {
u32 consumed = 0;
u32 sample_count = 0;
- std::vector<opus_int16> samples(ctx.GetWriteBufferNumElements<opus_int16>());
+ tmp_samples.resize_destructive(ctx.GetWriteBufferNumElements<opus_int16>());
if (extra_behavior == ExtraBehavior::ResetContext) {
ResetDecoderContext();
}
- if (!DecodeOpusData(consumed, sample_count, ctx.ReadBuffer(), samples, performance)) {
+ if (!DecodeOpusData(consumed, sample_count, ctx.ReadBuffer(), tmp_samples, performance)) {
LOG_ERROR(Audio, "Failed to decode opus data");
IPC::ResponseBuilder rb{ctx, 2};
// TODO(ogniK): Use correct error code
@@ -90,11 +90,11 @@ private:
if (performance) {
rb.Push<u64>(*performance);
}
- ctx.WriteBuffer(samples);
+ ctx.WriteBuffer(tmp_samples);
}
bool DecodeOpusData(u32& consumed, u32& sample_count, std::span<const u8> input,
- std::vector<opus_int16>& output, u64* out_performance_time) const {
+ std::span<opus_int16> output, u64* out_performance_time) const {
const auto start_time = std::chrono::steady_clock::now();
const std::size_t raw_output_sz = output.size() * sizeof(opus_int16);
if (sizeof(OpusPacketHeader) > input.size()) {
@@ -154,6 +154,7 @@ private:
OpusDecoderPtr decoder;
u32 sample_rate;
u32 channel_count;
+ Common::ScratchBuffer<opus_int16> tmp_samples;
};
class IHardwareOpusDecoderManager final : public ServiceFramework<IHardwareOpusDecoderManager> {