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

Unified Diff: webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc

Issue 2103863004: UMA log for audio_device Init and Start(Playout|Recording). Make Init return a more specific error … (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rename variable. Created 4 years, 6 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
Index: webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc
diff --git a/webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc b/webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc
index 42c3ea82954ebb04eeac0ff9e2b17e5aa2ce37c4..e408f22066f30c15eaf2352753cc2a43905e0e35 100644
--- a/webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc
+++ b/webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc
@@ -11,10 +11,9 @@
#include <assert.h>
#include "webrtc/base/checks.h"
-
+#include "webrtc/base/logging.h"
#include "webrtc/modules/audio_device/audio_device_config.h"
#include "webrtc/modules/audio_device/linux/audio_device_pulse_linux.h"
-
#include "webrtc/system_wrappers/include/event_wrapper.h"
#include "webrtc/system_wrappers/include/trace.h"
@@ -163,58 +162,49 @@ int32_t AudioDeviceLinuxPulse::ActiveAudioLayer(
return 0;
}
-int32_t AudioDeviceLinuxPulse::Init()
-{
- RTC_DCHECK(thread_checker_.CalledOnValidThread());
- if (_initialized)
- {
- return 0;
- }
+AudioDeviceGeneric::InitStatus AudioDeviceLinuxPulse::Init() {
+ RTC_DCHECK(thread_checker_.CalledOnValidThread());
+ if (_initialized) {
+ return InitStatus::OK;
+ }
- // Initialize PulseAudio
- if (InitPulseAudio() < 0)
- {
- WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id,
- " failed to initialize PulseAudio");
-
- if (TerminatePulseAudio() < 0)
- {
- WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id,
- " failed to terminate PulseAudio");
- }
-
- return -1;
+ // Initialize PulseAudio
+ if (InitPulseAudio() < 0) {
+ LOG(LS_ERROR) << "failed to initialize PulseAudio";
+ if (TerminatePulseAudio() < 0) {
+ LOG(LS_ERROR) << "failed to terminate PulseAudio";
}
+ return InitStatus::OTHER_ERROR;
+ }
- _playWarning = 0;
- _playError = 0;
- _recWarning = 0;
- _recError = 0;
+ _playWarning = 0;
+ _playError = 0;
+ _recWarning = 0;
+ _recError = 0;
- //Get X display handle for typing detection
- _XDisplay = XOpenDisplay(NULL);
- if (!_XDisplay)
- {
- WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id,
- " failed to open X display, typing detection will not work");
- }
+ // Get X display handle for typing detection
+ _XDisplay = XOpenDisplay(NULL);
+ if (!_XDisplay) {
+ LOG(LS_WARNING)
+ << "failed to open X display, typing detection will not work";
+ }
- // RECORDING
- _ptrThreadRec.reset(new rtc::PlatformThread(
- RecThreadFunc, this, "webrtc_audio_module_rec_thread"));
+ // RECORDING
+ _ptrThreadRec.reset(new rtc::PlatformThread(
+ RecThreadFunc, this, "webrtc_audio_module_rec_thread"));
- _ptrThreadRec->Start();
- _ptrThreadRec->SetPriority(rtc::kRealtimePriority);
+ _ptrThreadRec->Start();
+ _ptrThreadRec->SetPriority(rtc::kRealtimePriority);
- // PLAYOUT
- _ptrThreadPlay.reset(new rtc::PlatformThread(
- PlayThreadFunc, this, "webrtc_audio_module_play_thread"));
- _ptrThreadPlay->Start();
- _ptrThreadPlay->SetPriority(rtc::kRealtimePriority);
+ // PLAYOUT
+ _ptrThreadPlay.reset(new rtc::PlatformThread(
+ PlayThreadFunc, this, "webrtc_audio_module_play_thread"));
+ _ptrThreadPlay->Start();
+ _ptrThreadPlay->SetPriority(rtc::kRealtimePriority);
- _initialized = true;
+ _initialized = true;
- return 0;
+ return InitStatus::OK;
}
int32_t AudioDeviceLinuxPulse::Terminate()

Powered by Google App Engine
This is Rietveld 408576698