| 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" | |
| 14 #include "webrtc/voice_engine/channel.h" | 13 #include "webrtc/voice_engine/channel.h" |
| 15 | 14 |
| 16 namespace webrtc { | 15 namespace webrtc { |
| 17 namespace voe { | 16 namespace voe { |
| 18 | 17 |
| 19 ChannelOwner::ChannelOwner(class Channel* channel) | 18 ChannelOwner::ChannelOwner(class Channel* channel) |
| 20 : channel_ref_(new ChannelRef(channel)) {} | 19 : channel_ref_(new ChannelRef(channel)) {} |
| 21 | 20 |
| 22 ChannelOwner::ChannelOwner(const ChannelOwner& channel_owner) | 21 ChannelOwner::ChannelOwner(const ChannelOwner& channel_owner) |
| 23 : channel_ref_(channel_owner.channel_ref_) { | 22 : channel_ref_(channel_owner.channel_ref_) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 38 | 37 |
| 39 channel_ref_ = other.channel_ref_; | 38 channel_ref_ = other.channel_ref_; |
| 40 ++channel_ref_->ref_count; | 39 ++channel_ref_->ref_count; |
| 41 | 40 |
| 42 return *this; | 41 return *this; |
| 43 } | 42 } |
| 44 | 43 |
| 45 ChannelOwner::ChannelRef::ChannelRef(class Channel* channel) | 44 ChannelOwner::ChannelRef::ChannelRef(class Channel* channel) |
| 46 : channel(channel), ref_count(1) {} | 45 : channel(channel), ref_count(1) {} |
| 47 | 46 |
| 48 ChannelManager::ChannelManager(uint32_t instance_id, const Config& config) | 47 ChannelManager::ChannelManager(uint32_t instance_id) |
| 49 : instance_id_(instance_id), last_channel_id_(-1), config_(config) {} | 48 : instance_id_(instance_id), last_channel_id_(-1) {} |
| 50 | 49 |
| 51 ChannelOwner ChannelManager::CreateChannel( | 50 ChannelOwner ChannelManager::CreateChannel( |
| 52 const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory) { | 51 const VoEBase::ChannelConfig& config) { |
| 53 return CreateChannelInternal(config_, decoder_factory); | |
| 54 } | |
| 55 | |
| 56 ChannelOwner ChannelManager::CreateChannel( | |
| 57 const Config& external_config, | |
| 58 const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory) { | |
| 59 return CreateChannelInternal(external_config, decoder_factory); | |
| 60 } | |
| 61 | |
| 62 ChannelOwner ChannelManager::CreateChannelInternal( | |
| 63 const Config& config, | |
| 64 const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory) { | |
| 65 Channel* channel; | 52 Channel* channel; |
| 66 Channel::CreateChannel(channel, ++last_channel_id_, instance_id_, config, | 53 Channel::CreateChannel(channel, ++last_channel_id_, instance_id_, config); |
| 67 decoder_factory); | |
| 68 ChannelOwner channel_owner(channel); | 54 ChannelOwner channel_owner(channel); |
| 69 | 55 |
| 70 rtc::CritScope crit(&lock_); | 56 rtc::CritScope crit(&lock_); |
| 71 | 57 |
| 72 channels_.push_back(channel_owner); | 58 channels_.push_back(channel_owner); |
| 73 | 59 |
| 74 return channel_owner; | 60 return channel_owner; |
| 75 } | 61 } |
| 76 | 62 |
| 77 ChannelOwner ChannelManager::GetChannel(int32_t channel_id) { | 63 ChannelOwner ChannelManager::GetChannel(int32_t channel_id) { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 bool ChannelManager::Iterator::IsValid() { | 131 bool ChannelManager::Iterator::IsValid() { |
| 146 return iterator_pos_ < channels_.size(); | 132 return iterator_pos_ < channels_.size(); |
| 147 } | 133 } |
| 148 | 134 |
| 149 void ChannelManager::Iterator::Increment() { | 135 void ChannelManager::Iterator::Increment() { |
| 150 ++iterator_pos_; | 136 ++iterator_pos_; |
| 151 } | 137 } |
| 152 | 138 |
| 153 } // namespace voe | 139 } // namespace voe |
| 154 } // namespace webrtc | 140 } // namespace webrtc |
| OLD | NEW |