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 #ifndef WEBRTC_VOICE_ENGINE_CHANNEL_MANAGER_H | 11 #ifndef WEBRTC_VOICE_ENGINE_CHANNEL_MANAGER_H |
12 #define WEBRTC_VOICE_ENGINE_CHANNEL_MANAGER_H | 12 #define WEBRTC_VOICE_ENGINE_CHANNEL_MANAGER_H |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "webrtc/base/constructormagic.h" | 17 #include "webrtc/base/constructormagic.h" |
18 #include "webrtc/base/criticalsection.h" | 18 #include "webrtc/base/criticalsection.h" |
| 19 #include "webrtc/base/scoped_ref_ptr.h" |
19 #include "webrtc/call/rtc_event_log.h" | 20 #include "webrtc/call/rtc_event_log.h" |
20 #include "webrtc/system_wrappers/include/atomic32.h" | 21 #include "webrtc/system_wrappers/include/atomic32.h" |
21 #include "webrtc/typedefs.h" | 22 #include "webrtc/typedefs.h" |
22 | 23 |
23 namespace webrtc { | 24 namespace webrtc { |
24 | 25 |
25 class Config; | 26 class Config; |
| 27 class AudioDecoderFactory; |
26 | 28 |
27 namespace voe { | 29 namespace voe { |
28 | 30 |
29 class Channel; | 31 class Channel; |
30 | 32 |
31 // Shared-pointer implementation for keeping track of Channels. The underlying | 33 // Shared-pointer implementation for keeping track of Channels. The underlying |
32 // shared instance will be dropped when no more ChannelOwners point to it. | 34 // shared instance will be dropped when no more ChannelOwners point to it. |
33 // | 35 // |
34 // One common source of ChannelOwner instances are | 36 // One common source of ChannelOwner instances are |
35 // ChannelManager::CreateChannel() and ChannelManager::GetChannel(...). | 37 // ChannelManager::CreateChannel() and ChannelManager::GetChannel(...). |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 RTC_DISALLOW_COPY_AND_ASSIGN(Iterator); | 96 RTC_DISALLOW_COPY_AND_ASSIGN(Iterator); |
95 }; | 97 }; |
96 | 98 |
97 // CreateChannel will always return a valid ChannelOwner instance. The channel | 99 // CreateChannel will always return a valid ChannelOwner instance. The channel |
98 // is created either based on internal configuration, i.e. |config_|, by | 100 // is created either based on internal configuration, i.e. |config_|, by |
99 // calling CreateChannel(), or using and external configuration | 101 // calling CreateChannel(), or using and external configuration |
100 // |external_config| if the overloaded method | 102 // |external_config| if the overloaded method |
101 // CreateChannel(const Config& external_config) is called. | 103 // CreateChannel(const Config& external_config) is called. |
102 ChannelOwner CreateChannel(); | 104 ChannelOwner CreateChannel(); |
103 ChannelOwner CreateChannel(const Config& external_config); | 105 ChannelOwner CreateChannel(const Config& external_config); |
| 106 ChannelOwner CreateChannel( |
| 107 const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory); |
| 108 ChannelOwner CreateChannel( |
| 109 const Config& external_config, |
| 110 const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory); |
104 | 111 |
105 // ChannelOwner.channel() will be NULL if channel_id is invalid or no longer | 112 // ChannelOwner.channel() will be NULL if channel_id is invalid or no longer |
106 // exists. This should be checked with ChannelOwner::IsValid(). | 113 // exists. This should be checked with ChannelOwner::IsValid(). |
107 ChannelOwner GetChannel(int32_t channel_id); | 114 ChannelOwner GetChannel(int32_t channel_id); |
108 void GetAllChannels(std::vector<ChannelOwner>* channels); | 115 void GetAllChannels(std::vector<ChannelOwner>* channels); |
109 | 116 |
110 void DestroyChannel(int32_t channel_id); | 117 void DestroyChannel(int32_t channel_id); |
111 void DestroyAllChannels(); | 118 void DestroyAllChannels(); |
112 | 119 |
113 size_t NumOfChannels() const; | 120 size_t NumOfChannels() const; |
114 | 121 |
115 // Returns a pointer to the event log object stored within the ChannelManager. | 122 // Returns a pointer to the event log object stored within the ChannelManager. |
116 RtcEventLog* GetEventLog() const; | 123 RtcEventLog* GetEventLog() const; |
117 | 124 |
118 private: | 125 private: |
119 // Create a channel given a configuration, |config|. | 126 // Create a channel given a configuration, |config|. |
120 ChannelOwner CreateChannelInternal(const Config& config); | 127 ChannelOwner CreateChannelInternal( |
| 128 const Config& config, |
| 129 const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory); |
121 | 130 |
122 uint32_t instance_id_; | 131 uint32_t instance_id_; |
123 | 132 |
124 Atomic32 last_channel_id_; | 133 Atomic32 last_channel_id_; |
125 | 134 |
126 rtc::CriticalSection lock_; | 135 rtc::CriticalSection lock_; |
127 std::vector<ChannelOwner> channels_; | 136 std::vector<ChannelOwner> channels_; |
128 | 137 |
129 const Config& config_; | 138 const Config& config_; |
130 std::unique_ptr<RtcEventLog> event_log_; | 139 std::unique_ptr<RtcEventLog> event_log_; |
131 | 140 |
132 RTC_DISALLOW_COPY_AND_ASSIGN(ChannelManager); | 141 RTC_DISALLOW_COPY_AND_ASSIGN(ChannelManager); |
133 }; | 142 }; |
134 } // namespace voe | 143 } // namespace voe |
135 } // namespace webrtc | 144 } // namespace webrtc |
136 | 145 |
137 #endif // WEBRTC_VOICE_ENGINE_CHANNEL_MANAGER_H | 146 #endif // WEBRTC_VOICE_ENGINE_CHANNEL_MANAGER_H |
OLD | NEW |