From 44f39bfb68ad727cc13ca9bef6b01748c43e68c6 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 29 Jan 2019 17:40:27 -0500 Subject: hwopus: Replace std::optional> with u64* This doesn't really offer anything over the use of a direct pointer, so we can just use that instead. --- src/core/hle/service/audio/hwopus.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/core/hle') diff --git a/src/core/hle/service/audio/hwopus.cpp b/src/core/hle/service/audio/hwopus.cpp index 67aa9f6ad..b70c831d2 100644 --- a/src/core/hle/service/audio/hwopus.cpp +++ b/src/core/hle/service/audio/hwopus.cpp @@ -5,7 +5,6 @@ #include #include #include -#include #include #include @@ -53,7 +52,7 @@ private: u32 consumed = 0; u32 sample_count = 0; std::vector samples(ctx.GetWriteBufferSize() / sizeof(opus_int16)); - if (!Decoder_DecodeInterleaved(consumed, sample_count, ctx.ReadBuffer(), samples)) { + if (!Decoder_DecodeInterleaved(consumed, sample_count, ctx.ReadBuffer(), samples, nullptr)) { LOG_ERROR(Audio, "Failed to decode opus data"); IPC::ResponseBuilder rb{ctx, 2}; // TODO(ogniK): Use correct error code @@ -75,7 +74,7 @@ private: u64 performance = 0; std::vector samples(ctx.GetWriteBufferSize() / sizeof(opus_int16)); if (!Decoder_DecodeInterleaved(consumed, sample_count, ctx.ReadBuffer(), samples, - performance)) { + &performance)) { LOG_ERROR(Audio, "Failed to decode opus data"); IPC::ResponseBuilder rb{ctx, 2}; // TODO(ogniK): Use correct error code @@ -90,10 +89,8 @@ private: ctx.WriteBuffer(samples.data(), samples.size() * sizeof(s16)); } - bool Decoder_DecodeInterleaved( - u32& consumed, u32& sample_count, const std::vector& input, - std::vector& output, - std::optional> performance_time = std::nullopt) { + bool Decoder_DecodeInterleaved(u32& consumed, u32& sample_count, const std::vector& input, + std::vector& output, u64* out_performance_time) { const auto start_time = std::chrono::high_resolution_clock::now(); const std::size_t raw_output_sz = output.size() * sizeof(opus_int16); if (sizeof(OpusHeader) > input.size()) { @@ -136,8 +133,8 @@ private: const auto end_time = std::chrono::high_resolution_clock::now() - start_time; sample_count = out_sample_count; consumed = static_cast(sizeof(OpusHeader) + hdr.sz); - if (performance_time.has_value()) { - performance_time->get() = + if (out_performance_time != nullptr) { + *out_performance_time = std::chrono::duration_cast(end_time).count(); } -- cgit v1.2.3