Remove GetOutputScaling from VoiceMediaChannel.
BUG=webrtc:4690 Review URL: https://codereview.webrtc.org/1331443003 Cr-Commit-Position: refs/heads/master@{#9870}
This commit is contained in:
parent
0ab8ca8365
commit
bb741b3afa
@ -1206,8 +1206,9 @@ void WebRtcSession::SetAudioPlayoutVolume(uint32 ssrc, double volume) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!voice_channel_->SetOutputScaling(ssrc, volume, volume))
|
||||
if (!voice_channel_->SetOutputScaling(ssrc, volume, volume)) {
|
||||
ASSERT(false);
|
||||
}
|
||||
}
|
||||
|
||||
bool WebRtcSession::SetCaptureDevice(uint32 ssrc,
|
||||
|
||||
@ -384,7 +384,7 @@ class FakeVoiceMediaChannel : public RtpHelper<VoiceMediaChannel> {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
virtual bool GetOutputScaling(uint32 ssrc, double* left, double* right) {
|
||||
bool GetOutputScaling(uint32 ssrc, double* left, double* right) {
|
||||
if (output_scalings_.find(ssrc) == output_scalings_.end())
|
||||
return false;
|
||||
*left = output_scalings_[ssrc].left;
|
||||
|
||||
@ -1113,8 +1113,6 @@ class VoiceMediaChannel : public MediaChannel {
|
||||
int type_event_delay) = 0;
|
||||
// Set left and right scale for speaker output volume of the specified ssrc.
|
||||
virtual bool SetOutputScaling(uint32 ssrc, double left, double right) = 0;
|
||||
// Get left and right scale for speaker output volume of the specified ssrc.
|
||||
virtual bool GetOutputScaling(uint32 ssrc, double* left, double* right) = 0;
|
||||
// Specifies a ringback tone to be played during call setup.
|
||||
virtual bool SetRingbackTone(const char *buf, int len) = 0;
|
||||
// Plays or stops the aforementioned ringback tone
|
||||
|
||||
@ -2841,40 +2841,6 @@ bool WebRtcVoiceMediaChannel::SetOutputScaling(
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WebRtcVoiceMediaChannel::GetOutputScaling(
|
||||
uint32 ssrc, double* left, double* right) {
|
||||
if (!left || !right) return false;
|
||||
|
||||
rtc::CritScope lock(&receive_channels_cs_);
|
||||
// Determine which channel based on ssrc.
|
||||
int channel = (0 == ssrc) ? voe_channel() : GetReceiveChannelNum(ssrc);
|
||||
if (channel == -1) {
|
||||
LOG(LS_WARNING) << "Cannot find channel for ssrc:" << ssrc;
|
||||
return false;
|
||||
}
|
||||
|
||||
float scaling;
|
||||
if (-1 == engine()->voe()->volume()->GetChannelOutputVolumeScaling(
|
||||
channel, scaling)) {
|
||||
LOG_RTCERR2(GetChannelOutputVolumeScaling, channel, scaling);
|
||||
return false;
|
||||
}
|
||||
|
||||
float left_pan;
|
||||
float right_pan;
|
||||
if (-1 == engine()->voe()->volume()->GetOutputVolumePan(
|
||||
channel, left_pan, right_pan)) {
|
||||
LOG_RTCERR3(GetOutputVolumePan, channel, left_pan, right_pan);
|
||||
// If GetOutputVolumePan fails, we use the default left and right pan.
|
||||
left_pan = 1.0f;
|
||||
right_pan = 1.0f;
|
||||
}
|
||||
|
||||
*left = scaling * left_pan;
|
||||
*right = scaling * right_pan;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WebRtcVoiceMediaChannel::SetRingbackTone(const char *buf, int len) {
|
||||
ringback_tone_.reset(new WebRtcSoundclipStream(buf, len));
|
||||
return true;
|
||||
|
||||
@ -320,7 +320,6 @@ class WebRtcVoiceMediaChannel : public VoiceMediaChannel,
|
||||
int penalty_decay,
|
||||
int type_event_delay) override;
|
||||
bool SetOutputScaling(uint32 ssrc, double left, double right) override;
|
||||
bool GetOutputScaling(uint32 ssrc, double* left, double* right) override;
|
||||
|
||||
bool SetRingbackTone(const char* buf, int len) override;
|
||||
bool PlayRingbackTone(uint32 ssrc, bool play, bool loop) override;
|
||||
|
||||
@ -3162,11 +3162,13 @@ TEST_F(WebRtcVoiceEngineTestFake, TestGetChannelNumInConferenceCalls) {
|
||||
|
||||
TEST_F(WebRtcVoiceEngineTestFake, SetOutputScaling) {
|
||||
EXPECT_TRUE(SetupEngine());
|
||||
double left, right;
|
||||
float scale, left, right;
|
||||
EXPECT_TRUE(channel_->SetOutputScaling(0, 1, 2));
|
||||
EXPECT_TRUE(channel_->GetOutputScaling(0, &left, &right));
|
||||
EXPECT_DOUBLE_EQ(1, left);
|
||||
EXPECT_DOUBLE_EQ(2, right);
|
||||
int channel_id = voe_.GetLastChannel();
|
||||
EXPECT_EQ(0, voe_.GetChannelOutputVolumeScaling(channel_id, scale));
|
||||
EXPECT_EQ(0, voe_.GetOutputVolumePan(channel_id, left, right));
|
||||
EXPECT_DOUBLE_EQ(1, left * scale);
|
||||
EXPECT_DOUBLE_EQ(2, right * scale);
|
||||
|
||||
EXPECT_FALSE(channel_->SetOutputScaling(kSsrc2, 1, 2));
|
||||
cricket::StreamParams stream;
|
||||
@ -3174,9 +3176,11 @@ TEST_F(WebRtcVoiceEngineTestFake, SetOutputScaling) {
|
||||
EXPECT_TRUE(channel_->AddRecvStream(stream));
|
||||
|
||||
EXPECT_TRUE(channel_->SetOutputScaling(kSsrc2, 2, 1));
|
||||
EXPECT_TRUE(channel_->GetOutputScaling(kSsrc2, &left, &right));
|
||||
EXPECT_DOUBLE_EQ(2, left);
|
||||
EXPECT_DOUBLE_EQ(1, right);
|
||||
channel_id = voe_.GetLastChannel();
|
||||
EXPECT_EQ(0, voe_.GetChannelOutputVolumeScaling(channel_id, scale));
|
||||
EXPECT_EQ(0, voe_.GetOutputVolumePan(channel_id, left, right));
|
||||
EXPECT_DOUBLE_EQ(2, left * scale);
|
||||
EXPECT_DOUBLE_EQ(1, right * scale);
|
||||
}
|
||||
|
||||
TEST_F(WebRtcVoiceEngineTestFake, SetsSyncGroupFromSyncLabel) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user