Delete some unused AudioCodingModule methods
Methods deleted: ReceiveFrequency, PlayoutFrequency, ReceiveCodec, SetMinimumPlayoutDelay, SetMaximumPlayoutDelay, SetBaseMinimumPlayoutDelayMs, GetBaseMinimumPlayoutDelayMs, PlayoutTimestamp, FilteredCurrentDelayMs, TargetDelayMs. Became unused with cl https://webrtc-review.googlesource.com/c/src/+/111504 Bug: None Change-Id: Ie50e8e86a622661c3daa9db83a2e66489dcd2d98 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/148071 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#28918}
This commit is contained in:
@ -74,38 +74,13 @@ class AudioCodingModuleImpl final : public AudioCodingModule {
|
||||
// Initialize receiver, resets codec database etc.
|
||||
int InitializeReceiver() override;
|
||||
|
||||
// Get current receive frequency.
|
||||
int ReceiveFrequency() const override;
|
||||
|
||||
// Get current playout frequency.
|
||||
int PlayoutFrequency() const override;
|
||||
|
||||
void SetReceiveCodecs(const std::map<int, SdpAudioFormat>& codecs) override;
|
||||
|
||||
// Get current received codec.
|
||||
absl::optional<std::pair<int, SdpAudioFormat>> ReceiveCodec() const override;
|
||||
|
||||
// Incoming packet from network parsed and ready for decode.
|
||||
int IncomingPacket(const uint8_t* incoming_payload,
|
||||
const size_t payload_length,
|
||||
const RTPHeader& rtp_info) override;
|
||||
|
||||
// Minimum playout delay.
|
||||
int SetMinimumPlayoutDelay(int time_ms) override;
|
||||
|
||||
// Maximum playout delay.
|
||||
int SetMaximumPlayoutDelay(int time_ms) override;
|
||||
|
||||
bool SetBaseMinimumPlayoutDelayMs(int delay_ms) override;
|
||||
|
||||
int GetBaseMinimumPlayoutDelayMs() const override;
|
||||
|
||||
absl::optional<uint32_t> PlayoutTimestamp() override;
|
||||
|
||||
int FilteredCurrentDelayMs() const override;
|
||||
|
||||
int TargetDelayMs() const override;
|
||||
|
||||
// Get 10 milliseconds of raw audio data to play out, and
|
||||
// automatic resample to the requested frequency if > 0.
|
||||
int PlayoutData10Ms(int desired_freq_hz,
|
||||
@ -605,30 +580,12 @@ int AudioCodingModuleImpl::InitializeReceiverSafe() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Get current receive frequency.
|
||||
int AudioCodingModuleImpl::ReceiveFrequency() const {
|
||||
const auto last_packet_sample_rate = receiver_.last_packet_sample_rate_hz();
|
||||
return last_packet_sample_rate ? *last_packet_sample_rate
|
||||
: receiver_.last_output_sample_rate_hz();
|
||||
}
|
||||
|
||||
// Get current playout frequency.
|
||||
int AudioCodingModuleImpl::PlayoutFrequency() const {
|
||||
return receiver_.last_output_sample_rate_hz();
|
||||
}
|
||||
|
||||
void AudioCodingModuleImpl::SetReceiveCodecs(
|
||||
const std::map<int, SdpAudioFormat>& codecs) {
|
||||
rtc::CritScope lock(&acm_crit_sect_);
|
||||
receiver_.SetCodecs(codecs);
|
||||
}
|
||||
|
||||
absl::optional<std::pair<int, SdpAudioFormat>>
|
||||
AudioCodingModuleImpl::ReceiveCodec() const {
|
||||
rtc::CritScope lock(&acm_crit_sect_);
|
||||
return receiver_.LastDecoder();
|
||||
}
|
||||
|
||||
// Incoming packet from network parsed and ready for decode.
|
||||
int AudioCodingModuleImpl::IncomingPacket(const uint8_t* incoming_payload,
|
||||
const size_t payload_length,
|
||||
@ -639,32 +596,6 @@ int AudioCodingModuleImpl::IncomingPacket(const uint8_t* incoming_payload,
|
||||
rtc::ArrayView<const uint8_t>(incoming_payload, payload_length));
|
||||
}
|
||||
|
||||
// Minimum playout delay (Used for lip-sync).
|
||||
int AudioCodingModuleImpl::SetMinimumPlayoutDelay(int time_ms) {
|
||||
if ((time_ms < 0) || (time_ms > 10000)) {
|
||||
RTC_LOG(LS_ERROR) << "Delay must be in the range of 0-10000 milliseconds.";
|
||||
return -1;
|
||||
}
|
||||
return receiver_.SetMinimumDelay(time_ms);
|
||||
}
|
||||
|
||||
int AudioCodingModuleImpl::SetMaximumPlayoutDelay(int time_ms) {
|
||||
if ((time_ms < 0) || (time_ms > 10000)) {
|
||||
RTC_LOG(LS_ERROR) << "Delay must be in the range of 0-10000 milliseconds.";
|
||||
return -1;
|
||||
}
|
||||
return receiver_.SetMaximumDelay(time_ms);
|
||||
}
|
||||
|
||||
bool AudioCodingModuleImpl::SetBaseMinimumPlayoutDelayMs(int delay_ms) {
|
||||
// All necessary validation happens on NetEq level.
|
||||
return receiver_.SetBaseMinimumDelayMs(delay_ms);
|
||||
}
|
||||
|
||||
int AudioCodingModuleImpl::GetBaseMinimumPlayoutDelayMs() const {
|
||||
return receiver_.GetBaseMinimumDelayMs();
|
||||
}
|
||||
|
||||
// Get 10 milliseconds of raw audio data to play out.
|
||||
// Automatic resample to the requested frequency.
|
||||
int AudioCodingModuleImpl::PlayoutData10Ms(int desired_freq_hz,
|
||||
@ -696,18 +627,6 @@ int AudioCodingModuleImpl::RegisterVADCallback(ACMVADCallback* vad_callback) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
absl::optional<uint32_t> AudioCodingModuleImpl::PlayoutTimestamp() {
|
||||
return receiver_.GetPlayoutTimestamp();
|
||||
}
|
||||
|
||||
int AudioCodingModuleImpl::FilteredCurrentDelayMs() const {
|
||||
return receiver_.FilteredCurrentDelayMs();
|
||||
}
|
||||
|
||||
int AudioCodingModuleImpl::TargetDelayMs() const {
|
||||
return receiver_.TargetDelayMs();
|
||||
}
|
||||
|
||||
bool AudioCodingModuleImpl::HaveValidEncoder(const char* caller_name) const {
|
||||
if (!encoder_stack_) {
|
||||
RTC_LOG(LS_ERROR) << caller_name << " failed: No send codec is registered.";
|
||||
|
@ -185,41 +185,10 @@ class AudioCodingModule {
|
||||
//
|
||||
virtual int32_t InitializeReceiver() = 0;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// int32_t ReceiveFrequency()
|
||||
// Get sampling frequency of the last received payload.
|
||||
//
|
||||
// Return value:
|
||||
// non-negative the sampling frequency in Hertz.
|
||||
// -1 if an error has occurred.
|
||||
//
|
||||
virtual int32_t ReceiveFrequency() const = 0;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// int32_t PlayoutFrequency()
|
||||
// Get sampling frequency of audio played out.
|
||||
//
|
||||
// Return value:
|
||||
// the sampling frequency in Hertz.
|
||||
//
|
||||
virtual int32_t PlayoutFrequency() const = 0;
|
||||
|
||||
// Replace any existing decoders with the given payload type -> decoder map.
|
||||
virtual void SetReceiveCodecs(
|
||||
const std::map<int, SdpAudioFormat>& codecs) = 0;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// absl::optional<std::pair<int, SdpAudioFormat>> ReceiveCodec()
|
||||
// Get the codec info associated with last received payload.
|
||||
//
|
||||
// Return value:
|
||||
// A payload type and SdpAudioFormat describing the format associated with
|
||||
// the last received payload.
|
||||
// An empty Optional if no payload has yet been received.
|
||||
//
|
||||
virtual absl::optional<std::pair<int, SdpAudioFormat>> ReceiveCodec()
|
||||
const = 0;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// int32_t IncomingPacket()
|
||||
// Call this function to insert a parsed RTP packet into ACM.
|
||||
@ -238,66 +207,6 @@ class AudioCodingModule {
|
||||
const size_t payload_len_bytes,
|
||||
const RTPHeader& rtp_header) = 0;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// int SetMinimumPlayoutDelay()
|
||||
// Set a minimum for the playout delay, used for lip-sync. NetEq maintains
|
||||
// such a delay unless channel condition yields to a higher delay.
|
||||
//
|
||||
// Input:
|
||||
// -time_ms : minimum delay in milliseconds.
|
||||
//
|
||||
// Return value:
|
||||
// -1 if failed to set the delay,
|
||||
// 0 if the minimum delay is set.
|
||||
//
|
||||
virtual int SetMinimumPlayoutDelay(int time_ms) = 0;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// int SetMaximumPlayoutDelay()
|
||||
// Set a maximum for the playout delay
|
||||
//
|
||||
// Input:
|
||||
// -time_ms : maximum delay in milliseconds.
|
||||
//
|
||||
// Return value:
|
||||
// -1 if failed to set the delay,
|
||||
// 0 if the maximum delay is set.
|
||||
//
|
||||
virtual int SetMaximumPlayoutDelay(int time_ms) = 0;
|
||||
|
||||
// Sets a base minimum for the playout delay. Base minimum delay sets lower
|
||||
// bound minimum delay value which is set via SetMinimumPlayoutDelay.
|
||||
//
|
||||
// Returns true if value was successfully set, false overwise.
|
||||
virtual bool SetBaseMinimumPlayoutDelayMs(int delay_ms) = 0;
|
||||
|
||||
// Returns current value of base minimum delay in milliseconds.
|
||||
virtual int GetBaseMinimumPlayoutDelayMs() const = 0;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// int32_t PlayoutTimestamp()
|
||||
// The send timestamp of an RTP packet is associated with the decoded
|
||||
// audio of the packet in question. This function returns the timestamp of
|
||||
// the latest audio obtained by calling PlayoutData10ms(), or empty if no
|
||||
// valid timestamp is available.
|
||||
//
|
||||
virtual absl::optional<uint32_t> PlayoutTimestamp() = 0;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// int FilteredCurrentDelayMs()
|
||||
// Returns the current total delay from NetEq (packet buffer and sync buffer)
|
||||
// in ms, with smoothing applied to even out short-time fluctuations due to
|
||||
// jitter. The packet buffer part of the delay is not updated during DTX/CNG
|
||||
// periods.
|
||||
//
|
||||
virtual int FilteredCurrentDelayMs() const = 0;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// int FilteredCurrentDelayMs()
|
||||
// Returns the current target delay for NetEq in ms.
|
||||
//
|
||||
virtual int TargetDelayMs() const = 0;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// int32_t PlayoutData10Ms(
|
||||
// Get 10 milliseconds of raw audio data for playout, at the given sampling
|
||||
|
@ -186,9 +186,6 @@ void ISACTest::Setup() {
|
||||
Run10ms();
|
||||
}
|
||||
|
||||
EXPECT_TRUE(_acmA->ReceiveCodec());
|
||||
EXPECT_TRUE(_acmB->ReceiveCodec());
|
||||
|
||||
_inFileA.Close();
|
||||
_outFileA.Close();
|
||||
_outFileB.Close();
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include "api/audio/audio_frame.h"
|
||||
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
||||
#include "modules/audio_coding/acm2/acm_receiver.h"
|
||||
#include "modules/audio_coding/codecs/pcm16b/pcm16b.h"
|
||||
#include "modules/audio_coding/include/audio_coding_module.h"
|
||||
#include "modules/include/module_common_types.h"
|
||||
@ -23,19 +24,16 @@ namespace webrtc {
|
||||
class TargetDelayTest : public ::testing::Test {
|
||||
protected:
|
||||
TargetDelayTest()
|
||||
: acm_(AudioCodingModule::Create(
|
||||
AudioCodingModule::Config(CreateBuiltinAudioDecoderFactory()))) {}
|
||||
: receiver_(
|
||||
AudioCodingModule::Config(CreateBuiltinAudioDecoderFactory())) {}
|
||||
|
||||
~TargetDelayTest() {}
|
||||
|
||||
void SetUp() {
|
||||
EXPECT_TRUE(acm_.get() != NULL);
|
||||
|
||||
ASSERT_EQ(0, acm_->InitializeReceiver());
|
||||
constexpr int pltype = 108;
|
||||
std::map<int, SdpAudioFormat> receive_codecs = {
|
||||
{pltype, {"L16", kSampleRateHz, 1}}};
|
||||
acm_->SetReceiveCodecs(receive_codecs);
|
||||
receiver_.SetCodecs(receive_codecs);
|
||||
|
||||
rtp_header_.payloadType = pltype;
|
||||
rtp_header_.timestamp = 0;
|
||||
@ -99,8 +97,9 @@ class TargetDelayTest : public ::testing::Test {
|
||||
void Push() {
|
||||
rtp_header_.timestamp += kFrameSizeSamples;
|
||||
rtp_header_.sequenceNumber++;
|
||||
ASSERT_EQ(
|
||||
0, acm_->IncomingPacket(payload_, kFrameSizeSamples * 2, rtp_header_));
|
||||
ASSERT_EQ(0, receiver_.InsertPacket(rtp_header_,
|
||||
rtc::ArrayView<const uint8_t>(
|
||||
payload_, kFrameSizeSamples * 2)));
|
||||
}
|
||||
|
||||
// Pull audio equivalent to the amount of audio in one RTP packet.
|
||||
@ -108,7 +107,7 @@ class TargetDelayTest : public ::testing::Test {
|
||||
AudioFrame frame;
|
||||
bool muted;
|
||||
for (int k = 0; k < kNum10msPerFrame; ++k) { // Pull one frame.
|
||||
ASSERT_EQ(0, acm_->PlayoutData10Ms(-1, &frame, &muted));
|
||||
ASSERT_EQ(0, receiver_.GetAudio(-1, &frame, &muted));
|
||||
ASSERT_FALSE(muted);
|
||||
// Had to use ASSERT_TRUE, ASSERT_EQ generated error.
|
||||
ASSERT_TRUE(kSampleRateHz == frame.sample_rate_hz_);
|
||||
@ -135,20 +134,20 @@ class TargetDelayTest : public ::testing::Test {
|
||||
}
|
||||
|
||||
int SetMinimumDelay(int delay_ms) {
|
||||
return acm_->SetMinimumPlayoutDelay(delay_ms);
|
||||
return receiver_.SetMinimumDelay(delay_ms);
|
||||
}
|
||||
|
||||
int SetMaximumDelay(int delay_ms) {
|
||||
return acm_->SetMaximumPlayoutDelay(delay_ms);
|
||||
return receiver_.SetMaximumDelay(delay_ms);
|
||||
}
|
||||
|
||||
int GetCurrentOptimalDelayMs() {
|
||||
NetworkStatistics stats;
|
||||
acm_->GetNetworkStatistics(&stats);
|
||||
receiver_.GetNetworkStatistics(&stats);
|
||||
return stats.preferredBufferSize;
|
||||
}
|
||||
|
||||
std::unique_ptr<AudioCodingModule> acm_;
|
||||
acm2::AcmReceiver receiver_;
|
||||
RTPHeader rtp_header_;
|
||||
uint8_t payload_[kPayloadLenBytes];
|
||||
};
|
||||
|
Reference in New Issue
Block a user