From be1954e04cb5a0c3a526f78ed5490a5e65310280 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 15 Oct 2020 14:49:45 -0400 Subject: core: Fix clang build Recent changes to the build system that made more warnings be flagged as errors caused building via clang to break. Fixes #4795 --- src/core/hle/service/audio/audout_u.cpp | 7 ++++--- src/core/hle/service/audio/hwopus.cpp | 29 +++++++++++++++-------------- 2 files changed, 19 insertions(+), 17 deletions(-) (limited to 'src/core/hle/service/audio') diff --git a/src/core/hle/service/audio/audout_u.cpp b/src/core/hle/service/audio/audout_u.cpp index 9b4910e53..a345a68e6 100644 --- a/src/core/hle/service/audio/audout_u.cpp +++ b/src/core/hle/service/audio/audout_u.cpp @@ -69,9 +69,10 @@ public: buffer_event = Kernel::WritableEvent::CreateEventPair(system.Kernel(), "IAudioOutBufferReleased"); - stream = audio_core.OpenStream(system.CoreTiming(), audio_params.sample_rate, - audio_params.channel_count, std::move(unique_name), - [this] { buffer_event.writable->Signal(); }); + stream = + audio_core.OpenStream(system.CoreTiming(), static_cast(audio_params.sample_rate), + audio_params.channel_count, std::move(unique_name), + [this] { buffer_event.writable->Signal(); }); } private: diff --git a/src/core/hle/service/audio/hwopus.cpp b/src/core/hle/service/audio/hwopus.cpp index f1d81602c..16a6deb7e 100644 --- a/src/core/hle/service/audio/hwopus.cpp +++ b/src/core/hle/service/audio/hwopus.cpp @@ -50,8 +50,8 @@ public: Enabled, }; - explicit OpusDecoderState(OpusDecoderPtr decoder, u32 sample_rate, u32 channel_count) - : decoder{std::move(decoder)}, sample_rate{sample_rate}, channel_count{channel_count} {} + explicit OpusDecoderState(OpusDecoderPtr decoder_, s32 sample_rate_, u32 channel_count_) + : decoder{std::move(decoder_)}, sample_rate{sample_rate_}, channel_count{channel_count_} {} // Decodes interleaved Opus packets. Optionally allows reporting time taken to // perform the decoding, as well as any relevant extra behavior. @@ -113,15 +113,16 @@ private: return false; } - const auto frame = input.data() + sizeof(OpusPacketHeader); + const auto* const frame = input.data() + sizeof(OpusPacketHeader); const auto decoded_sample_count = opus_packet_get_nb_samples( - frame, static_cast(input.size() - sizeof(OpusPacketHeader)), - static_cast(sample_rate)); - if (decoded_sample_count * channel_count * sizeof(u16) > raw_output_sz) { + frame, static_cast(input.size() - sizeof(OpusPacketHeader)), sample_rate); + const auto decoded_size = + static_cast(decoded_sample_count) * channel_count * sizeof(u16); + if (decoded_size > raw_output_sz) { LOG_ERROR( Audio, "Decoded data does not fit into the output data, decoded_sz={}, raw_output_sz={}", - decoded_sample_count * channel_count * sizeof(u16), raw_output_sz); + decoded_size, raw_output_sz); return false; } @@ -137,11 +138,11 @@ private: } const auto end_time = std::chrono::high_resolution_clock::now() - start_time; - sample_count = out_sample_count; + sample_count = static_cast(out_sample_count); consumed = static_cast(sizeof(OpusPacketHeader) + hdr.size); if (out_performance_time != nullptr) { - *out_performance_time = - std::chrono::duration_cast(end_time).count(); + *out_performance_time = static_cast( + std::chrono::duration_cast(end_time).count()); } return true; @@ -154,7 +155,7 @@ private: } OpusDecoderPtr decoder; - u32 sample_rate; + s32 sample_rate; u32 channel_count; }; @@ -212,7 +213,7 @@ std::size_t WorkerBufferSize(u32 channel_count) { ASSERT_MSG(channel_count == 1 || channel_count == 2, "Invalid channel count"); constexpr int num_streams = 1; const int num_stereo_streams = channel_count == 2 ? 1 : 0; - return opus_multistream_decoder_get_size(num_streams, num_stereo_streams); + return static_cast(opus_multistream_decoder_get_size(num_streams, num_stereo_streams)); } // Creates the mapping table that maps the input channels to the particular @@ -244,7 +245,7 @@ void HwOpus::GetWorkBufferSize(Kernel::HLERequestContext& ctx) { "Invalid sample rate"); ASSERT_MSG(channel_count == 1 || channel_count == 2, "Invalid channel count"); - const u32 worker_buffer_sz = static_cast(WorkerBufferSize(channel_count)); + const auto worker_buffer_sz = static_cast(WorkerBufferSize(channel_count)); LOG_DEBUG(Audio, "worker_buffer_sz={}", worker_buffer_sz); IPC::ResponseBuilder rb{ctx, 3}; @@ -254,7 +255,7 @@ void HwOpus::GetWorkBufferSize(Kernel::HLERequestContext& ctx) { void HwOpus::OpenOpusDecoder(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; - const auto sample_rate = rp.Pop(); + const auto sample_rate = rp.Pop(); const auto channel_count = rp.Pop(); const auto buffer_sz = rp.Pop(); -- cgit v1.2.3