Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Unified Diff: webrtc/tools/force_mic_volume_max/force_mic_volume_max.cc

Issue 2268183007: Don't use VoE legacy APIs in force_mic_volume_max tool. (Closed)
Patch Set: Exclude force_mic_volume_max target when rtc_include_internal_audio_device not set. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/tools/DEPS ('k') | webrtc/tools/tools.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/tools/force_mic_volume_max/force_mic_volume_max.cc
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 2bab2881bbe903123808ff01592ea56f0ddd31dc..0a2347d5bad1a243f657c75b98ad8ea041e0c0a9 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,33 +12,45 @@
#include <stdio.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"
-
-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;
- }
+#include "webrtc/modules/audio_device/include/audio_device.h"
+
+using webrtc::AudioDeviceModule;
- webrtc::VoEBase* base = webrtc::VoEBase::GetInterface(voe);
- webrtc::VoEVolumeControl* volume_control =
- webrtc::VoEVolumeControl::GetInterface(voe);
+#if defined(_WIN32)
+#define DEFAULT_INPUT_DEVICE (AudioDeviceModule::kDefaultCommunicationDevice)
+#else
+#define DEFAULT_INPUT_DEVICE (0)
+#endif
- if (base->Init() != 0) {
- fprintf(stderr, "Failed to initialize voice engine base.\n");
+int main(int /*argc*/, char** /*argv*/) {
+ // Create and initialize the ADM.
+ rtc::scoped_refptr<AudioDeviceModule> 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;
}
- // 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");
+ 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");
+ 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");
return 1;
}
- if (volume_control->SetMicVolume(255) != 0) {
- fprintf(stderr, "Failed set volume to 255.\n");
+ if (adm->SetMicrophoneVolume(max_vol) != 0) {
+ fprintf(stderr, "Failed to set mic volume.\n");
return 1;
}
« no previous file with comments | « webrtc/tools/DEPS ('k') | webrtc/tools/tools.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698