| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2  *  Copyright (c) 2011 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/channel_manager.h" | 11 #include "webrtc/voice_engine/channel_manager.h" | 
| 12 | 12 | 
| 13 #include "webrtc/common.h" | 13 #include "webrtc/common.h" | 
|  | 14 #include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h" | 
| 14 #include "webrtc/voice_engine/channel.h" | 15 #include "webrtc/voice_engine/channel.h" | 
| 15 | 16 | 
| 16 namespace webrtc { | 17 namespace webrtc { | 
| 17 namespace voe { | 18 namespace voe { | 
| 18 | 19 | 
| 19 ChannelOwner::ChannelOwner(class Channel* channel) | 20 ChannelOwner::ChannelOwner(class Channel* channel) | 
| 20     : channel_ref_(new ChannelRef(channel)) {} | 21     : channel_ref_(new ChannelRef(channel)) {} | 
| 21 | 22 | 
| 22 ChannelOwner::ChannelOwner(const ChannelOwner& channel_owner) | 23 ChannelOwner::ChannelOwner(const ChannelOwner& channel_owner) | 
| 23     : channel_ref_(channel_owner.channel_ref_) { | 24     : channel_ref_(channel_owner.channel_ref_) { | 
| (...skipping 21 matching lines...) Expand all  Loading... | 
| 45 ChannelOwner::ChannelRef::ChannelRef(class Channel* channel) | 46 ChannelOwner::ChannelRef::ChannelRef(class Channel* channel) | 
| 46     : channel(channel), ref_count(1) {} | 47     : channel(channel), ref_count(1) {} | 
| 47 | 48 | 
| 48 ChannelManager::ChannelManager(uint32_t instance_id, const Config& config) | 49 ChannelManager::ChannelManager(uint32_t instance_id, const Config& config) | 
| 49     : instance_id_(instance_id), | 50     : instance_id_(instance_id), | 
| 50       last_channel_id_(-1), | 51       last_channel_id_(-1), | 
| 51       config_(config), | 52       config_(config), | 
| 52       event_log_(RtcEventLog::Create(Clock::GetRealTimeClock())) {} | 53       event_log_(RtcEventLog::Create(Clock::GetRealTimeClock())) {} | 
| 53 | 54 | 
| 54 ChannelOwner ChannelManager::CreateChannel() { | 55 ChannelOwner ChannelManager::CreateChannel() { | 
| 55   return CreateChannelInternal(config_); | 56   return CreateChannel(CreateBuiltinAudioDecoderFactory()); | 
| 56 } | 57 } | 
| 57 | 58 | 
| 58 ChannelOwner ChannelManager::CreateChannel(const Config& external_config) { | 59 ChannelOwner ChannelManager::CreateChannel(const Config& external_config) { | 
| 59   return CreateChannelInternal(external_config); | 60   return CreateChannel(external_config, CreateBuiltinAudioDecoderFactory()); | 
| 60 } | 61 } | 
| 61 | 62 | 
| 62 ChannelOwner ChannelManager::CreateChannelInternal(const Config& config) { | 63 ChannelOwner ChannelManager::CreateChannel( | 
|  | 64     const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory) { | 
|  | 65   return CreateChannelInternal(config_, decoder_factory); | 
|  | 66 } | 
|  | 67 | 
|  | 68 ChannelOwner ChannelManager::CreateChannel( | 
|  | 69     const Config& external_config, | 
|  | 70     const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory) { | 
|  | 71   return CreateChannelInternal(external_config, decoder_factory); | 
|  | 72 } | 
|  | 73 | 
|  | 74 ChannelOwner ChannelManager::CreateChannelInternal( | 
|  | 75     const Config& config, | 
|  | 76     const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory) { | 
| 63   Channel* channel; | 77   Channel* channel; | 
| 64   Channel::CreateChannel(channel, ++last_channel_id_, instance_id_, | 78   Channel::CreateChannel(channel, ++last_channel_id_, instance_id_, | 
| 65                          event_log_.get(), config); | 79                          event_log_.get(), config, decoder_factory); | 
| 66   ChannelOwner channel_owner(channel); | 80   ChannelOwner channel_owner(channel); | 
| 67 | 81 | 
| 68   rtc::CritScope crit(&lock_); | 82   rtc::CritScope crit(&lock_); | 
| 69 | 83 | 
| 70   channels_.push_back(channel_owner); | 84   channels_.push_back(channel_owner); | 
| 71 | 85 | 
| 72   return channel_owner; | 86   return channel_owner; | 
| 73 } | 87 } | 
| 74 | 88 | 
| 75 ChannelOwner ChannelManager::GetChannel(int32_t channel_id) { | 89 ChannelOwner ChannelManager::GetChannel(int32_t channel_id) { | 
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 147 bool ChannelManager::Iterator::IsValid() { | 161 bool ChannelManager::Iterator::IsValid() { | 
| 148   return iterator_pos_ < channels_.size(); | 162   return iterator_pos_ < channels_.size(); | 
| 149 } | 163 } | 
| 150 | 164 | 
| 151 void ChannelManager::Iterator::Increment() { | 165 void ChannelManager::Iterator::Increment() { | 
| 152   ++iterator_pos_; | 166   ++iterator_pos_; | 
| 153 } | 167 } | 
| 154 | 168 | 
| 155 }  // namespace voe | 169 }  // namespace voe | 
| 156 }  // namespace webrtc | 170 }  // namespace webrtc | 
| OLD | NEW | 
|---|