Remove the SetLocalMonitor() API.
BUG=webrtc:4690 Review URL: https://codereview.webrtc.org/1344083004 Cr-Commit-Position: refs/heads/master@{#10020}
This commit is contained in:
@ -836,8 +836,6 @@ class FakeVoiceEngine : public FakeBaseEngine {
|
||||
|
||||
int GetInputLevel() { return 0; }
|
||||
|
||||
bool SetLocalMonitor(bool enable) { return true; }
|
||||
|
||||
bool StartAecDump(rtc::PlatformFile file) { return false; }
|
||||
|
||||
bool RegisterProcessor(uint32 ssrc, VoiceProcessor* voice_processor,
|
||||
|
||||
@ -113,14 +113,8 @@ class MediaEngineInterface {
|
||||
// Sets the current speaker volume, as a value between 0 and 255.
|
||||
virtual bool SetOutputVolume(int level) = 0;
|
||||
|
||||
// Local monitoring
|
||||
// Gets the current microphone level, as a value between 0 and 10.
|
||||
virtual int GetInputLevel() = 0;
|
||||
// Starts or stops the local microphone. Useful if local mic info is needed
|
||||
// prior to a call being connected; the mic will be started automatically
|
||||
// when a VoiceMediaChannel starts sending.
|
||||
virtual bool SetLocalMonitor(bool enable) = 0;
|
||||
// Installs a callback for raw frames from the local camera.
|
||||
|
||||
virtual const std::vector<AudioCodec>& audio_codecs() = 0;
|
||||
virtual const std::vector<RtpHeaderExtension>&
|
||||
@ -223,9 +217,6 @@ class CompositeMediaEngine : public MediaEngineInterface {
|
||||
virtual int GetInputLevel() {
|
||||
return voice_.GetInputLevel();
|
||||
}
|
||||
virtual bool SetLocalMonitor(bool enable) {
|
||||
return voice_.SetLocalMonitor(enable);
|
||||
}
|
||||
virtual const std::vector<AudioCodec>& audio_codecs() {
|
||||
return voice_.codecs();
|
||||
}
|
||||
@ -289,7 +280,6 @@ class NullVoiceEngine {
|
||||
}
|
||||
bool SetOutputVolume(int level) { return true; }
|
||||
int GetInputLevel() { return 0; }
|
||||
bool SetLocalMonitor(bool enable) { return true; }
|
||||
const std::vector<AudioCodec>& codecs() { return codecs_; }
|
||||
const std::vector<RtpHeaderExtension>& rtp_header_extensions() {
|
||||
return rtp_header_extensions_;
|
||||
|
||||
@ -295,8 +295,6 @@ class FakeWebRtcVoiceEngine
|
||||
observer_(NULL),
|
||||
playout_fail_channel_(-1),
|
||||
send_fail_channel_(-1),
|
||||
fail_start_recording_microphone_(false),
|
||||
recording_microphone_(false),
|
||||
recording_sample_rate_(-1),
|
||||
playout_sample_rate_(-1),
|
||||
media_processor_(NULL) {
|
||||
@ -331,9 +329,6 @@ class FakeWebRtcVoiceEngine
|
||||
bool GetSend(int channel) {
|
||||
return channels_[channel]->send;
|
||||
}
|
||||
bool GetRecordingMicrophone() {
|
||||
return recording_microphone_;
|
||||
}
|
||||
bool GetVAD(int channel) {
|
||||
return channels_[channel]->vad;
|
||||
}
|
||||
@ -392,10 +387,6 @@ class FakeWebRtcVoiceEngine
|
||||
void set_send_fail_channel(int channel) {
|
||||
send_fail_channel_ = channel;
|
||||
}
|
||||
void set_fail_start_recording_microphone(
|
||||
bool fail_start_recording_microphone) {
|
||||
fail_start_recording_microphone_ = fail_start_recording_microphone;
|
||||
}
|
||||
void set_fail_create_channel(bool fail_create_channel) {
|
||||
fail_create_channel_ = fail_create_channel;
|
||||
}
|
||||
@ -780,25 +771,13 @@ class FakeWebRtcVoiceEngine
|
||||
WEBRTC_FUNC(StartRecordingMicrophone, (const char* fileNameUTF8,
|
||||
webrtc::CodecInst* compression,
|
||||
int maxSizeBytes)) {
|
||||
if (fail_start_recording_microphone_) {
|
||||
return -1;
|
||||
}
|
||||
recording_microphone_ = true;
|
||||
return 0;
|
||||
}
|
||||
WEBRTC_FUNC(StartRecordingMicrophone, (webrtc::OutStream* stream,
|
||||
webrtc::CodecInst* compression)) {
|
||||
if (fail_start_recording_microphone_) {
|
||||
return -1;
|
||||
}
|
||||
recording_microphone_ = true;
|
||||
return 0;
|
||||
}
|
||||
WEBRTC_FUNC(StopRecordingMicrophone, ()) {
|
||||
if (!recording_microphone_) {
|
||||
return -1;
|
||||
}
|
||||
recording_microphone_ = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1277,8 +1256,6 @@ class FakeWebRtcVoiceEngine
|
||||
webrtc::VoiceEngineObserver* observer_;
|
||||
int playout_fail_channel_;
|
||||
int send_fail_channel_;
|
||||
bool fail_start_recording_microphone_;
|
||||
bool recording_microphone_;
|
||||
int recording_sample_rate_;
|
||||
int playout_sample_rate_;
|
||||
DtmfInfo dtmf_info_;
|
||||
|
||||
@ -369,7 +369,6 @@ WebRtcVoiceEngine::WebRtcVoiceEngine()
|
||||
adm_(NULL),
|
||||
log_filter_(SeverityToFilter(kDefaultLogSeverity)),
|
||||
is_dumping_aec_(false),
|
||||
desired_local_monitor_enable_(false),
|
||||
tx_processor_ssrc_(0),
|
||||
rx_processor_ssrc_(0) {
|
||||
Construct();
|
||||
@ -382,7 +381,6 @@ WebRtcVoiceEngine::WebRtcVoiceEngine(VoEWrapper* voe_wrapper,
|
||||
adm_(NULL),
|
||||
log_filter_(SeverityToFilter(kDefaultLogSeverity)),
|
||||
is_dumping_aec_(false),
|
||||
desired_local_monitor_enable_(false),
|
||||
tx_processor_ssrc_(0),
|
||||
rx_processor_ssrc_(0) {
|
||||
Construct();
|
||||
@ -572,7 +570,6 @@ void WebRtcVoiceEngine::Terminate() {
|
||||
StopAecDump();
|
||||
|
||||
voe_wrapper_->base()->Terminate();
|
||||
desired_local_monitor_enable_ = false;
|
||||
}
|
||||
|
||||
int WebRtcVoiceEngine::GetCapabilities() {
|
||||
@ -933,14 +930,8 @@ bool WebRtcVoiceEngine::SetDevices(const Device* in_device,
|
||||
<< ") and speaker to (id=" << out_id << ", name=" << out_name
|
||||
<< ")";
|
||||
|
||||
// If we're running the local monitor, we need to stop it first.
|
||||
bool ret = true;
|
||||
if (!PauseLocalMonitor()) {
|
||||
LOG(LS_WARNING) << "Failed to pause local monitor";
|
||||
ret = false;
|
||||
}
|
||||
|
||||
// Must also pause all audio playback and capture.
|
||||
bool ret = true;
|
||||
for (WebRtcVoiceMediaChannel* channel : channels_) {
|
||||
if (!channel->PausePlayout()) {
|
||||
LOG(LS_WARNING) << "Failed to pause playout";
|
||||
@ -990,12 +981,6 @@ bool WebRtcVoiceEngine::SetDevices(const Device* in_device,
|
||||
}
|
||||
}
|
||||
|
||||
// Resume local monitor.
|
||||
if (!ResumeLocalMonitor()) {
|
||||
LOG(LS_WARNING) << "Failed to resume local monitor";
|
||||
ret = false;
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
LOG(LS_INFO) << "Set microphone to (id=" << in_id <<" name=" << in_name
|
||||
<< ") and speaker to (id="<< out_id << " name=" << out_name
|
||||
@ -1083,42 +1068,6 @@ int WebRtcVoiceEngine::GetInputLevel() {
|
||||
static_cast<int>(ulevel) : -1;
|
||||
}
|
||||
|
||||
bool WebRtcVoiceEngine::SetLocalMonitor(bool enable) {
|
||||
desired_local_monitor_enable_ = enable;
|
||||
return ChangeLocalMonitor(desired_local_monitor_enable_);
|
||||
}
|
||||
|
||||
bool WebRtcVoiceEngine::ChangeLocalMonitor(bool enable) {
|
||||
// The voe file api is not available in chrome.
|
||||
if (!voe_wrapper_->file()) {
|
||||
return false;
|
||||
}
|
||||
if (enable && !monitor_) {
|
||||
monitor_.reset(new WebRtcMonitorStream);
|
||||
if (voe_wrapper_->file()->StartRecordingMicrophone(monitor_.get()) == -1) {
|
||||
LOG_RTCERR1(StartRecordingMicrophone, monitor_.get());
|
||||
// Must call Stop() because there are some cases where Start will report
|
||||
// failure but still change the state, and if we leave VE in the on state
|
||||
// then it could crash later when trying to invoke methods on our monitor.
|
||||
voe_wrapper_->file()->StopRecordingMicrophone();
|
||||
monitor_.reset();
|
||||
return false;
|
||||
}
|
||||
} else if (!enable && monitor_) {
|
||||
voe_wrapper_->file()->StopRecordingMicrophone();
|
||||
monitor_.reset();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WebRtcVoiceEngine::PauseLocalMonitor() {
|
||||
return ChangeLocalMonitor(false);
|
||||
}
|
||||
|
||||
bool WebRtcVoiceEngine::ResumeLocalMonitor() {
|
||||
return ChangeLocalMonitor(desired_local_monitor_enable_);
|
||||
}
|
||||
|
||||
const std::vector<AudioCodec>& WebRtcVoiceEngine::codecs() {
|
||||
return codecs_;
|
||||
}
|
||||
|
||||
@ -53,12 +53,6 @@ class VideoEngine;
|
||||
|
||||
namespace cricket {
|
||||
|
||||
// WebRtcMonitorStream is used to monitor a stream coming from WebRtc.
|
||||
// For now we just dump the data.
|
||||
class WebRtcMonitorStream : public webrtc::OutStream {
|
||||
bool Write(const void* buf, size_t len) override { return true; }
|
||||
};
|
||||
|
||||
class AudioDeviceModule;
|
||||
class AudioRenderer;
|
||||
class VoETraceWrapper;
|
||||
@ -94,7 +88,6 @@ class WebRtcVoiceEngine
|
||||
bool GetOutputVolume(int* level);
|
||||
bool SetOutputVolume(int level);
|
||||
int GetInputLevel();
|
||||
bool SetLocalMonitor(bool enable);
|
||||
|
||||
const std::vector<AudioCodec>& codecs();
|
||||
bool FindCodec(const AudioCodec& codec);
|
||||
@ -190,9 +183,6 @@ class WebRtcVoiceEngine
|
||||
bool FindChannelNumFromSsrc(uint32 ssrc,
|
||||
MediaProcessorDirection direction,
|
||||
int* channel_num);
|
||||
bool ChangeLocalMonitor(bool enable);
|
||||
bool PauseLocalMonitor();
|
||||
bool ResumeLocalMonitor();
|
||||
|
||||
bool UnregisterProcessorChannel(MediaProcessorDirection channel_direction,
|
||||
uint32 ssrc,
|
||||
@ -221,8 +211,6 @@ class WebRtcVoiceEngine
|
||||
bool is_dumping_aec_;
|
||||
std::vector<AudioCodec> codecs_;
|
||||
std::vector<RtpHeaderExtension> rtp_header_extensions_;
|
||||
bool desired_local_monitor_enable_;
|
||||
rtc::scoped_ptr<WebRtcMonitorStream> monitor_;
|
||||
ChannelList channels_;
|
||||
// channels_ can be read from WebRtc callback thread. We need a lock on that
|
||||
// callback as well as the RegisterChannel/UnregisterChannel.
|
||||
|
||||
@ -2127,38 +2127,31 @@ TEST_F(WebRtcVoiceEngineTestFake, SetDevices) {
|
||||
EXPECT_TRUE(engine_.SetDevices(&default_dev, &default_dev));
|
||||
|
||||
// Test SetDevices() while sending and playing.
|
||||
EXPECT_TRUE(engine_.SetLocalMonitor(true));
|
||||
EXPECT_TRUE(channel_->SetSend(cricket::SEND_MICROPHONE));
|
||||
EXPECT_TRUE(channel_->SetPlayout(true));
|
||||
EXPECT_TRUE(voe_.GetRecordingMicrophone());
|
||||
EXPECT_TRUE(voe_.GetSend(channel_num));
|
||||
EXPECT_TRUE(voe_.GetPlayout(channel_num));
|
||||
|
||||
EXPECT_TRUE(engine_.SetDevices(&dev, &dev));
|
||||
|
||||
EXPECT_TRUE(voe_.GetRecordingMicrophone());
|
||||
EXPECT_TRUE(voe_.GetSend(channel_num));
|
||||
EXPECT_TRUE(voe_.GetPlayout(channel_num));
|
||||
|
||||
// Test that failure to open newly selected devices does not prevent opening
|
||||
// ones after that.
|
||||
voe_.set_fail_start_recording_microphone(true);
|
||||
voe_.set_playout_fail_channel(channel_num);
|
||||
voe_.set_send_fail_channel(channel_num);
|
||||
|
||||
EXPECT_FALSE(engine_.SetDevices(&default_dev, &default_dev));
|
||||
|
||||
EXPECT_FALSE(voe_.GetRecordingMicrophone());
|
||||
EXPECT_FALSE(voe_.GetSend(channel_num));
|
||||
EXPECT_FALSE(voe_.GetPlayout(channel_num));
|
||||
|
||||
voe_.set_fail_start_recording_microphone(false);
|
||||
voe_.set_playout_fail_channel(-1);
|
||||
voe_.set_send_fail_channel(-1);
|
||||
|
||||
EXPECT_TRUE(engine_.SetDevices(&dev, &dev));
|
||||
|
||||
EXPECT_TRUE(voe_.GetRecordingMicrophone());
|
||||
EXPECT_TRUE(voe_.GetSend(channel_num));
|
||||
EXPECT_TRUE(voe_.GetPlayout(channel_num));
|
||||
}
|
||||
@ -2177,26 +2170,21 @@ TEST_F(WebRtcVoiceEngineTestFake, SetDevicesWithInitiallyBadDevices) {
|
||||
|
||||
// Test that failure to open devices selected before starting
|
||||
// send/play does not prevent opening newly selected ones after that.
|
||||
voe_.set_fail_start_recording_microphone(true);
|
||||
voe_.set_playout_fail_channel(channel_num);
|
||||
voe_.set_send_fail_channel(channel_num);
|
||||
|
||||
EXPECT_TRUE(engine_.SetDevices(&default_dev, &default_dev));
|
||||
|
||||
EXPECT_FALSE(engine_.SetLocalMonitor(true));
|
||||
EXPECT_FALSE(channel_->SetSend(cricket::SEND_MICROPHONE));
|
||||
EXPECT_FALSE(channel_->SetPlayout(true));
|
||||
EXPECT_FALSE(voe_.GetRecordingMicrophone());
|
||||
EXPECT_FALSE(voe_.GetSend(channel_num));
|
||||
EXPECT_FALSE(voe_.GetPlayout(channel_num));
|
||||
|
||||
voe_.set_fail_start_recording_microphone(false);
|
||||
voe_.set_playout_fail_channel(-1);
|
||||
voe_.set_send_fail_channel(-1);
|
||||
|
||||
EXPECT_TRUE(engine_.SetDevices(&dev, &dev));
|
||||
|
||||
EXPECT_TRUE(voe_.GetRecordingMicrophone());
|
||||
EXPECT_TRUE(voe_.GetSend(channel_num));
|
||||
EXPECT_TRUE(voe_.GetPlayout(channel_num));
|
||||
}
|
||||
|
||||
@ -114,7 +114,6 @@ void ChannelManager::Construct(MediaEngineInterface* me,
|
||||
audio_output_volume_ = kNotSetOutputVolume;
|
||||
local_renderer_ = NULL;
|
||||
capturing_ = false;
|
||||
monitoring_ = false;
|
||||
enable_rtx_ = false;
|
||||
|
||||
// Init the device manager immediately, and set up our default video device.
|
||||
@ -708,16 +707,6 @@ bool ChannelManager::SetDefaultVideoEncoderConfig(const VideoEncoderConfig& c) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool ChannelManager::SetLocalMonitor(bool enable) {
|
||||
bool ret = initialized_ && worker_thread_->Invoke<bool>(
|
||||
Bind(&MediaEngineInterface::SetLocalMonitor,
|
||||
media_engine_.get(), enable));
|
||||
if (ret) {
|
||||
monitoring_ = enable;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ChannelManager::SetVoiceLogging(int level, const char* filter) {
|
||||
if (initialized_) {
|
||||
worker_thread_->Invoke<void>(
|
||||
|
||||
@ -165,8 +165,6 @@ class ChannelManager : public rtc::MessageHandler,
|
||||
bool SetVideoRtxEnabled(bool enable);
|
||||
|
||||
// Starts/stops the local microphone and enables polling of the input level.
|
||||
bool SetLocalMonitor(bool enable);
|
||||
bool monitoring() const { return monitoring_; }
|
||||
bool capturing() const { return capturing_; }
|
||||
|
||||
// Configures the logging output of the mediaengine(s).
|
||||
@ -301,7 +299,6 @@ class ChannelManager : public rtc::MessageHandler,
|
||||
bool enable_rtx_;
|
||||
|
||||
bool capturing_;
|
||||
bool monitoring_;
|
||||
|
||||
// String containing currently set device. Note that this string is subtly
|
||||
// different from camera_device_. E.g. camera_device_ will list unplugged
|
||||
|
||||
Reference in New Issue
Block a user