niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #include "voice_engine/shared_data.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 12 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 13 | #include "voice_engine/channel.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 14 | |
| 15 | namespace webrtc { |
| 16 | |
| 17 | namespace voe { |
| 18 | |
pbos@webrtc.org | 6141e13 | 2013-04-09 10:09:10 +0000 | [diff] [blame] | 19 | static int32_t _gInstanceCounter = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 20 | |
solenberg | 88499ec | 2016-09-07 07:34:41 -0700 | [diff] [blame] | 21 | SharedData::SharedData() |
stefan | 847855b | 2015-09-11 09:52:15 -0700 | [diff] [blame] | 22 | : _instanceId(++_gInstanceCounter), |
solenberg | 88499ec | 2016-09-07 07:34:41 -0700 | [diff] [blame] | 23 | _channelManager(_gInstanceCounter), |
stefan | 847855b | 2015-09-11 09:52:15 -0700 | [diff] [blame] | 24 | _audioDevicePtr(NULL), |
henrika | ec6fbd2 | 2017-03-31 05:43:36 -0700 | [diff] [blame] | 25 | _moduleProcessThreadPtr(ProcessThread::Create("VoiceProcessThread")), |
| 26 | encoder_queue_("AudioEncoderQueue") { |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 27 | } |
| 28 | |
| 29 | SharedData::~SharedData() |
| 30 | { |
henrika@google.com | 73d6551 | 2011-09-07 15:11:18 +0000 | [diff] [blame] | 31 | if (_audioDevicePtr) { |
| 32 | _audioDevicePtr->Release(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 33 | } |
tommi@webrtc.org | 0c3e12b | 2015-02-06 09:44:12 +0000 | [diff] [blame] | 34 | _moduleProcessThreadPtr->Stop(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 35 | } |
| 36 | |
henrika | ec6fbd2 | 2017-03-31 05:43:36 -0700 | [diff] [blame] | 37 | rtc::TaskQueue* SharedData::encoder_queue() { |
| 38 | RTC_DCHECK_RUN_ON(&construction_thread_); |
| 39 | return &encoder_queue_; |
| 40 | } |
| 41 | |
Peter Boström | 1d19441 | 2016-03-21 16:44:31 +0100 | [diff] [blame] | 42 | void SharedData::set_audio_device( |
| 43 | const rtc::scoped_refptr<AudioDeviceModule>& audio_device) { |
| 44 | _audioDevicePtr = audio_device; |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 45 | } |
pbos@webrtc.org | d900e8b | 2013-07-03 15:12:26 +0000 | [diff] [blame] | 46 | } // namespace voe |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 47 | |
pbos@webrtc.org | d900e8b | 2013-07-03 15:12:26 +0000 | [diff] [blame] | 48 | } // namespace webrtc |