Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: webrtc/voice_engine/channel_manager.cc

Issue 2665693002: Moves channel-dependent audio input processing to separate encoder task queue (Closed)
Patch Set: nit Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/base/timeutils.h"
14 #include "webrtc/voice_engine/channel.h" 14 #include "webrtc/voice_engine/channel.h"
15 #include "webrtc/base/logging.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_) {
24 ++channel_ref_->ref_count; 25 ++channel_ref_->ref_count;
(...skipping 20 matching lines...) Expand all
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) 49 ChannelManager::ChannelManager(uint32_t instance_id)
49 : instance_id_(instance_id), 50 : instance_id_(instance_id),
50 last_channel_id_(-1), 51 last_channel_id_(-1),
51 random_(rtc::TimeNanos()) {} 52 random_(rtc::TimeNanos()) {}
52 53
53 ChannelOwner ChannelManager::CreateChannel( 54 ChannelOwner ChannelManager::CreateChannel(
54 const VoEBase::ChannelConfig& config) { 55 const VoEBase::ChannelConfig& config) {
56 LOG(INFO) << "___CreateChannel";
55 Channel* channel; 57 Channel* channel;
56 Channel::CreateChannel(channel, ++last_channel_id_, instance_id_, config); 58 Channel::CreateChannel(channel, ++last_channel_id_, instance_id_, config);
57 // TODO(solenberg): Delete this, users should configure ssrc 59 // TODO(solenberg): Delete this, users should configure ssrc
58 // explicitly. 60 // explicitly.
59 channel->SetLocalSSRC(random_.Rand<uint32_t>()); 61 channel->SetLocalSSRC(random_.Rand<uint32_t>());
60 62
61 ChannelOwner channel_owner(channel); 63 ChannelOwner channel_owner(channel);
62 64
63 rtc::CritScope crit(&lock_); 65 rtc::CritScope crit(&lock_);
64 66
(...skipping 12 matching lines...) Expand all
77 return ChannelOwner(NULL); 79 return ChannelOwner(NULL);
78 } 80 }
79 81
80 void ChannelManager::GetAllChannels(std::vector<ChannelOwner>* channels) { 82 void ChannelManager::GetAllChannels(std::vector<ChannelOwner>* channels) {
81 rtc::CritScope crit(&lock_); 83 rtc::CritScope crit(&lock_);
82 84
83 *channels = channels_; 85 *channels = channels_;
84 } 86 }
85 87
86 void ChannelManager::DestroyChannel(int32_t channel_id) { 88 void ChannelManager::DestroyChannel(int32_t channel_id) {
89 LOG(INFO) << "___DestroyChannel: " << channel_id;
87 assert(channel_id >= 0); 90 assert(channel_id >= 0);
88 // Holds a reference to a channel, this is used so that we never delete 91 // Holds a reference to a channel, this is used so that we never delete
89 // Channels while holding a lock, but rather when the method returns. 92 // Channels while holding a lock, but rather when the method returns.
90 ChannelOwner reference(NULL); 93 ChannelOwner reference(NULL);
91 { 94 {
92 rtc::CritScope crit(&lock_); 95 rtc::CritScope crit(&lock_);
93 std::vector<ChannelOwner>::iterator to_delete = channels_.end(); 96 std::vector<ChannelOwner>::iterator to_delete = channels_.end();
94 for (auto it = channels_.begin(); it != channels_.end(); ++it) { 97 for (auto it = channels_.begin(); it != channels_.end(); ++it) {
95 Channel* channel = it->channel(); 98 Channel* channel = it->channel();
96 // For channels associated with the channel to be deleted, disassociate 99 // For channels associated with the channel to be deleted, disassociate
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 bool ChannelManager::Iterator::IsValid() { 151 bool ChannelManager::Iterator::IsValid() {
149 return iterator_pos_ < channels_.size(); 152 return iterator_pos_ < channels_.size();
150 } 153 }
151 154
152 void ChannelManager::Iterator::Increment() { 155 void ChannelManager::Iterator::Increment() {
153 ++iterator_pos_; 156 ++iterator_pos_;
154 } 157 }
155 158
156 } // namespace voe 159 } // namespace voe
157 } // namespace webrtc 160 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698