mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 13:50:40 +01:00
Delete unused Opus-specific methods of AudioCodingModule
Bug: None Change-Id: Ib191e4beadf85cd57e765bc52d305e274e50a473 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/148400 Reviewed-by: Minyue Li <minyue@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#28815}
This commit is contained in:
parent
45fd69d8df
commit
b90d38a978
3 changed files with 12 additions and 84 deletions
|
@ -118,14 +118,6 @@ class AudioCodingModuleImpl final : public AudioCodingModule {
|
||||||
|
|
||||||
int GetNetworkStatistics(NetworkStatistics* statistics) override;
|
int GetNetworkStatistics(NetworkStatistics* statistics) override;
|
||||||
|
|
||||||
// If current send codec is Opus, informs it about the maximum playback rate
|
|
||||||
// the receiver will render.
|
|
||||||
int SetOpusMaxPlaybackRate(int frequency_hz) override;
|
|
||||||
|
|
||||||
int EnableOpusDtx() override;
|
|
||||||
|
|
||||||
int DisableOpusDtx() override;
|
|
||||||
|
|
||||||
int EnableNack(size_t max_nack_list_size) override;
|
int EnableNack(size_t max_nack_list_size) override;
|
||||||
|
|
||||||
void DisableNack() override;
|
void DisableNack() override;
|
||||||
|
@ -710,32 +702,6 @@ int AudioCodingModuleImpl::RegisterVADCallback(ACMVADCallback* vad_callback) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Informs Opus encoder of the maximum playback rate the receiver will render.
|
|
||||||
int AudioCodingModuleImpl::SetOpusMaxPlaybackRate(int frequency_hz) {
|
|
||||||
rtc::CritScope lock(&acm_crit_sect_);
|
|
||||||
if (!HaveValidEncoder("SetOpusMaxPlaybackRate")) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
encoder_stack_->SetMaxPlaybackRate(frequency_hz);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int AudioCodingModuleImpl::EnableOpusDtx() {
|
|
||||||
rtc::CritScope lock(&acm_crit_sect_);
|
|
||||||
if (!HaveValidEncoder("EnableOpusDtx")) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return encoder_stack_->SetDtx(true) ? 0 : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int AudioCodingModuleImpl::DisableOpusDtx() {
|
|
||||||
rtc::CritScope lock(&acm_crit_sect_);
|
|
||||||
if (!HaveValidEncoder("DisableOpusDtx")) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return encoder_stack_->SetDtx(false) ? 0 : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
absl::optional<uint32_t> AudioCodingModuleImpl::PlayoutTimestamp() {
|
absl::optional<uint32_t> AudioCodingModuleImpl::PlayoutTimestamp() {
|
||||||
return receiver_.GetPlayoutTimestamp();
|
return receiver_.GetPlayoutTimestamp();
|
||||||
}
|
}
|
||||||
|
|
|
@ -322,47 +322,6 @@ class AudioCodingModule {
|
||||||
AudioFrame* audio_frame,
|
AudioFrame* audio_frame,
|
||||||
bool* muted) = 0;
|
bool* muted) = 0;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
// Codec specific
|
|
||||||
//
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
// int SetOpusMaxPlaybackRate()
|
|
||||||
// If current send codec is Opus, informs it about maximum playback rate the
|
|
||||||
// receiver will render. Opus can use this information to optimize the bit
|
|
||||||
// rate and increase the computation efficiency.
|
|
||||||
//
|
|
||||||
// Input:
|
|
||||||
// -frequency_hz : maximum playback rate in Hz.
|
|
||||||
//
|
|
||||||
// Return value:
|
|
||||||
// -1 if current send codec is not Opus or
|
|
||||||
// error occurred in setting the maximum playback rate,
|
|
||||||
// 0 if maximum bandwidth is set successfully.
|
|
||||||
//
|
|
||||||
virtual int SetOpusMaxPlaybackRate(int frequency_hz) = 0;
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
// EnableOpusDtx()
|
|
||||||
// Enable the DTX, if current send codec is Opus.
|
|
||||||
//
|
|
||||||
// Return value:
|
|
||||||
// -1 if current send codec is not Opus or error occurred in enabling the
|
|
||||||
// Opus DTX.
|
|
||||||
// 0 if Opus DTX is enabled successfully.
|
|
||||||
//
|
|
||||||
virtual int EnableOpusDtx() = 0;
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
// int DisableOpusDtx()
|
|
||||||
// If current send codec is Opus, disables its internal DTX.
|
|
||||||
//
|
|
||||||
// Return value:
|
|
||||||
// -1 if current send codec is not Opus or error occurred in disabling DTX.
|
|
||||||
// 0 if Opus DTX is disabled successfully.
|
|
||||||
//
|
|
||||||
virtual int DisableOpusDtx() = 0;
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// statistics
|
// statistics
|
||||||
//
|
//
|
||||||
|
|
|
@ -209,23 +209,22 @@ void TestWebRtcVadDtx::Test(bool new_outfile, bool expect_dtx_enabled) {
|
||||||
|
|
||||||
// Following is the implementation of TestOpusDtx.
|
// Following is the implementation of TestOpusDtx.
|
||||||
void TestOpusDtx::Perform() {
|
void TestOpusDtx::Perform() {
|
||||||
// If we set other codec than Opus, DTX cannot be switched on.
|
|
||||||
RegisterCodec({"ISAC", 16000, 1}, absl::nullopt);
|
|
||||||
EXPECT_EQ(-1, acm_send_->EnableOpusDtx());
|
|
||||||
EXPECT_EQ(0, acm_send_->DisableOpusDtx());
|
|
||||||
|
|
||||||
int expects[] = {0, 1, 0, 0, 0};
|
int expects[] = {0, 1, 0, 0, 0};
|
||||||
|
|
||||||
// Register Opus as send codec
|
// Register Opus as send codec
|
||||||
std::string out_filename =
|
std::string out_filename =
|
||||||
webrtc::test::OutputPath() + "testOpusDtx_outFile_mono.pcm";
|
webrtc::test::OutputPath() + "testOpusDtx_outFile_mono.pcm";
|
||||||
RegisterCodec({"opus", 48000, 2}, absl::nullopt);
|
RegisterCodec({"opus", 48000, 2}, absl::nullopt);
|
||||||
EXPECT_EQ(0, acm_send_->DisableOpusDtx());
|
acm_send_->ModifyEncoder([](std::unique_ptr<AudioEncoder>* encoder_ptr) {
|
||||||
|
(*encoder_ptr)->SetDtx(false);
|
||||||
|
});
|
||||||
|
|
||||||
Run(webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm"), 32000, 1,
|
Run(webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm"), 32000, 1,
|
||||||
out_filename, false, expects);
|
out_filename, false, expects);
|
||||||
|
|
||||||
EXPECT_EQ(0, acm_send_->EnableOpusDtx());
|
acm_send_->ModifyEncoder([](std::unique_ptr<AudioEncoder>* encoder_ptr) {
|
||||||
|
(*encoder_ptr)->SetDtx(true);
|
||||||
|
});
|
||||||
expects[static_cast<int>(AudioFrameType::kEmptyFrame)] = 1;
|
expects[static_cast<int>(AudioFrameType::kEmptyFrame)] = 1;
|
||||||
expects[static_cast<int>(AudioFrameType::kAudioFrameCN)] = 1;
|
expects[static_cast<int>(AudioFrameType::kAudioFrameCN)] = 1;
|
||||||
Run(webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm"), 32000, 1,
|
Run(webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm"), 32000, 1,
|
||||||
|
@ -234,13 +233,17 @@ void TestOpusDtx::Perform() {
|
||||||
// Register stereo Opus as send codec
|
// Register stereo Opus as send codec
|
||||||
out_filename = webrtc::test::OutputPath() + "testOpusDtx_outFile_stereo.pcm";
|
out_filename = webrtc::test::OutputPath() + "testOpusDtx_outFile_stereo.pcm";
|
||||||
RegisterCodec({"opus", 48000, 2, {{"stereo", "1"}}}, absl::nullopt);
|
RegisterCodec({"opus", 48000, 2, {{"stereo", "1"}}}, absl::nullopt);
|
||||||
EXPECT_EQ(0, acm_send_->DisableOpusDtx());
|
acm_send_->ModifyEncoder([](std::unique_ptr<AudioEncoder>* encoder_ptr) {
|
||||||
|
(*encoder_ptr)->SetDtx(false);
|
||||||
|
});
|
||||||
expects[static_cast<int>(AudioFrameType::kEmptyFrame)] = 0;
|
expects[static_cast<int>(AudioFrameType::kEmptyFrame)] = 0;
|
||||||
expects[static_cast<int>(AudioFrameType::kAudioFrameCN)] = 0;
|
expects[static_cast<int>(AudioFrameType::kAudioFrameCN)] = 0;
|
||||||
Run(webrtc::test::ResourcePath("audio_coding/teststereo32kHz", "pcm"), 32000,
|
Run(webrtc::test::ResourcePath("audio_coding/teststereo32kHz", "pcm"), 32000,
|
||||||
2, out_filename, false, expects);
|
2, out_filename, false, expects);
|
||||||
|
|
||||||
EXPECT_EQ(0, acm_send_->EnableOpusDtx());
|
acm_send_->ModifyEncoder([](std::unique_ptr<AudioEncoder>* encoder_ptr) {
|
||||||
|
(*encoder_ptr)->SetDtx(true);
|
||||||
|
});
|
||||||
|
|
||||||
expects[static_cast<int>(AudioFrameType::kEmptyFrame)] = 1;
|
expects[static_cast<int>(AudioFrameType::kEmptyFrame)] = 1;
|
||||||
expects[static_cast<int>(AudioFrameType::kAudioFrameCN)] = 1;
|
expects[static_cast<int>(AudioFrameType::kAudioFrameCN)] = 1;
|
||||||
|
|
Loading…
Reference in a new issue