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

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

Issue 1949533002: WIP: Move the creation of AudioCodecFactory into PeerConnectionFactory. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 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 #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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 std::vector<ChannelOwner> channels_; 93 std::vector<ChannelOwner> channels_;
93 94
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 std::shared_ptr<AudioDecoderFactory> decoder_factory);
105 ChannelOwner CreateChannel(
106 const Config& external_config,
107 std::shared_ptr<AudioDecoderFactory> decoder_factory);
104 108
105 // ChannelOwner.channel() will be NULL if channel_id is invalid or no longer 109 // ChannelOwner.channel() will be NULL if channel_id is invalid or no longer
106 // exists. This should be checked with ChannelOwner::IsValid(). 110 // exists. This should be checked with ChannelOwner::IsValid().
107 ChannelOwner GetChannel(int32_t channel_id); 111 ChannelOwner GetChannel(int32_t channel_id);
108 void GetAllChannels(std::vector<ChannelOwner>* channels); 112 void GetAllChannels(std::vector<ChannelOwner>* channels);
109 113
110 void DestroyChannel(int32_t channel_id); 114 void DestroyChannel(int32_t channel_id);
111 void DestroyAllChannels(); 115 void DestroyAllChannels();
112 116
113 size_t NumOfChannels() const; 117 size_t NumOfChannels() const;
114 118
115 // Returns a pointer to the event log object stored within the ChannelManager. 119 // Returns a pointer to the event log object stored within the ChannelManager.
116 RtcEventLog* GetEventLog() const; 120 RtcEventLog* GetEventLog() const;
117 121
118 private: 122 private:
119 // Create a channel given a configuration, |config|. 123 // Create a channel given a configuration, |config|.
120 ChannelOwner CreateChannelInternal(const Config& config); 124 ChannelOwner CreateChannelInternal(
125 const Config& config,
126 std::shared_ptr<AudioDecoderFactory> decoder_factory);
121 127
122 uint32_t instance_id_; 128 uint32_t instance_id_;
123 129
124 Atomic32 last_channel_id_; 130 Atomic32 last_channel_id_;
125 131
126 rtc::CriticalSection lock_; 132 rtc::CriticalSection lock_;
127 std::vector<ChannelOwner> channels_; 133 std::vector<ChannelOwner> channels_;
128 134
129 const Config& config_; 135 const Config& config_;
130 std::unique_ptr<RtcEventLog> event_log_; 136 std::unique_ptr<RtcEventLog> event_log_;
131 137
132 RTC_DISALLOW_COPY_AND_ASSIGN(ChannelManager); 138 RTC_DISALLOW_COPY_AND_ASSIGN(ChannelManager);
133 }; 139 };
134 } // namespace voe 140 } // namespace voe
135 } // namespace webrtc 141 } // namespace webrtc
136 142
137 #endif // WEBRTC_VOICE_ENGINE_CHANNEL_MANAGER_H 143 #endif // WEBRTC_VOICE_ENGINE_CHANNEL_MANAGER_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698