diff --git a/webrtc/tools/DEPS b/webrtc/tools/DEPS index b9adeaf542..e4b85c8fc8 100644 --- a/webrtc/tools/DEPS +++ b/webrtc/tools/DEPS @@ -2,7 +2,6 @@ include_rules = [ "+webrtc/base", "+webrtc/call", "+webrtc/common_video", - "+webrtc/modules/audio_device", "+webrtc/modules/audio_processing", "+webrtc/modules/congestion_controller", "+webrtc/modules/rtp_rtcp", diff --git a/webrtc/tools/force_mic_volume_max/force_mic_volume_max.cc b/webrtc/tools/force_mic_volume_max/force_mic_volume_max.cc index 0a2347d5ba..2bab2881bb 100644 --- a/webrtc/tools/force_mic_volume_max/force_mic_volume_max.cc +++ b/webrtc/tools/force_mic_volume_max/force_mic_volume_max.cc @@ -12,45 +12,33 @@ #include -#include "webrtc/modules/audio_device/include/audio_device.h" +#include "webrtc/test/channel_transport/channel_transport.h" +#include "webrtc/voice_engine/include/voe_audio_processing.h" +#include "webrtc/voice_engine/include/voe_base.h" +#include "webrtc/voice_engine/include/voe_volume_control.h" -using webrtc::AudioDeviceModule; - -#if defined(_WIN32) -#define DEFAULT_INPUT_DEVICE (AudioDeviceModule::kDefaultCommunicationDevice) -#else -#define DEFAULT_INPUT_DEVICE (0) -#endif - -int main(int /*argc*/, char** /*argv*/) { - // Create and initialize the ADM. - rtc::scoped_refptr adm( - AudioDeviceModule::Create(1, AudioDeviceModule::kPlatformDefaultAudio)); - if (!adm.get()) { - fprintf(stderr, "Failed to create Audio Device Module.\n"); - return 1; - } - if (adm->Init() != 0) { - fprintf(stderr, "Failed to initialize Audio Device Module.\n"); - return 1; - } - if (adm->SetRecordingDevice(DEFAULT_INPUT_DEVICE) != 0) { - fprintf(stderr, "Failed to set the default input device.\n"); - return 1; - } - if (adm->InitMicrophone() != 0) { - fprintf(stderr, "Failed to to initialize the microphone.\n"); +int main(int argc, char** argv) { + webrtc::VoiceEngine* voe = webrtc::VoiceEngine::Create(); + if (voe == NULL) { + fprintf(stderr, "Failed to initialize voice engine.\n"); return 1; } - // Set mic volume to max. - uint32_t max_vol = 0; - if (adm->MaxMicrophoneVolume(&max_vol) != 0) { - fprintf(stderr, "Failed to get max volume.\n"); + webrtc::VoEBase* base = webrtc::VoEBase::GetInterface(voe); + webrtc::VoEVolumeControl* volume_control = + webrtc::VoEVolumeControl::GetInterface(voe); + + if (base->Init() != 0) { + fprintf(stderr, "Failed to initialize voice engine base.\n"); return 1; } - if (adm->SetMicrophoneVolume(max_vol) != 0) { - fprintf(stderr, "Failed to set mic volume.\n"); + // Set to 0 first in case the mic is above 100%. + if (volume_control->SetMicVolume(0) != 0) { + fprintf(stderr, "Failed set volume to 0.\n"); + return 1; + } + if (volume_control->SetMicVolume(255) != 0) { + fprintf(stderr, "Failed set volume to 255.\n"); return 1; }