webrtc_m130/pc/channel_manager.cc

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

400 lines
12 KiB
C++
Raw Normal View History

/*
* Copyright 2004 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "pc/channel_manager.h"
#include <utility>
#include "absl/algorithm/container.h"
#include "absl/memory/memory.h"
#include "absl/strings/match.h"
#include "media/base/media_constants.h"
#include "rtc_base/checks.h"
#include "rtc_base/location.h"
#include "rtc_base/logging.h"
#include "rtc_base/thread_checker.h"
#include "rtc_base/trace_event.h"
namespace cricket {
ChannelManager::ChannelManager(
std::unique_ptr<MediaEngineInterface> media_engine,
std::unique_ptr<DataEngineInterface> data_engine,
rtc::Thread* worker_thread,
rtc::Thread* network_thread)
: media_engine_(std::move(media_engine)),
data_engine_(std::move(data_engine)),
main_thread_(rtc::Thread::Current()),
worker_thread_(worker_thread),
network_thread_(network_thread) {
RTC_DCHECK(data_engine_);
RTC_DCHECK(worker_thread_);
RTC_DCHECK(network_thread_);
}
ChannelManager::~ChannelManager() {
if (initialized_) {
Terminate();
}
// The media engine needs to be deleted on the worker thread for thread safe
// destruction,
worker_thread_->Invoke<void>(RTC_FROM_HERE, [&] { media_engine_.reset(); });
}
bool ChannelManager::SetVideoRtxEnabled(bool enable) {
// To be safe, this call is only allowed before initialization. Apps like
// Flute only have a singleton ChannelManager and we don't want this flag to
// be toggled between calls or when there's concurrent calls. We expect apps
// to enable this at startup and retain that setting for the lifetime of the
// app.
if (!initialized_) {
enable_rtx_ = enable;
return true;
} else {
RTC_LOG(LS_WARNING) << "Cannot toggle rtx after initialization!";
return false;
}
}
void ChannelManager::GetSupportedAudioSendCodecs(
std::vector<AudioCodec>* codecs) const {
if (!media_engine_) {
return;
}
*codecs = media_engine_->voice().send_codecs();
}
void ChannelManager::GetSupportedAudioReceiveCodecs(
std::vector<AudioCodec>* codecs) const {
if (!media_engine_) {
return;
}
*codecs = media_engine_->voice().recv_codecs();
}
void ChannelManager::GetSupportedVideoSendCodecs(
std::vector<VideoCodec>* codecs) const {
if (!media_engine_) {
return;
}
codecs->clear();
std::vector<VideoCodec> video_codecs = media_engine_->video().send_codecs();
for (const auto& video_codec : video_codecs) {
if (!enable_rtx_ &&
absl::EqualsIgnoreCase(kRtxCodecName, video_codec.name)) {
continue;
}
codecs->push_back(video_codec);
}
}
void ChannelManager::GetSupportedVideoReceiveCodecs(
std::vector<VideoCodec>* codecs) const {
if (!media_engine_) {
return;
}
codecs->clear();
std::vector<VideoCodec> video_codecs = media_engine_->video().recv_codecs();
for (const auto& video_codec : video_codecs) {
if (!enable_rtx_ &&
absl::EqualsIgnoreCase(kRtxCodecName, video_codec.name)) {
continue;
}
codecs->push_back(video_codec);
}
}
void ChannelManager::GetSupportedDataCodecs(
std::vector<DataCodec>* codecs) const {
*codecs = data_engine_->data_codecs();
}
bool ChannelManager::Init() {
RTC_DCHECK(!initialized_);
if (initialized_) {
return false;
}
RTC_DCHECK(network_thread_);
RTC_DCHECK(worker_thread_);
if (!network_thread_->IsCurrent()) {
// Do not allow invoking calls to other threads on the network thread.
network_thread_->Invoke<void>(
RTC_FROM_HERE, [&] { network_thread_->DisallowBlockingCalls(); });
}
if (media_engine_) {
initialized_ = worker_thread_->Invoke<bool>(
RTC_FROM_HERE, [&] { return media_engine_->Init(); });
RTC_DCHECK(initialized_);
} else {
initialized_ = true;
}
return initialized_;
}
RtpHeaderExtensions ChannelManager::GetDefaultEnabledAudioRtpHeaderExtensions()
const {
if (!media_engine_)
return {};
return GetDefaultEnabledRtpHeaderExtensions(media_engine_->voice());
}
std::vector<webrtc::RtpHeaderExtensionCapability>
ChannelManager::GetSupportedAudioRtpHeaderExtensions() const {
if (!media_engine_)
return {};
return media_engine_->voice().GetRtpHeaderExtensions();
}
RtpHeaderExtensions ChannelManager::GetDefaultEnabledVideoRtpHeaderExtensions()
const {
if (!media_engine_)
return {};
return GetDefaultEnabledRtpHeaderExtensions(media_engine_->video());
}
std::vector<webrtc::RtpHeaderExtensionCapability>
ChannelManager::GetSupportedVideoRtpHeaderExtensions() const {
if (!media_engine_)
return {};
return media_engine_->video().GetRtpHeaderExtensions();
}
void ChannelManager::Terminate() {
RTC_DCHECK(initialized_);
if (!initialized_) {
return;
}
// Need to destroy the channels on the worker thread.
worker_thread_->Invoke<void>(RTC_FROM_HERE, [&] {
video_channels_.clear();
voice_channels_.clear();
data_channels_.clear();
});
initialized_ = false;
}
VoiceChannel* ChannelManager::CreateVoiceChannel(
webrtc::Call* call,
const cricket::MediaConfig& media_config,
webrtc::RtpTransportInternal* rtp_transport,
rtc::Thread* signaling_thread,
const std::string& content_name,
bool srtp_required,
Reland "Move CryptoOptions to api/crypto from rtc_base/sslstreamadapter.h" Promotes rtc::CryptoOptions to webrtc::CryptoOptions converting it from class that only handles SRTP configuration to a more generic structure that can be used and extended for all per peer connection CryptoOptions that can be on a given PeerConnection. Now all SRTP related options are under webrtc::CryptoOptions::Srtp and can be accessed as crypto_options.srtp.whatever_option_name. This is more inline with other structures we have in WebRTC such as VideoConfig. As additional features are added over time this will allow the structure to remain compartmentalized and concerned components can only request a subset of the overall configuration structure e.g: void MySrtpFunction(const webrtc::CryptoOptions::Srtp& srtp_config); In addition to this it made little sense for sslstreamadapter.h to hold all Srtp related configuration options. The header has become loo large and takes on too many responsibilities and spilting this up will lead to more maintainable code going forward. This will be used in a future CL to enable configuration options for the newly supported Frame Crypto. Reland Fix: - cryptooptions.h - now has enable_aes128_sha1_32_crypto_cipher as an optional root level configuration. - peerconnectionfactory - If this optional is set will now overwrite the underyling value. This along with the other field will be deprecated once dependent projects are updated. TBR=sakal@webrtc.org,kthelgason@webrtc.org,emadomara@webrtc.org,qingsi@webrtc.org Bug: webrtc:9681 Change-Id: Iaa6b741baafb85d352e42f54226119f19d97151d Reviewed-on: https://webrtc-review.googlesource.com/c/105560 Reviewed-by: Benjamin Wright <benwright@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Reviewed-by: Emad Omara <emadomara@webrtc.org> Commit-Queue: Benjamin Wright <benwright@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25135}
2018-10-11 15:33:17 -07:00
const webrtc::CryptoOptions& crypto_options,
rtc::UniqueRandomIdGenerator* ssrc_generator,
const AudioOptions& options) {
if (!worker_thread_->IsCurrent()) {
return worker_thread_->Invoke<VoiceChannel*>(RTC_FROM_HERE, [&] {
return CreateVoiceChannel(call, media_config, rtp_transport,
signaling_thread, content_name, srtp_required,
crypto_options, ssrc_generator, options);
});
}
RTC_DCHECK_RUN_ON(worker_thread_);
RTC_DCHECK(initialized_);
RTC_DCHECK(call);
if (!media_engine_) {
return nullptr;
}
VoiceMediaChannel* media_channel = media_engine_->voice().CreateMediaChannel(
call, media_config, options, crypto_options);
if (!media_channel) {
return nullptr;
}
Use std::make_unique instead of absl::make_unique. WebRTC is now using C++14 so there is no need to use the Abseil version of std::make_unique. This CL has been created with the following steps: git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \ uniq > /tmp/only_make_unique.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/only_make_unique.txt /tmp/memory.txt | \ xargs grep -l "absl/memory" > /tmp/add-memory.txt git grep -l "\babsl::make_unique\b" | \ xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g" git checkout PRESUBMIT.py abseil-in-webrtc.md cat /tmp/add-memory.txt | \ xargs sed -i \ 's/#include "absl\/memory\/memory.h"/#include <memory>/g' git cl format # Manual fix order of the new inserted #include <memory> cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \ xargs sed -i '/#include "absl\/memory\/memory.h"/d' git ls-files | grep BUILD.gn | \ xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d' python tools_webrtc/gn_check_autofix.py \ -m tryserver.webrtc -b linux_rel # Repead the gn_check_autofix step for other platforms git ls-files | grep BUILD.gn | \ xargs sed -i 's/absl\/memory:memory/absl\/memory/g' git cl format Bug: webrtc:10945 Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29209}
2019-09-17 17:06:18 +02:00
auto voice_channel = std::make_unique<VoiceChannel>(
worker_thread_, network_thread_, signaling_thread,
absl::WrapUnique(media_channel), content_name, srtp_required,
crypto_options, ssrc_generator);
voice_channel->Init_w(rtp_transport);
VoiceChannel* voice_channel_ptr = voice_channel.get();
voice_channels_.push_back(std::move(voice_channel));
return voice_channel_ptr;
}
void ChannelManager::DestroyVoiceChannel(VoiceChannel* voice_channel) {
TRACE_EVENT0("webrtc", "ChannelManager::DestroyVoiceChannel");
if (!voice_channel) {
return;
}
if (!worker_thread_->IsCurrent()) {
worker_thread_->Invoke<void>(RTC_FROM_HERE,
[&] { DestroyVoiceChannel(voice_channel); });
return;
}
RTC_DCHECK(initialized_);
auto it = absl::c_find_if(voice_channels_,
[&](const std::unique_ptr<VoiceChannel>& p) {
return p.get() == voice_channel;
});
RTC_DCHECK(it != voice_channels_.end());
if (it == voice_channels_.end()) {
return;
}
voice_channels_.erase(it);
}
VideoChannel* ChannelManager::CreateVideoChannel(
webrtc::Call* call,
const cricket::MediaConfig& media_config,
webrtc::RtpTransportInternal* rtp_transport,
rtc::Thread* signaling_thread,
const std::string& content_name,
bool srtp_required,
Reland "Move CryptoOptions to api/crypto from rtc_base/sslstreamadapter.h" Promotes rtc::CryptoOptions to webrtc::CryptoOptions converting it from class that only handles SRTP configuration to a more generic structure that can be used and extended for all per peer connection CryptoOptions that can be on a given PeerConnection. Now all SRTP related options are under webrtc::CryptoOptions::Srtp and can be accessed as crypto_options.srtp.whatever_option_name. This is more inline with other structures we have in WebRTC such as VideoConfig. As additional features are added over time this will allow the structure to remain compartmentalized and concerned components can only request a subset of the overall configuration structure e.g: void MySrtpFunction(const webrtc::CryptoOptions::Srtp& srtp_config); In addition to this it made little sense for sslstreamadapter.h to hold all Srtp related configuration options. The header has become loo large and takes on too many responsibilities and spilting this up will lead to more maintainable code going forward. This will be used in a future CL to enable configuration options for the newly supported Frame Crypto. Reland Fix: - cryptooptions.h - now has enable_aes128_sha1_32_crypto_cipher as an optional root level configuration. - peerconnectionfactory - If this optional is set will now overwrite the underyling value. This along with the other field will be deprecated once dependent projects are updated. TBR=sakal@webrtc.org,kthelgason@webrtc.org,emadomara@webrtc.org,qingsi@webrtc.org Bug: webrtc:9681 Change-Id: Iaa6b741baafb85d352e42f54226119f19d97151d Reviewed-on: https://webrtc-review.googlesource.com/c/105560 Reviewed-by: Benjamin Wright <benwright@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Reviewed-by: Emad Omara <emadomara@webrtc.org> Commit-Queue: Benjamin Wright <benwright@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25135}
2018-10-11 15:33:17 -07:00
const webrtc::CryptoOptions& crypto_options,
rtc::UniqueRandomIdGenerator* ssrc_generator,
const VideoOptions& options,
webrtc::VideoBitrateAllocatorFactory* video_bitrate_allocator_factory) {
if (!worker_thread_->IsCurrent()) {
return worker_thread_->Invoke<VideoChannel*>(RTC_FROM_HERE, [&] {
return CreateVideoChannel(call, media_config, rtp_transport,
signaling_thread, content_name, srtp_required,
crypto_options, ssrc_generator, options,
video_bitrate_allocator_factory);
});
}
RTC_DCHECK_RUN_ON(worker_thread_);
RTC_DCHECK(initialized_);
RTC_DCHECK(call);
if (!media_engine_) {
return nullptr;
}
VideoMediaChannel* media_channel = media_engine_->video().CreateMediaChannel(
call, media_config, options, crypto_options,
video_bitrate_allocator_factory);
if (!media_channel) {
return nullptr;
}
Use std::make_unique instead of absl::make_unique. WebRTC is now using C++14 so there is no need to use the Abseil version of std::make_unique. This CL has been created with the following steps: git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \ uniq > /tmp/only_make_unique.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/only_make_unique.txt /tmp/memory.txt | \ xargs grep -l "absl/memory" > /tmp/add-memory.txt git grep -l "\babsl::make_unique\b" | \ xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g" git checkout PRESUBMIT.py abseil-in-webrtc.md cat /tmp/add-memory.txt | \ xargs sed -i \ 's/#include "absl\/memory\/memory.h"/#include <memory>/g' git cl format # Manual fix order of the new inserted #include <memory> cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \ xargs sed -i '/#include "absl\/memory\/memory.h"/d' git ls-files | grep BUILD.gn | \ xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d' python tools_webrtc/gn_check_autofix.py \ -m tryserver.webrtc -b linux_rel # Repead the gn_check_autofix step for other platforms git ls-files | grep BUILD.gn | \ xargs sed -i 's/absl\/memory:memory/absl\/memory/g' git cl format Bug: webrtc:10945 Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29209}
2019-09-17 17:06:18 +02:00
auto video_channel = std::make_unique<VideoChannel>(
worker_thread_, network_thread_, signaling_thread,
absl::WrapUnique(media_channel), content_name, srtp_required,
crypto_options, ssrc_generator);
Reland "Reland "Propagate media transport to media channel."" This is a reland of da65ed2adcfa57ff3288ce01c1602c973fcab00d Original change's description: > Reland "Propagate media transport to media channel." > > This reverts commit 37cf2455a420124b341ad06ac27fa3c4dbd29d3c. > > Reason for revert: <INSERT REASONING HERE> > > Original change's description: > > Revert "Propagate media transport to media channel." > > > > This reverts commit 8c16f745ab92cb6d305283e87fa8a661ae500ce4. > > > > Reason for revert: Breaks downstream project > > > > Original change's description: > > > Propagate media transport to media channel. > > > > > > 1. Pass media transport factory to JSEP transport controller. > > > 2. Pass media transport to voice media channel. > > > 3. Add basic unit test that make sure if peer connection is created with media transport, it is propagated to voice media channel. > > > > > > Change-Id: Ie922db78ade0efd893e019cd2b4441a9947a2f71 > > > Bug: webrtc:9719 > > > Reviewed-on: https://webrtc-review.googlesource.com/c/105542 > > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > > Reviewed-by: Peter Slatala <psla@webrtc.org> > > > Commit-Queue: Anton Sukhanov <sukhanov@google.com> > > > Cr-Commit-Position: refs/heads/master@{#25152} > > > > TBR=steveanton@webrtc.org,nisse@webrtc.org,psla@webrtc.org,sukhanov@google.com > > > > # Not skipping CQ checks because original CL landed > 1 day ago. > > > > Bug: webrtc:9719 > > Change-Id: Ic78cdc142a2145682ad74eac8b72c71c50f0a5c1 > > Reviewed-on: https://webrtc-review.googlesource.com/c/105840 > > Reviewed-by: Oleh Prypin <oprypin@webrtc.org> > > Commit-Queue: Oleh Prypin <oprypin@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#25154} > > TBR=steveanton@webrtc.org,oprypin@webrtc.org,nisse@webrtc.org,sukhanov@webrtc.org,psla@webrtc.org,sukhanov@google.com > > Change-Id: I505ff3451eae81573531faef155ff35d7f894022 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:9719 > Reviewed-on: https://webrtc-review.googlesource.com/c/106500 > Reviewed-by: Anton Sukhanov <sukhanov@webrtc.org> > Commit-Queue: Anton Sukhanov <sukhanov@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#25220} Bug: webrtc:9719 Tbr: Steve Anton <steveanton@webrtc.org> Tbr: Niels Moller <nisse@webrtc.org> Change-Id: Ib45691ba8be9abb89ff8c6dac1861bdf59be4c8d Reviewed-on: https://webrtc-review.googlesource.com/c/106561 Commit-Queue: Anton Sukhanov <sukhanov@webrtc.org> Reviewed-by: Peter Slatala <psla@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25240}
2018-10-17 13:15:42 -07:00
video_channel->Init_w(rtp_transport);
VideoChannel* video_channel_ptr = video_channel.get();
video_channels_.push_back(std::move(video_channel));
return video_channel_ptr;
}
void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) {
TRACE_EVENT0("webrtc", "ChannelManager::DestroyVideoChannel");
if (!video_channel) {
return;
}
if (!worker_thread_->IsCurrent()) {
worker_thread_->Invoke<void>(RTC_FROM_HERE,
[&] { DestroyVideoChannel(video_channel); });
return;
}
RTC_DCHECK(initialized_);
auto it = absl::c_find_if(video_channels_,
[&](const std::unique_ptr<VideoChannel>& p) {
return p.get() == video_channel;
});
RTC_DCHECK(it != video_channels_.end());
if (it == video_channels_.end()) {
return;
}
video_channels_.erase(it);
}
RtpDataChannel* ChannelManager::CreateRtpDataChannel(
const cricket::MediaConfig& media_config,
webrtc::RtpTransportInternal* rtp_transport,
rtc::Thread* signaling_thread,
const std::string& content_name,
bool srtp_required,
const webrtc::CryptoOptions& crypto_options,
rtc::UniqueRandomIdGenerator* ssrc_generator) {
if (!worker_thread_->IsCurrent()) {
return worker_thread_->Invoke<RtpDataChannel*>(RTC_FROM_HERE, [&] {
return CreateRtpDataChannel(media_config, rtp_transport, signaling_thread,
content_name, srtp_required, crypto_options,
ssrc_generator);
});
}
// This is ok to alloc from a thread other than the worker thread.
RTC_DCHECK(initialized_);
DataMediaChannel* media_channel = data_engine_->CreateChannel(media_config);
if (!media_channel) {
RTC_LOG(LS_WARNING) << "Failed to create RTP data channel.";
return nullptr;
}
Use std::make_unique instead of absl::make_unique. WebRTC is now using C++14 so there is no need to use the Abseil version of std::make_unique. This CL has been created with the following steps: git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \ uniq > /tmp/only_make_unique.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/only_make_unique.txt /tmp/memory.txt | \ xargs grep -l "absl/memory" > /tmp/add-memory.txt git grep -l "\babsl::make_unique\b" | \ xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g" git checkout PRESUBMIT.py abseil-in-webrtc.md cat /tmp/add-memory.txt | \ xargs sed -i \ 's/#include "absl\/memory\/memory.h"/#include <memory>/g' git cl format # Manual fix order of the new inserted #include <memory> cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \ xargs sed -i '/#include "absl\/memory\/memory.h"/d' git ls-files | grep BUILD.gn | \ xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d' python tools_webrtc/gn_check_autofix.py \ -m tryserver.webrtc -b linux_rel # Repead the gn_check_autofix step for other platforms git ls-files | grep BUILD.gn | \ xargs sed -i 's/absl\/memory:memory/absl\/memory/g' git cl format Bug: webrtc:10945 Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29209}
2019-09-17 17:06:18 +02:00
auto data_channel = std::make_unique<RtpDataChannel>(
worker_thread_, network_thread_, signaling_thread,
absl::WrapUnique(media_channel), content_name, srtp_required,
crypto_options, ssrc_generator);
// Media Transports are not supported with Rtp Data Channel.
data_channel->Init_w(rtp_transport);
RtpDataChannel* data_channel_ptr = data_channel.get();
data_channels_.push_back(std::move(data_channel));
return data_channel_ptr;
}
void ChannelManager::DestroyRtpDataChannel(RtpDataChannel* data_channel) {
TRACE_EVENT0("webrtc", "ChannelManager::DestroyRtpDataChannel");
if (!data_channel) {
return;
}
if (!worker_thread_->IsCurrent()) {
worker_thread_->Invoke<void>(
RTC_FROM_HERE, [&] { return DestroyRtpDataChannel(data_channel); });
return;
}
RTC_DCHECK(initialized_);
auto it = absl::c_find_if(data_channels_,
[&](const std::unique_ptr<RtpDataChannel>& p) {
return p.get() == data_channel;
});
RTC_DCHECK(it != data_channels_.end());
if (it == data_channels_.end()) {
return;
}
Revert "Reland "Replace BundleFilter with RtpDemuxer in RtpTransport."" This reverts commit 27f3bf512827b483f9e0c67ce76362d83faa1950. Reason for revert: Broken internal project. Original change's description: > Reland "Replace BundleFilter with RtpDemuxer in RtpTransport." > > This reverts commit 97d5e5b32c77bf550f1d788454f2db10ac9fbb1c. > > Reason for revert: <INSERT REASONING HERE> > > Original change's description: > > Revert "Replace BundleFilter with RtpDemuxer in RtpTransport." > > > > This reverts commit ea8b62a3e74fe91cd6bf66304839cd5677880a4e. > > > > Reason for revert: Broke chromium tests. > > Original change's description: > > > Replace BundleFilter with RtpDemuxer in RtpTransport. > > > > > > BundleFilter is replaced by RtpDemuxer in RtpTransport for payload > > > type-based demuxing. RtpTransport will support MID-based demuxing later. > > > > > > Each BaseChannel has its own RTP demuxing criteria and when connecting > > > to the RtpTransport, BaseChannel will register itself as a demuxer sink. > > > > > > The inheritance model is changed. New inheritance chain: > > > DtlsSrtpTransport->SrtpTransport->RtpTranpsort > > > > > > NOTE: > > > When RTCP packets are received, Call::DeliverRtcp will be called for > > > multiple times (webrtc:9035) which is an existing issue. With this CL, > > > it will become more of a problem and should be fixed. > > > > > > Bug: webrtc:8587 > > > Change-Id: I1d8a00443bd4bcbacc56e5e19b7294205cdc38f0 > > > Reviewed-on: https://webrtc-review.googlesource.com/61360 > > > Commit-Queue: Zhi Huang <zhihuang@webrtc.org> > > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > > > Cr-Commit-Position: refs/heads/master@{#22613} > > > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,zhihuang@webrtc.org > > > > Change-Id: If245da9d1ce970ac8dab7f45015e9b268a5dbcbd > > No-Presubmit: true > > No-Tree-Checks: true > > No-Try: true > > Bug: webrtc:8587 > > Reviewed-on: https://webrtc-review.googlesource.com/64860 > > Reviewed-by: Zhi Huang <zhihuang@webrtc.org> > > Commit-Queue: Zhi Huang <zhihuang@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#22614} > > TBR=steveanton@webrtc.org,deadbeef@webrtc.org,zhihuang@webrtc.org > > Change-Id: I3c272588ab4388ecadc4edc6786d5195c701855f > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8587 > Reviewed-on: https://webrtc-review.googlesource.com/64862 > Commit-Queue: Zhi Huang <zhihuang@webrtc.org> > Reviewed-by: Zhi Huang <zhihuang@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#22615} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,zhihuang@webrtc.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: webrtc:8587 Change-Id: I694ce9a039ed52c5961cdc0cba57587bed4cbde4 Reviewed-on: https://webrtc-review.googlesource.com/65381 Reviewed-by: Zhi Huang <zhihuang@webrtc.org> Commit-Queue: Zhi Huang <zhihuang@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22665}
2018-03-29 00:08:03 +00:00
data_channels_.erase(it);
}
bool ChannelManager::StartAecDump(webrtc::FileWrapper file,
int64_t max_size_bytes) {
return worker_thread_->Invoke<bool>(RTC_FROM_HERE, [&] {
return media_engine_->voice().StartAecDump(std::move(file), max_size_bytes);
});
}
void ChannelManager::StopAecDump() {
worker_thread_->Invoke<void>(RTC_FROM_HERE,
[&] { media_engine_->voice().StopAecDump(); });
}
} // namespace cricket