blob: 420a7da2cfcf78beed8a7f726b89a5441dd098ca [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
tommi@webrtc.org851becd2012-04-04 14:57:19 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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 Bonadei92ea95e2017-09-15 06:47:31 +020011#include "voice_engine/shared_data.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000012
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020013#include "voice_engine/channel.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000014
15namespace webrtc {
16
17namespace voe {
18
pbos@webrtc.org6141e132013-04-09 10:09:10 +000019static int32_t _gInstanceCounter = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000020
solenberg88499ec2016-09-07 07:34:41 -070021SharedData::SharedData()
stefan847855b2015-09-11 09:52:15 -070022 : _instanceId(++_gInstanceCounter),
solenberg88499ec2016-09-07 07:34:41 -070023 _channelManager(_gInstanceCounter),
stefan847855b2015-09-11 09:52:15 -070024 _audioDevicePtr(NULL),
henrikaec6fbd22017-03-31 05:43:36 -070025 _moduleProcessThreadPtr(ProcessThread::Create("VoiceProcessThread")),
26 encoder_queue_("AudioEncoderQueue") {
niklase@google.com470e71d2011-07-07 08:21:25 +000027}
28
29SharedData::~SharedData()
30{
henrika@google.com73d65512011-09-07 15:11:18 +000031 if (_audioDevicePtr) {
32 _audioDevicePtr->Release();
niklase@google.com470e71d2011-07-07 08:21:25 +000033 }
tommi@webrtc.org0c3e12b2015-02-06 09:44:12 +000034 _moduleProcessThreadPtr->Stop();
niklase@google.com470e71d2011-07-07 08:21:25 +000035}
36
henrikaec6fbd22017-03-31 05:43:36 -070037rtc::TaskQueue* SharedData::encoder_queue() {
38 RTC_DCHECK_RUN_ON(&construction_thread_);
39 return &encoder_queue_;
40}
41
Peter Boström1d194412016-03-21 16:44:31 +010042void SharedData::set_audio_device(
43 const rtc::scoped_refptr<AudioDeviceModule>& audio_device) {
44 _audioDevicePtr = audio_device;
tommi@webrtc.org851becd2012-04-04 14:57:19 +000045}
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000046} // namespace voe
niklase@google.com470e71d2011-07-07 08:21:25 +000047
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000048} // namespace webrtc