From 1f7f530ce8267b2bafbe3fd8e9558dbddbafdd81 Mon Sep 17 00:00:00 2001 From: Davide Beatrici Date: Sat, 2 Mar 2024 03:25:23 +0100 Subject: [PATCH] Opus: Correct function naming https://github.com/xiph/opus/issues/315 --- include/mumble/Opus.hpp | 8 ++++---- src/Opus.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/mumble/Opus.hpp b/include/mumble/Opus.hpp index 5f06d12..a8cdfd3 100644 --- a/include/mumble/Opus.hpp +++ b/include/mumble/Opus.hpp @@ -34,9 +34,9 @@ class MUMBLE_EXPORT Opus : NonCopyable { virtual bool togglePhaseInversion(const bool enable) = 0; static uint8_t packetChannels(const BufViewConst packet); - static uint32_t packetFrames(const BufViewConst packet); - static uint32_t packetSamples(const BufViewConst packet, const uint32_t sampleRate); - static uint32_t packetSamplesPerFrame(const BufViewConst packet, const uint32_t sampleRate); + static uint32_t packetEncodedFrames(const BufViewConst packet); + static uint32_t packetFrames(const BufViewConst packet, const uint32_t sampleRate); + static uint32_t packetFramesPerEncodedFrame(const BufViewConst packet, const uint32_t sampleRate); }; class MUMBLE_EXPORT Opus::Decoder : public Opus { @@ -63,7 +63,7 @@ class MUMBLE_EXPORT Opus::Decoder : public Opus { virtual bool usesPhaseInversion() const override; virtual bool togglePhaseInversion(const bool enable) override; - virtual uint32_t packetSamples(const BufViewConst packet); + virtual uint32_t packetFrames(const BufViewConst packet); private: std::unique_ptr< P > m_p; diff --git a/src/Opus.cpp b/src/Opus.cpp index 6f1dc78..249e67c 100644 --- a/src/Opus.cpp +++ b/src/Opus.cpp @@ -61,18 +61,18 @@ uint8_t Opus::packetChannels(const BufViewConst packet) { return ret >= 0 ? static_cast< uint8_t >(ret) : 0; } -uint32_t Opus::packetFrames(const BufViewConst packet) { +uint32_t Opus::packetEncodedFrames(const BufViewConst packet) { const int ret = opus_packet_get_nb_frames(CAST_BUF_CONST(packet.data()), CAST_SIZE(packet.size())); return ret >= 0 ? static_cast< uint32_t >(ret) : 0; } -uint32_t Opus::packetSamples(const BufViewConst packet, const uint32_t sampleRate) { +uint32_t Opus::packetFrames(const BufViewConst packet, const uint32_t sampleRate) { const int ret = opus_packet_get_nb_samples(CAST_BUF_CONST(packet.data()), CAST_SIZE(packet.size()), static_cast< int32_t >(sampleRate)); return ret >= 0 ? static_cast< uint32_t >(ret) : 0; } -uint32_t Opus::packetSamplesPerFrame(const BufViewConst packet, const uint32_t sampleRate) { +uint32_t Opus::packetFramesPerEncodedFrame(const BufViewConst packet, const uint32_t sampleRate) { const int ret = opus_packet_get_samples_per_frame(CAST_BUF_CONST(packet.data()), static_cast< int32_t >(sampleRate)); return ret >= 0 ? static_cast< uint32_t >(ret) : 0; @@ -147,7 +147,7 @@ bool Decoder::togglePhaseInversion(const bool enable) { return m_p->set(OPUS_SET_PHASE_INVERSION_DISABLED(!enable)); } -uint32_t Decoder::packetSamples(const BufViewConst packet) { +uint32_t Decoder::packetFrames(const BufViewConst packet) { const int ret = opus_decoder_get_nb_samples(m_p->m_ctx.get(), CAST_BUF_CONST(packet.data()), CAST_SIZE(packet.size())); return ret >= 0 ? static_cast< uint32_t >(ret) : 0;