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

Side by Side Diff: webrtc/voice_engine/shared_data.cc

Issue 1607353002: Swap use of CriticalSectionWrapper with rtc::CriticalSection in voice_engine/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix bug in monitor_module.cc Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « webrtc/voice_engine/shared_data.h ('k') | webrtc/voice_engine/statistics.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/voice_engine/shared_data.h" 11 #include "webrtc/voice_engine/shared_data.h"
12 12
13 #include "webrtc/modules/audio_processing/include/audio_processing.h" 13 #include "webrtc/modules/audio_processing/include/audio_processing.h"
14 #include "webrtc/system_wrappers/include/critical_section_wrapper.h"
15 #include "webrtc/system_wrappers/include/trace.h" 14 #include "webrtc/system_wrappers/include/trace.h"
16 #include "webrtc/voice_engine/channel.h" 15 #include "webrtc/voice_engine/channel.h"
17 #include "webrtc/voice_engine/output_mixer.h" 16 #include "webrtc/voice_engine/output_mixer.h"
18 #include "webrtc/voice_engine/transmit_mixer.h" 17 #include "webrtc/voice_engine/transmit_mixer.h"
19 18
20 namespace webrtc { 19 namespace webrtc {
21 20
22 namespace voe { 21 namespace voe {
23 22
24 static int32_t _gInstanceCounter = 0; 23 static int32_t _gInstanceCounter = 0;
25 24
26 SharedData::SharedData(const Config& config) 25 SharedData::SharedData(const Config& config)
27 : _instanceId(++_gInstanceCounter), 26 : _instanceId(++_gInstanceCounter),
28 _apiCritPtr(CriticalSectionWrapper::CreateCriticalSection()),
29 _channelManager(_gInstanceCounter, config), 27 _channelManager(_gInstanceCounter, config),
30 _engineStatistics(_gInstanceCounter), 28 _engineStatistics(_gInstanceCounter),
31 _audioDevicePtr(NULL), 29 _audioDevicePtr(NULL),
32 _moduleProcessThreadPtr(ProcessThread::Create("VoiceProcessThread")) { 30 _moduleProcessThreadPtr(ProcessThread::Create("VoiceProcessThread")) {
33 Trace::CreateTrace(); 31 Trace::CreateTrace();
34 if (OutputMixer::Create(_outputMixerPtr, _gInstanceCounter) == 0) 32 if (OutputMixer::Create(_outputMixerPtr, _gInstanceCounter) == 0)
35 { 33 {
36 _outputMixerPtr->SetEngineInformation(_engineStatistics); 34 _outputMixerPtr->SetEngineInformation(_engineStatistics);
37 } 35 }
38 if (TransmitMixer::Create(_transmitMixerPtr, _gInstanceCounter) == 0) 36 if (TransmitMixer::Create(_transmitMixerPtr, _gInstanceCounter) == 0)
39 { 37 {
40 _transmitMixerPtr->SetEngineInformation(*_moduleProcessThreadPtr, 38 _transmitMixerPtr->SetEngineInformation(*_moduleProcessThreadPtr,
41 _engineStatistics, 39 _engineStatistics,
42 _channelManager); 40 _channelManager);
43 } 41 }
44 _audioDeviceLayer = AudioDeviceModule::kPlatformDefaultAudio; 42 _audioDeviceLayer = AudioDeviceModule::kPlatformDefaultAudio;
45 } 43 }
46 44
47 SharedData::~SharedData() 45 SharedData::~SharedData()
48 { 46 {
49 OutputMixer::Destroy(_outputMixerPtr); 47 OutputMixer::Destroy(_outputMixerPtr);
50 TransmitMixer::Destroy(_transmitMixerPtr); 48 TransmitMixer::Destroy(_transmitMixerPtr);
51 if (_audioDevicePtr) { 49 if (_audioDevicePtr) {
52 _audioDevicePtr->Release(); 50 _audioDevicePtr->Release();
53 } 51 }
54 delete _apiCritPtr;
55 _moduleProcessThreadPtr->Stop(); 52 _moduleProcessThreadPtr->Stop();
56 Trace::ReturnTrace(); 53 Trace::ReturnTrace();
57 } 54 }
58 55
59 void SharedData::set_audio_device(AudioDeviceModule* audio_device) 56 void SharedData::set_audio_device(AudioDeviceModule* audio_device)
60 { 57 {
61 // AddRef first in case the pointers are equal. 58 // AddRef first in case the pointers are equal.
62 if (audio_device) 59 if (audio_device)
63 audio_device->AddRef(); 60 audio_device->AddRef();
64 if (_audioDevicePtr) 61 if (_audioDevicePtr)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 105 }
109 106
110 void SharedData::SetLastError(int32_t error, TraceLevel level, 107 void SharedData::SetLastError(int32_t error, TraceLevel level,
111 const char* msg) const { 108 const char* msg) const {
112 _engineStatistics.SetLastError(error, level, msg); 109 _engineStatistics.SetLastError(error, level, msg);
113 } 110 }
114 111
115 } // namespace voe 112 } // namespace voe
116 113
117 } // namespace webrtc 114 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/voice_engine/shared_data.h ('k') | webrtc/voice_engine/statistics.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698