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

Unified Diff: webrtc/voice_engine/channel.cc

Issue 1949533002: WIP: Move the creation of AudioCodecFactory into PeerConnectionFactory. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Retained Channel API by adding overloads; also add intended AudioReceiveStream API 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/voice_engine/channel.cc
diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc
index a6c0c8d050538c45774ddee0883e6dad4a72450e..89bc03d526848acc2625da1f05af6961749121f5 100644
--- a/webrtc/voice_engine/channel.cc
+++ b/webrtc/voice_engine/channel.cc
@@ -21,6 +21,7 @@
#include "webrtc/base/timeutils.h"
#include "webrtc/common.h"
#include "webrtc/config.h"
+#include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h"
#include "webrtc/modules/audio_device/include/audio_device.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h"
#include "webrtc/modules/include/module_common_types.h"
@@ -659,11 +660,23 @@ int32_t Channel::CreateChannel(Channel*& channel,
uint32_t instanceId,
RtcEventLog* const event_log,
const Config& config) {
+ return CreateChannel(channel, channelId, instanceId, event_log, config,
+ CreateBuiltinAudioDecoderFactory());
+}
+
+int32_t Channel::CreateChannel(
+ Channel*& channel,
+ int32_t channelId,
+ uint32_t instanceId,
+ RtcEventLog* const event_log,
+ const Config& config,
+ std::shared_ptr<AudioDecoderFactory> decoder_factory) {
WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(instanceId, channelId),
"Channel::CreateChannel(channelId=%d, instanceId=%d)", channelId,
instanceId);
- channel = new Channel(channelId, instanceId, event_log, config);
+ channel = new Channel(channelId, instanceId, event_log, config,
+ std::move(decoder_factory));
if (channel == NULL) {
WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(instanceId, channelId),
"Channel::CreateChannel() unable to allocate memory for"
@@ -723,7 +736,8 @@ void Channel::RecordFileEnded(int32_t id) {
Channel::Channel(int32_t channelId,
uint32_t instanceId,
RtcEventLog* const event_log,
- const Config& config)
+ const Config& config,
+ std::shared_ptr<AudioDecoderFactory> decoder_factory)
: _instanceId(instanceId),
_channelId(channelId),
event_log_(event_log),
@@ -798,7 +812,8 @@ Channel::Channel(int32_t channelId,
pacing_enabled_(config.Get<VoicePacing>().enabled),
feedback_observer_proxy_(new TransportFeedbackProxy()),
seq_num_allocator_proxy_(new TransportSequenceNumberProxy()),
- rtp_packet_sender_proxy_(new RtpPacketSenderProxy()) {
+ rtp_packet_sender_proxy_(new RtpPacketSenderProxy()),
+ decoder_factory_(decoder_factory) {
WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId, _channelId),
"Channel::Channel() - ctor");
AudioCodingModule::Config acm_config;
@@ -811,6 +826,7 @@ Channel::Channel(int32_t channelId,
}
acm_config.neteq_config.enable_fast_accelerate =
config.Get<NetEqFastAccelerate>().enabled;
+ acm_config.decoder_factory = std::move(decoder_factory);
audio_coding_.reset(AudioCodingModule::Create(acm_config));
_outputAudioLevel.Clear();
@@ -1052,6 +1068,10 @@ void Channel::SetSink(std::unique_ptr<AudioSinkInterface> sink) {
audio_sink_ = std::move(sink);
}
+const std::shared_ptr<AudioDecoderFactory>&
+Channel::GetAudioDecoderFactory() const {
+ return decoder_factory_;
+}
int32_t Channel::StartPlayout() {
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId),
"Channel::StartPlayout()");

Powered by Google App Engine
This is Rietveld 408576698