| 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 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 channel_ref_ = other.channel_ref_; | 40 channel_ref_ = other.channel_ref_; |
| 41 ++channel_ref_->ref_count; | 41 ++channel_ref_->ref_count; |
| 42 | 42 |
| 43 return *this; | 43 return *this; |
| 44 } | 44 } |
| 45 | 45 |
| 46 ChannelOwner::ChannelRef::ChannelRef(class Channel* channel) | 46 ChannelOwner::ChannelRef::ChannelRef(class Channel* channel) |
| 47 : channel(channel), ref_count(1) {} | 47 : channel(channel), ref_count(1) {} |
| 48 | 48 |
| 49 ChannelManager::ChannelManager(uint32_t instance_id, const Config& config) | 49 ChannelManager::ChannelManager(uint32_t instance_id, const Config& config) |
| 50 : instance_id_(instance_id), | 50 : instance_id_(instance_id), last_channel_id_(-1), config_(config) {} |
| 51 last_channel_id_(-1), | |
| 52 config_(config), | |
| 53 event_log_(RtcEventLog::Create(Clock::GetRealTimeClock())) {} | |
| 54 | 51 |
| 55 ChannelOwner ChannelManager::CreateChannel() { | 52 ChannelOwner ChannelManager::CreateChannel() { |
| 56 return CreateChannel(CreateBuiltinAudioDecoderFactory()); | 53 return CreateChannel(CreateBuiltinAudioDecoderFactory()); |
| 57 } | 54 } |
| 58 | 55 |
| 59 ChannelOwner ChannelManager::CreateChannel(const Config& external_config) { | 56 ChannelOwner ChannelManager::CreateChannel(const Config& external_config) { |
| 60 return CreateChannel(external_config, CreateBuiltinAudioDecoderFactory()); | 57 return CreateChannel(external_config, CreateBuiltinAudioDecoderFactory()); |
| 61 } | 58 } |
| 62 | 59 |
| 63 ChannelOwner ChannelManager::CreateChannel( | 60 ChannelOwner ChannelManager::CreateChannel( |
| 64 const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory) { | 61 const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory) { |
| 65 return CreateChannelInternal(config_, decoder_factory); | 62 return CreateChannelInternal(config_, decoder_factory); |
| 66 } | 63 } |
| 67 | 64 |
| 68 ChannelOwner ChannelManager::CreateChannel( | 65 ChannelOwner ChannelManager::CreateChannel( |
| 69 const Config& external_config, | 66 const Config& external_config, |
| 70 const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory) { | 67 const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory) { |
| 71 return CreateChannelInternal(external_config, decoder_factory); | 68 return CreateChannelInternal(external_config, decoder_factory); |
| 72 } | 69 } |
| 73 | 70 |
| 74 ChannelOwner ChannelManager::CreateChannelInternal( | 71 ChannelOwner ChannelManager::CreateChannelInternal( |
| 75 const Config& config, | 72 const Config& config, |
| 76 const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory) { | 73 const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory) { |
| 77 Channel* channel; | 74 Channel* channel; |
| 78 Channel::CreateChannel(channel, ++last_channel_id_, instance_id_, | 75 Channel::CreateChannel(channel, ++last_channel_id_, instance_id_, config, |
| 79 event_log_.get(), config, decoder_factory); | 76 decoder_factory); |
| 80 ChannelOwner channel_owner(channel); | 77 ChannelOwner channel_owner(channel); |
| 81 | 78 |
| 82 rtc::CritScope crit(&lock_); | 79 rtc::CritScope crit(&lock_); |
| 83 | 80 |
| 84 channels_.push_back(channel_owner); | 81 channels_.push_back(channel_owner); |
| 85 | 82 |
| 86 return channel_owner; | 83 return channel_owner; |
| 87 } | 84 } |
| 88 | 85 |
| 89 ChannelOwner ChannelManager::GetChannel(int32_t channel_id) { | 86 ChannelOwner ChannelManager::GetChannel(int32_t channel_id) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 references = channels_; | 133 references = channels_; |
| 137 channels_.clear(); | 134 channels_.clear(); |
| 138 } | 135 } |
| 139 } | 136 } |
| 140 | 137 |
| 141 size_t ChannelManager::NumOfChannels() const { | 138 size_t ChannelManager::NumOfChannels() const { |
| 142 rtc::CritScope crit(&lock_); | 139 rtc::CritScope crit(&lock_); |
| 143 return channels_.size(); | 140 return channels_.size(); |
| 144 } | 141 } |
| 145 | 142 |
| 146 RtcEventLog* ChannelManager::GetEventLog() const { | |
| 147 return event_log_.get(); | |
| 148 } | |
| 149 | |
| 150 ChannelManager::Iterator::Iterator(ChannelManager* channel_manager) | 143 ChannelManager::Iterator::Iterator(ChannelManager* channel_manager) |
| 151 : iterator_pos_(0) { | 144 : iterator_pos_(0) { |
| 152 channel_manager->GetAllChannels(&channels_); | 145 channel_manager->GetAllChannels(&channels_); |
| 153 } | 146 } |
| 154 | 147 |
| 155 Channel* ChannelManager::Iterator::GetChannel() { | 148 Channel* ChannelManager::Iterator::GetChannel() { |
| 156 if (iterator_pos_ < channels_.size()) | 149 if (iterator_pos_ < channels_.size()) |
| 157 return channels_[iterator_pos_].channel(); | 150 return channels_[iterator_pos_].channel(); |
| 158 return NULL; | 151 return NULL; |
| 159 } | 152 } |
| 160 | 153 |
| 161 bool ChannelManager::Iterator::IsValid() { | 154 bool ChannelManager::Iterator::IsValid() { |
| 162 return iterator_pos_ < channels_.size(); | 155 return iterator_pos_ < channels_.size(); |
| 163 } | 156 } |
| 164 | 157 |
| 165 void ChannelManager::Iterator::Increment() { | 158 void ChannelManager::Iterator::Increment() { |
| 166 ++iterator_pos_; | 159 ++iterator_pos_; |
| 167 } | 160 } |
| 168 | 161 |
| 169 } // namespace voe | 162 } // namespace voe |
| 170 } // namespace webrtc | 163 } // namespace webrtc |
| OLD | NEW |