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/base/timeutils.h" |
13 #include "webrtc/voice_engine/channel.h" | 14 #include "webrtc/voice_engine/channel.h" |
14 | 15 |
15 namespace webrtc { | 16 namespace webrtc { |
16 namespace voe { | 17 namespace voe { |
17 | 18 |
18 ChannelOwner::ChannelOwner(class Channel* channel) | 19 ChannelOwner::ChannelOwner(class Channel* channel) |
19 : channel_ref_(new ChannelRef(channel)) {} | 20 : channel_ref_(new ChannelRef(channel)) {} |
20 | 21 |
21 ChannelOwner::ChannelOwner(const ChannelOwner& channel_owner) | 22 ChannelOwner::ChannelOwner(const ChannelOwner& channel_owner) |
22 : channel_ref_(channel_owner.channel_ref_) { | 23 : channel_ref_(channel_owner.channel_ref_) { |
(...skipping 15 matching lines...) Expand all Loading... |
38 channel_ref_ = other.channel_ref_; | 39 channel_ref_ = other.channel_ref_; |
39 ++channel_ref_->ref_count; | 40 ++channel_ref_->ref_count; |
40 | 41 |
41 return *this; | 42 return *this; |
42 } | 43 } |
43 | 44 |
44 ChannelOwner::ChannelRef::ChannelRef(class Channel* channel) | 45 ChannelOwner::ChannelRef::ChannelRef(class Channel* channel) |
45 : channel(channel), ref_count(1) {} | 46 : channel(channel), ref_count(1) {} |
46 | 47 |
47 ChannelManager::ChannelManager(uint32_t instance_id) | 48 ChannelManager::ChannelManager(uint32_t instance_id) |
48 : instance_id_(instance_id), last_channel_id_(-1) {} | 49 : instance_id_(instance_id), |
| 50 last_channel_id_(-1), |
| 51 random_(rtc::TimeNanos()) {} |
49 | 52 |
50 ChannelOwner ChannelManager::CreateChannel( | 53 ChannelOwner ChannelManager::CreateChannel( |
51 const VoEBase::ChannelConfig& config) { | 54 const VoEBase::ChannelConfig& config) { |
52 Channel* channel; | 55 Channel* channel; |
53 Channel::CreateChannel(channel, ++last_channel_id_, instance_id_, config); | 56 Channel::CreateChannel(channel, ++last_channel_id_, instance_id_, config); |
| 57 // TODO(solenberg): Delete this, users should configure ssrc |
| 58 // explicitly. |
| 59 channel->SetLocalSSRC(random_.Rand<uint32_t>()); |
| 60 |
54 ChannelOwner channel_owner(channel); | 61 ChannelOwner channel_owner(channel); |
55 | 62 |
56 rtc::CritScope crit(&lock_); | 63 rtc::CritScope crit(&lock_); |
57 | 64 |
58 channels_.push_back(channel_owner); | 65 channels_.push_back(channel_owner); |
59 | 66 |
60 return channel_owner; | 67 return channel_owner; |
61 } | 68 } |
62 | 69 |
63 ChannelOwner ChannelManager::GetChannel(int32_t channel_id) { | 70 ChannelOwner ChannelManager::GetChannel(int32_t channel_id) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 bool ChannelManager::Iterator::IsValid() { | 138 bool ChannelManager::Iterator::IsValid() { |
132 return iterator_pos_ < channels_.size(); | 139 return iterator_pos_ < channels_.size(); |
133 } | 140 } |
134 | 141 |
135 void ChannelManager::Iterator::Increment() { | 142 void ChannelManager::Iterator::Increment() { |
136 ++iterator_pos_; | 143 ++iterator_pos_; |
137 } | 144 } |
138 | 145 |
139 } // namespace voe | 146 } // namespace voe |
140 } // namespace webrtc | 147 } // namespace webrtc |
OLD | NEW |