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