Skip to content

Commit

Permalink
Opus: Correct function naming
Browse files Browse the repository at this point in the history
  • Loading branch information
davidebeatrici committed Mar 3, 2024
1 parent 0031b81 commit 1f7f530
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions include/mumble/Opus.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/Opus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 1f7f530

Please sign in to comment.