Change return type of AudioEncoder::SetMaxPlaybackRate to void

There's no point in returning a status code, since the max playback rate
is only a suggestion that the encoder is free to disregard.

Review URL: https://codereview.webrtc.org/1332573003

Cr-Commit-Position: refs/heads/master@{#9900}
This commit is contained in:
kwiberg
2015-09-08 23:15:33 -07:00
committed by Commit bot
parent e9e7896293
commit 3f5f1c2ad3
10 changed files with 14 additions and 18 deletions

View File

@ -46,9 +46,7 @@ bool AudioEncoder::SetApplication(Application application) {
return false;
}
bool AudioEncoder::SetMaxPlaybackRate(int frequency_hz) {
return true;
}
void AudioEncoder::SetMaxPlaybackRate(int frequency_hz) {}
void AudioEncoder::SetProjectedPacketLossRate(double fraction) {}

View File

@ -126,9 +126,7 @@ class AudioEncoder {
// use when decoding the bitstream. The encoder would typically use this
// information to adjust the quality of the encoding. The default
// implementation just returns true.
// TODO(kwiberg): Change return value to void, since it doesn't matter
// whether the encoder approved of the max playback rate or not.
virtual bool SetMaxPlaybackRate(int frequency_hz);
virtual void SetMaxPlaybackRate(int frequency_hz);
// Tells the encoder what the projected packet loss rate is. The rate is in
// the range [0.0, 1.0]. The encoder would typically use this information to

View File

@ -187,8 +187,8 @@ bool AudioEncoderCng::SetApplication(Application application) {
return speech_encoder_->SetApplication(application);
}
bool AudioEncoderCng::SetMaxPlaybackRate(int frequency_hz) {
return speech_encoder_->SetMaxPlaybackRate(frequency_hz);
void AudioEncoderCng::SetMaxPlaybackRate(int frequency_hz) {
speech_encoder_->SetMaxPlaybackRate(frequency_hz);
}
void AudioEncoderCng::SetProjectedPacketLossRate(double fraction) {

View File

@ -64,7 +64,7 @@ class AudioEncoderCng final : public AudioEncoder {
bool SetFec(bool enable) override;
bool SetDtx(bool enable) override;
bool SetApplication(Application application) override;
bool SetMaxPlaybackRate(int frequency_hz) override;
void SetMaxPlaybackRate(int frequency_hz) override;
void SetProjectedPacketLossRate(double fraction) override;
void SetTargetBitrate(int target_bps) override;
void SetMaxBitrate(int max_bps) override;

View File

@ -38,7 +38,7 @@ class MockAudioEncoder final : public AudioEncoder {
MOCK_METHOD1(SetFec, bool(bool enable));
MOCK_METHOD1(SetDtx, bool(bool enable));
MOCK_METHOD1(SetApplication, bool(Application application));
MOCK_METHOD1(SetMaxPlaybackRate, bool(int frequency_hz));
MOCK_METHOD1(SetMaxPlaybackRate, void(int frequency_hz));
MOCK_METHOD1(SetProjectedPacketLossRate, void(double fraction));
MOCK_METHOD1(SetTargetBitrate, void(int target_bps));
MOCK_METHOD1(SetMaxBitrate, void(int max_bps));

View File

@ -190,10 +190,10 @@ bool AudioEncoderOpus::SetApplication(Application application) {
return RecreateEncoderInstance(conf);
}
bool AudioEncoderOpus::SetMaxPlaybackRate(int frequency_hz) {
void AudioEncoderOpus::SetMaxPlaybackRate(int frequency_hz) {
auto conf = config_;
conf.max_playback_rate_hz = frequency_hz;
return RecreateEncoderInstance(conf);
CHECK(RecreateEncoderInstance(conf));
}
void AudioEncoderOpus::SetProjectedPacketLossRate(double fraction) {

View File

@ -76,7 +76,7 @@ class AudioEncoderOpus final : public AudioEncoder {
bool SetDtx(bool enable) override;
bool SetApplication(Application application) override;
bool SetMaxPlaybackRate(int frequency_hz) override;
void SetMaxPlaybackRate(int frequency_hz) override;
void SetProjectedPacketLossRate(double fraction) override;
void SetTargetBitrate(int target_bps) override;

View File

@ -109,8 +109,8 @@ bool AudioEncoderCopyRed::SetApplication(Application application) {
return speech_encoder_->SetApplication(application);
}
bool AudioEncoderCopyRed::SetMaxPlaybackRate(int frequency_hz) {
return speech_encoder_->SetMaxPlaybackRate(frequency_hz);
void AudioEncoderCopyRed::SetMaxPlaybackRate(int frequency_hz) {
speech_encoder_->SetMaxPlaybackRate(frequency_hz);
}
void AudioEncoderCopyRed::SetProjectedPacketLossRate(double fraction) {

View File

@ -51,7 +51,7 @@ class AudioEncoderCopyRed final : public AudioEncoder {
bool SetFec(bool enable) override;
bool SetDtx(bool enable) override;
bool SetApplication(Application application) override;
bool SetMaxPlaybackRate(int frequency_hz) override;
void SetMaxPlaybackRate(int frequency_hz) override;
void SetProjectedPacketLossRate(double fraction) override;
void SetTargetBitrate(int target_bps) override;
void SetMaxBitrate(int max_bps) override;