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