2013-05-16 12:08:03 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2013 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "call/call.h"
|
2019-07-05 19:08:33 +02:00
|
|
|
|
2013-08-05 16:22:53 +00:00
|
|
|
#include <string.h>
|
2019-07-05 19:08:33 +02:00
|
|
|
|
2016-06-09 17:21:19 +02:00
|
|
|
#include <algorithm>
|
2013-05-16 12:08:03 +00:00
|
|
|
#include <map>
|
2016-03-12 06:10:44 -08:00
|
|
|
#include <memory>
|
2016-12-07 04:52:58 -08:00
|
|
|
#include <set>
|
2016-10-23 23:37:14 -07:00
|
|
|
#include <utility>
|
2013-05-16 12:08:03 +00:00
|
|
|
#include <vector>
|
|
|
|
|
|
Use absl::make_unique and absl::WrapUnique directly
Instead of going through our wrappers in ptr_util.h.
This CL was generated by the following script:
git grep -l ptr_util | xargs perl -pi -e 's,#include "rtc_base/ptr_util.h",#include "absl/memory/memory.h",'
git grep -l MakeUnique | xargs perl -pi -e 's,\b(rtc::)?MakeUnique\b,absl::make_unique,g'
git grep -l WrapUnique | xargs perl -pi -e 's,\b(rtc::)?WrapUnique\b,absl::WrapUnique,g'
git checkout -- rtc_base/ptr_util{.h,_unittest.cc}
git cl format
Followed by manually adding dependencies on
//third_party/abseil-cpp/absl/memory until `gn check` stopped
complaining.
Bug: webrtc:9473
Change-Id: I89ccd363f070479b8c431eb2c3d404a46eaacc1c
Reviewed-on: https://webrtc-review.googlesource.com/86600
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23850}
2018-07-05 11:40:33 +02:00
|
|
|
#include "absl/memory/memory.h"
|
2018-06-15 12:28:07 +02:00
|
|
|
#include "absl/types/optional.h"
|
2019-08-07 12:24:53 +02:00
|
|
|
#include "api/rtc_event_log/rtc_event_log.h"
|
2018-05-09 10:33:39 +02:00
|
|
|
#include "api/transport/network_control.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "audio/audio_receive_stream.h"
|
|
|
|
|
#include "audio/audio_send_stream.h"
|
|
|
|
|
#include "audio/audio_state.h"
|
|
|
|
|
#include "call/bitrate_allocator.h"
|
|
|
|
|
#include "call/flexfec_receive_stream_impl.h"
|
2018-03-21 14:38:32 +01:00
|
|
|
#include "call/receive_time_calculator.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "call/rtp_stream_receiver_controller.h"
|
|
|
|
|
#include "call/rtp_transport_controller_send.h"
|
2017-10-03 16:11:34 +02:00
|
|
|
#include "logging/rtc_event_log/events/rtc_event_audio_receive_stream_config.h"
|
|
|
|
|
#include "logging/rtc_event_log/events/rtc_event_rtcp_packet_incoming.h"
|
|
|
|
|
#include "logging/rtc_event_log/events/rtc_event_rtp_packet_incoming.h"
|
|
|
|
|
#include "logging/rtc_event_log/events/rtc_event_video_receive_stream_config.h"
|
|
|
|
|
#include "logging/rtc_event_log/events/rtc_event_video_send_stream_config.h"
|
2017-09-21 10:25:29 +02:00
|
|
|
#include "logging/rtc_event_log/rtc_stream_config.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "modules/congestion_controller/include/receive_side_congestion_controller.h"
|
|
|
|
|
#include "modules/rtp_rtcp/include/flexfec_receiver.h"
|
|
|
|
|
#include "modules/rtp_rtcp/include/rtp_header_extension_map.h"
|
|
|
|
|
#include "modules/rtp_rtcp/include/rtp_header_parser.h"
|
|
|
|
|
#include "modules/rtp_rtcp/source/byte_io.h"
|
|
|
|
|
#include "modules/rtp_rtcp/source/rtp_packet_received.h"
|
|
|
|
|
#include "modules/utility/include/process_thread.h"
|
2018-01-19 17:58:57 +01:00
|
|
|
#include "modules/video_coding/fec_controller_default.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "rtc_base/checks.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "rtc_base/constructor_magic.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "rtc_base/location.h"
|
|
|
|
|
#include "rtc_base/logging.h"
|
2018-03-12 15:59:12 +01:00
|
|
|
#include "rtc_base/numerics/safe_minmax.h"
|
2018-04-04 15:49:32 +02:00
|
|
|
#include "rtc_base/strings/string_builder.h"
|
2018-05-09 10:33:39 +02:00
|
|
|
#include "rtc_base/synchronization/rw_lock_wrapper.h"
|
2019-04-09 13:44:04 +02:00
|
|
|
#include "rtc_base/synchronization/sequence_checker.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "rtc_base/thread_annotations.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "rtc_base/time_utils.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "rtc_base/trace_event.h"
|
|
|
|
|
#include "system_wrappers/include/clock.h"
|
|
|
|
|
#include "system_wrappers/include/cpu_info.h"
|
2019-03-18 10:59:40 +01:00
|
|
|
#include "system_wrappers/include/field_trial.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "system_wrappers/include/metrics.h"
|
|
|
|
|
#include "video/call_stats.h"
|
|
|
|
|
#include "video/send_delay_stats.h"
|
|
|
|
|
#include "video/stats_counter.h"
|
|
|
|
|
#include "video/video_receive_stream.h"
|
|
|
|
|
#include "video/video_send_stream.h"
|
2013-05-16 12:08:03 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
2014-09-17 09:02:25 +00:00
|
|
|
|
2017-02-07 01:18:43 -08:00
|
|
|
namespace {
|
2019-04-08 12:57:06 +02:00
|
|
|
bool SendPeriodicFeedback(const std::vector<RtpExtension>& extensions) {
|
2019-02-07 12:50:18 +01:00
|
|
|
for (const auto& extension : extensions) {
|
|
|
|
|
if (extension.uri == RtpExtension::kTransportSequenceNumberV2Uri)
|
2019-04-08 12:57:06 +02:00
|
|
|
return false;
|
2019-02-07 12:50:18 +01:00
|
|
|
}
|
2019-04-08 12:57:06 +02:00
|
|
|
return true;
|
2019-02-07 12:50:18 +01:00
|
|
|
}
|
|
|
|
|
|
2017-02-07 01:18:43 -08:00
|
|
|
// TODO(nisse): This really begs for a shared context struct.
|
|
|
|
|
bool UseSendSideBwe(const std::vector<RtpExtension>& extensions,
|
|
|
|
|
bool transport_cc) {
|
|
|
|
|
if (!transport_cc)
|
|
|
|
|
return false;
|
|
|
|
|
for (const auto& extension : extensions) {
|
2019-02-07 12:50:18 +01:00
|
|
|
if (extension.uri == RtpExtension::kTransportSequenceNumberUri ||
|
|
|
|
|
extension.uri == RtpExtension::kTransportSequenceNumberV2Uri)
|
2017-02-07 01:18:43 -08:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UseSendSideBwe(const VideoReceiveStream::Config& config) {
|
|
|
|
|
return UseSendSideBwe(config.rtp.extensions, config.rtp.transport_cc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UseSendSideBwe(const AudioReceiveStream::Config& config) {
|
|
|
|
|
return UseSendSideBwe(config.rtp.extensions, config.rtp.transport_cc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UseSendSideBwe(const FlexfecReceiveStream::Config& config) {
|
|
|
|
|
return UseSendSideBwe(config.rtp_header_extensions, config.transport_cc);
|
|
|
|
|
}
|
|
|
|
|
|
2017-08-25 04:44:25 -07:00
|
|
|
const int* FindKeyByValue(const std::map<int, int>& m, int v) {
|
|
|
|
|
for (const auto& kv : m) {
|
|
|
|
|
if (kv.second == v)
|
|
|
|
|
return &kv.first;
|
|
|
|
|
}
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-08 06:15:52 -07:00
|
|
|
std::unique_ptr<rtclog::StreamConfig> CreateRtcLogStreamConfig(
|
2017-05-22 03:26:49 -07:00
|
|
|
const VideoReceiveStream::Config& config) {
|
Use absl::make_unique and absl::WrapUnique directly
Instead of going through our wrappers in ptr_util.h.
This CL was generated by the following script:
git grep -l ptr_util | xargs perl -pi -e 's,#include "rtc_base/ptr_util.h",#include "absl/memory/memory.h",'
git grep -l MakeUnique | xargs perl -pi -e 's,\b(rtc::)?MakeUnique\b,absl::make_unique,g'
git grep -l WrapUnique | xargs perl -pi -e 's,\b(rtc::)?WrapUnique\b,absl::WrapUnique,g'
git checkout -- rtc_base/ptr_util{.h,_unittest.cc}
git cl format
Followed by manually adding dependencies on
//third_party/abseil-cpp/absl/memory until `gn check` stopped
complaining.
Bug: webrtc:9473
Change-Id: I89ccd363f070479b8c431eb2c3d404a46eaacc1c
Reviewed-on: https://webrtc-review.googlesource.com/86600
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23850}
2018-07-05 11:40:33 +02:00
|
|
|
auto rtclog_config = absl::make_unique<rtclog::StreamConfig>();
|
2017-09-08 06:15:52 -07:00
|
|
|
rtclog_config->remote_ssrc = config.rtp.remote_ssrc;
|
|
|
|
|
rtclog_config->local_ssrc = config.rtp.local_ssrc;
|
|
|
|
|
rtclog_config->rtx_ssrc = config.rtp.rtx_ssrc;
|
|
|
|
|
rtclog_config->rtcp_mode = config.rtp.rtcp_mode;
|
|
|
|
|
rtclog_config->remb = config.rtp.remb;
|
|
|
|
|
rtclog_config->rtp_extensions = config.rtp.extensions;
|
2017-05-22 03:26:49 -07:00
|
|
|
|
|
|
|
|
for (const auto& d : config.decoders) {
|
2017-08-25 04:44:25 -07:00
|
|
|
const int* search =
|
|
|
|
|
FindKeyByValue(config.rtp.rtx_associated_payload_types, d.payload_type);
|
2018-09-11 15:56:04 +02:00
|
|
|
rtclog_config->codecs.emplace_back(d.video_format.name, d.payload_type,
|
2017-08-25 04:44:25 -07:00
|
|
|
search ? *search : 0);
|
2017-05-22 03:26:49 -07:00
|
|
|
}
|
|
|
|
|
return rtclog_config;
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-08 06:15:52 -07:00
|
|
|
std::unique_ptr<rtclog::StreamConfig> CreateRtcLogStreamConfig(
|
2017-05-22 04:08:28 -07:00
|
|
|
const VideoSendStream::Config& config,
|
|
|
|
|
size_t ssrc_index) {
|
Use absl::make_unique and absl::WrapUnique directly
Instead of going through our wrappers in ptr_util.h.
This CL was generated by the following script:
git grep -l ptr_util | xargs perl -pi -e 's,#include "rtc_base/ptr_util.h",#include "absl/memory/memory.h",'
git grep -l MakeUnique | xargs perl -pi -e 's,\b(rtc::)?MakeUnique\b,absl::make_unique,g'
git grep -l WrapUnique | xargs perl -pi -e 's,\b(rtc::)?WrapUnique\b,absl::WrapUnique,g'
git checkout -- rtc_base/ptr_util{.h,_unittest.cc}
git cl format
Followed by manually adding dependencies on
//third_party/abseil-cpp/absl/memory until `gn check` stopped
complaining.
Bug: webrtc:9473
Change-Id: I89ccd363f070479b8c431eb2c3d404a46eaacc1c
Reviewed-on: https://webrtc-review.googlesource.com/86600
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23850}
2018-07-05 11:40:33 +02:00
|
|
|
auto rtclog_config = absl::make_unique<rtclog::StreamConfig>();
|
2017-09-08 06:15:52 -07:00
|
|
|
rtclog_config->local_ssrc = config.rtp.ssrcs[ssrc_index];
|
2017-05-22 04:08:28 -07:00
|
|
|
if (ssrc_index < config.rtp.rtx.ssrcs.size()) {
|
2017-09-08 06:15:52 -07:00
|
|
|
rtclog_config->rtx_ssrc = config.rtp.rtx.ssrcs[ssrc_index];
|
2017-05-22 04:08:28 -07:00
|
|
|
}
|
2017-09-08 06:15:52 -07:00
|
|
|
rtclog_config->rtcp_mode = config.rtp.rtcp_mode;
|
|
|
|
|
rtclog_config->rtp_extensions = config.rtp.extensions;
|
2017-05-22 04:08:28 -07:00
|
|
|
|
Reland "Reland "Move rtp-specific config out of EncoderSettings.""
This reverts commit 6c2c13af06b32778b86950681758a7970d1c5d9e.
Reason for revert: Intend to investigate and fix perf problems.
Original change's description:
> Revert "Reland "Move rtp-specific config out of EncoderSettings.""
>
> This reverts commit 04dd1768625eb2241d1fb97fd0137897e703e266.
>
> Reason for revert: Regression in ramp up perf tests.
>
> Original change's description:
> > Reland "Move rtp-specific config out of EncoderSettings."
> >
> > This is a reland of bc900cb1d1810fcf678fe41cf1e3966daa39c88c
> >
> > Original change's description:
> > > Move rtp-specific config out of EncoderSettings.
> > >
> > > In VideoSendStream::Config, move payload_name and payload_type from
> > > EncoderSettings to Rtp.
> > >
> > > EncoderSettings now contains configuration for VideoStreamEncoder only,
> > > and should perhaps be renamed in a follow up cl. It's no longer
> > > passed as an argument to VideoCodecInitializer::SetupCodec.
> > >
> > > The latter then needs a different way to know the codec type,
> > > which is provided by a new codec_type member in VideoEncoderConfig.
> > >
> > > Bug: webrtc:8830
> > > Change-Id: Ifcc691aef1ee6a95e43c0452c5e630d92a511cd6
> > > Reviewed-on: https://webrtc-review.googlesource.com/62062
> > > Commit-Queue: Niels Moller <nisse@webrtc.org>
> > > Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
> > > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > > Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
> > > Cr-Commit-Position: refs/heads/master@{#22532}
> >
> > Bug: webrtc:8830
> > Change-Id: If88ef7d57cdaa4fae3c7b2a97ea5a6e1b833e019
> > Reviewed-on: https://webrtc-review.googlesource.com/63721
> > Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
> > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > Commit-Queue: Niels Moller <nisse@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#22595}
>
> TBR=brandtr@webrtc.org,magjed@webrtc.org,nisse@webrtc.org,stefan@webrtc.org
>
> Bug: webrtc:8830,chromium:827080
> Change-Id: Iaaf146de91ec5c0d741b8efdf143f7e173084fef
> Reviewed-on: https://webrtc-review.googlesource.com/65520
> Commit-Queue: Niels Moller <nisse@webrtc.org>
> Reviewed-by: Niels Moller <nisse@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22677}
TBR=brandtr@webrtc.org,magjed@webrtc.org,nisse@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: webrtc:8830, chromium:827080
Change-Id: I9b62987bf5daced90dfeb3ebb6739c80117c487f
Reviewed-on: https://webrtc-review.googlesource.com/66862
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22751}
2018-04-05 15:36:51 +02:00
|
|
|
rtclog_config->codecs.emplace_back(config.rtp.payload_name,
|
|
|
|
|
config.rtp.payload_type,
|
2017-09-08 06:15:52 -07:00
|
|
|
config.rtp.rtx.payload_type);
|
2017-05-22 04:08:28 -07:00
|
|
|
return rtclog_config;
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-08 06:15:52 -07:00
|
|
|
std::unique_ptr<rtclog::StreamConfig> CreateRtcLogStreamConfig(
|
2017-05-22 09:36:28 -07:00
|
|
|
const AudioReceiveStream::Config& config) {
|
Use absl::make_unique and absl::WrapUnique directly
Instead of going through our wrappers in ptr_util.h.
This CL was generated by the following script:
git grep -l ptr_util | xargs perl -pi -e 's,#include "rtc_base/ptr_util.h",#include "absl/memory/memory.h",'
git grep -l MakeUnique | xargs perl -pi -e 's,\b(rtc::)?MakeUnique\b,absl::make_unique,g'
git grep -l WrapUnique | xargs perl -pi -e 's,\b(rtc::)?WrapUnique\b,absl::WrapUnique,g'
git checkout -- rtc_base/ptr_util{.h,_unittest.cc}
git cl format
Followed by manually adding dependencies on
//third_party/abseil-cpp/absl/memory until `gn check` stopped
complaining.
Bug: webrtc:9473
Change-Id: I89ccd363f070479b8c431eb2c3d404a46eaacc1c
Reviewed-on: https://webrtc-review.googlesource.com/86600
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23850}
2018-07-05 11:40:33 +02:00
|
|
|
auto rtclog_config = absl::make_unique<rtclog::StreamConfig>();
|
2017-09-08 06:15:52 -07:00
|
|
|
rtclog_config->remote_ssrc = config.rtp.remote_ssrc;
|
|
|
|
|
rtclog_config->local_ssrc = config.rtp.local_ssrc;
|
|
|
|
|
rtclog_config->rtp_extensions = config.rtp.extensions;
|
2017-05-22 09:36:28 -07:00
|
|
|
return rtclog_config;
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-07 01:18:43 -08:00
|
|
|
} // namespace
|
|
|
|
|
|
2013-10-28 16:32:01 +00:00
|
|
|
namespace internal {
|
2014-01-31 10:05:07 +00:00
|
|
|
|
2018-05-04 14:08:15 +02:00
|
|
|
class Call final : public webrtc::Call,
|
|
|
|
|
public PacketReceiver,
|
|
|
|
|
public RecoveredPacketReceiver,
|
|
|
|
|
public TargetTransferRateObserver,
|
|
|
|
|
public BitrateAllocator::LimitObserver {
|
2013-10-28 16:32:01 +00:00
|
|
|
public:
|
2019-03-01 18:13:27 +01:00
|
|
|
Call(Clock* clock,
|
|
|
|
|
const Call::Config& config,
|
2019-03-01 18:48:16 +01:00
|
|
|
std::unique_ptr<RtpTransportControllerSendInterface> transport_send,
|
|
|
|
|
std::unique_ptr<ProcessThread> module_process_thread,
|
|
|
|
|
TaskQueueFactory* task_queue_factory);
|
2018-08-28 16:30:18 +02:00
|
|
|
~Call() override;
|
2013-10-28 16:32:01 +00:00
|
|
|
|
2016-10-23 23:37:14 -07:00
|
|
|
// Implements webrtc::Call.
|
2015-03-04 12:58:35 +00:00
|
|
|
PacketReceiver* Receiver() override;
|
2013-10-28 16:32:01 +00:00
|
|
|
|
2015-06-08 13:04:56 +02:00
|
|
|
webrtc::AudioSendStream* CreateAudioSendStream(
|
|
|
|
|
const webrtc::AudioSendStream::Config& config) override;
|
|
|
|
|
void DestroyAudioSendStream(webrtc::AudioSendStream* send_stream) override;
|
|
|
|
|
|
2015-04-29 15:24:01 +02:00
|
|
|
webrtc::AudioReceiveStream* CreateAudioReceiveStream(
|
|
|
|
|
const webrtc::AudioReceiveStream::Config& config) override;
|
|
|
|
|
void DestroyAudioReceiveStream(
|
|
|
|
|
webrtc::AudioReceiveStream* receive_stream) override;
|
2013-10-28 16:32:01 +00:00
|
|
|
|
2015-04-29 15:24:01 +02:00
|
|
|
webrtc::VideoSendStream* CreateVideoSendStream(
|
2016-09-01 01:17:40 -07:00
|
|
|
webrtc::VideoSendStream::Config config,
|
|
|
|
|
VideoEncoderConfig encoder_config) override;
|
2018-01-19 17:58:57 +01:00
|
|
|
webrtc::VideoSendStream* CreateVideoSendStream(
|
|
|
|
|
webrtc::VideoSendStream::Config config,
|
|
|
|
|
VideoEncoderConfig encoder_config,
|
|
|
|
|
std::unique_ptr<FecController> fec_controller) override;
|
2015-03-04 12:58:35 +00:00
|
|
|
void DestroyVideoSendStream(webrtc::VideoSendStream* send_stream) override;
|
2013-10-28 16:32:01 +00:00
|
|
|
|
2015-04-29 15:24:01 +02:00
|
|
|
webrtc::VideoReceiveStream* CreateVideoReceiveStream(
|
2016-06-10 17:58:01 +02:00
|
|
|
webrtc::VideoReceiveStream::Config configuration) override;
|
2015-03-04 12:58:35 +00:00
|
|
|
void DestroyVideoReceiveStream(
|
|
|
|
|
webrtc::VideoReceiveStream* receive_stream) override;
|
2013-10-28 16:32:01 +00:00
|
|
|
|
2016-12-19 01:13:46 -08:00
|
|
|
FlexfecReceiveStream* CreateFlexfecReceiveStream(
|
|
|
|
|
const FlexfecReceiveStream::Config& config) override;
|
2016-10-23 23:37:14 -07:00
|
|
|
void DestroyFlexfecReceiveStream(
|
2016-12-19 01:13:46 -08:00
|
|
|
FlexfecReceiveStream* receive_stream) override;
|
2016-10-23 23:37:14 -07:00
|
|
|
|
2018-02-21 13:07:13 +01:00
|
|
|
RtpTransportControllerSendInterface* GetTransportControllerSend() override;
|
|
|
|
|
|
2015-03-04 12:58:35 +00:00
|
|
|
Stats GetStats() const override;
|
2013-10-28 16:32:01 +00:00
|
|
|
|
2016-10-23 23:37:14 -07:00
|
|
|
// Implements PacketReceiver.
|
2015-09-08 05:36:15 -07:00
|
|
|
DeliveryStatus DeliverPacket(MediaType media_type,
|
2017-12-07 17:00:40 +01:00
|
|
|
rtc::CopyOnWriteBuffer packet,
|
2018-08-07 11:03:12 +02:00
|
|
|
int64_t packet_time_us) override;
|
2013-10-28 16:32:01 +00:00
|
|
|
|
2016-10-18 23:50:45 -07:00
|
|
|
// Implements RecoveredPacketReceiver.
|
2017-05-11 08:00:58 -07:00
|
|
|
void OnRecoveredPacket(const uint8_t* packet, size_t length) override;
|
2016-10-18 23:50:45 -07:00
|
|
|
|
2016-03-22 15:32:27 -07:00
|
|
|
void SignalChannelNetworkState(MediaType media, NetworkState state) override;
|
2014-09-03 16:17:12 +00:00
|
|
|
|
2018-10-04 15:21:55 +02:00
|
|
|
void OnAudioTransportOverheadChanged(
|
|
|
|
|
int transport_overhead_per_packet) override;
|
2016-11-08 02:50:09 -08:00
|
|
|
|
2015-10-15 07:26:07 -07:00
|
|
|
void OnSentPacket(const rtc::SentPacket& sent_packet) override;
|
|
|
|
|
|
2018-03-12 15:59:12 +01:00
|
|
|
// Implements TargetTransferRateObserver,
|
|
|
|
|
void OnTargetTransferRate(TargetTransferRate msg) override;
|
2018-12-11 15:02:47 +01:00
|
|
|
void OnStartRateUpdate(DataRate start_rate) override;
|
2015-11-12 21:02:42 -08:00
|
|
|
|
2016-06-15 00:47:53 -07:00
|
|
|
// Implements BitrateAllocator::LimitObserver.
|
|
|
|
|
void OnAllocationLimitsChanged(uint32_t min_send_bitrate_bps,
|
2018-02-28 13:06:28 +01:00
|
|
|
uint32_t max_padding_bitrate_bps,
|
2019-01-23 09:41:43 +01:00
|
|
|
uint32_t total_bitrate_bps) override;
|
2016-06-15 00:47:53 -07:00
|
|
|
|
2019-03-18 10:31:54 -07:00
|
|
|
void SetClientBitratePreferences(const BitrateSettings& preferences) override;
|
|
|
|
|
|
2013-10-28 16:32:01 +00:00
|
|
|
private:
|
2015-04-29 15:24:01 +02:00
|
|
|
DeliveryStatus DeliverRtcp(MediaType media_type,
|
|
|
|
|
const uint8_t* packet,
|
|
|
|
|
size_t length);
|
2015-09-08 05:36:15 -07:00
|
|
|
DeliveryStatus DeliverRtp(MediaType media_type,
|
2017-12-07 17:00:40 +01:00
|
|
|
rtc::CopyOnWriteBuffer packet,
|
2018-08-07 11:03:12 +02:00
|
|
|
int64_t packet_time_us);
|
2015-07-15 08:02:58 -07:00
|
|
|
void ConfigureSync(const std::string& sync_group)
|
2017-09-09 04:17:22 -07:00
|
|
|
RTC_EXCLUSIVE_LOCKS_REQUIRED(receive_crit_);
|
2015-07-15 08:02:58 -07:00
|
|
|
|
2017-02-06 02:23:00 -08:00
|
|
|
void NotifyBweOfReceivedPacket(const RtpPacketReceived& packet,
|
|
|
|
|
MediaType media_type)
|
2017-09-09 04:17:22 -07:00
|
|
|
RTC_SHARED_LOCKS_REQUIRED(receive_crit_);
|
2017-02-06 02:23:00 -08:00
|
|
|
|
2019-07-29 16:38:27 +02:00
|
|
|
void UpdateSendHistograms(Timestamp first_sent_packet)
|
2017-09-09 04:17:22 -07:00
|
|
|
RTC_EXCLUSIVE_LOCKS_REQUIRED(&bitrate_crit_);
|
2015-11-17 06:24:56 -08:00
|
|
|
void UpdateReceiveHistograms();
|
2016-07-27 00:39:09 -07:00
|
|
|
void UpdateHistograms();
|
2016-03-22 15:32:27 -07:00
|
|
|
void UpdateAggregateNetworkState();
|
2015-11-11 10:13:02 -08:00
|
|
|
|
2019-08-08 12:27:53 +02:00
|
|
|
void RegisterRateObserver();
|
2019-01-07 15:54:47 +01:00
|
|
|
|
2019-08-09 11:42:32 +02:00
|
|
|
rtc::TaskQueue* network_queue() const {
|
|
|
|
|
return transport_send_ptr_->GetWorkerQueue();
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-09 11:20:58 +01:00
|
|
|
Clock* const clock_;
|
2019-03-01 18:48:16 +01:00
|
|
|
TaskQueueFactory* const task_queue_factory_;
|
2015-11-11 10:13:02 -08:00
|
|
|
|
2015-05-08 13:54:38 +02:00
|
|
|
const int num_cpu_cores_;
|
2016-03-12 06:10:44 -08:00
|
|
|
const std::unique_ptr<ProcessThread> module_process_thread_;
|
|
|
|
|
const std::unique_ptr<CallStats> call_stats_;
|
|
|
|
|
const std::unique_ptr<BitrateAllocator> bitrate_allocator_;
|
2013-10-28 16:32:01 +00:00
|
|
|
Call::Config config_;
|
2019-04-09 13:44:04 +02:00
|
|
|
SequenceChecker configuration_sequence_checker_;
|
2019-08-08 12:27:53 +02:00
|
|
|
SequenceChecker worker_sequence_checker_;
|
2013-10-28 16:32:01 +00:00
|
|
|
|
2016-03-22 15:32:27 -07:00
|
|
|
NetworkState audio_network_state_;
|
|
|
|
|
NetworkState video_network_state_;
|
2019-08-09 11:42:32 +02:00
|
|
|
bool aggregate_network_up_ RTC_GUARDED_BY(configuration_sequence_checker_);
|
2014-09-03 16:17:12 +00:00
|
|
|
|
2016-03-12 06:10:44 -08:00
|
|
|
std::unique_ptr<RWLockWrapper> receive_crit_;
|
2016-10-23 23:37:14 -07:00
|
|
|
// Audio, Video, and FlexFEC receive streams are owned by the client that
|
|
|
|
|
// creates them.
|
2017-05-16 04:47:04 -07:00
|
|
|
std::set<AudioReceiveStream*> audio_receive_streams_
|
2017-09-09 04:17:22 -07:00
|
|
|
RTC_GUARDED_BY(receive_crit_);
|
2015-04-29 15:24:01 +02:00
|
|
|
std::set<VideoReceiveStream*> video_receive_streams_
|
2017-09-09 04:17:22 -07:00
|
|
|
RTC_GUARDED_BY(receive_crit_);
|
2017-05-16 04:47:04 -07:00
|
|
|
|
2015-07-15 08:02:58 -07:00
|
|
|
std::map<std::string, AudioReceiveStream*> sync_stream_mapping_
|
2017-09-09 04:17:22 -07:00
|
|
|
RTC_GUARDED_BY(receive_crit_);
|
2013-10-28 16:32:01 +00:00
|
|
|
|
2017-06-21 01:05:22 -07:00
|
|
|
// TODO(nisse): Should eventually be injected at creation,
|
|
|
|
|
// with a single object in the bundled case.
|
2017-07-03 09:25:27 -07:00
|
|
|
RtpStreamReceiverController audio_receiver_controller_;
|
|
|
|
|
RtpStreamReceiverController video_receiver_controller_;
|
2017-05-16 04:47:04 -07:00
|
|
|
|
2017-02-06 02:23:00 -08:00
|
|
|
// This extra map is used for receive processing which is
|
|
|
|
|
// independent of media type.
|
|
|
|
|
|
|
|
|
|
// TODO(nisse): In the RTP transport refactoring, we should have a
|
|
|
|
|
// single mapping from ssrc to a more abstract receive stream, with
|
|
|
|
|
// accessor methods for all configuration we need at this level.
|
|
|
|
|
struct ReceiveRtpConfig {
|
2018-03-14 15:16:50 +01:00
|
|
|
explicit ReceiveRtpConfig(const webrtc::AudioReceiveStream::Config& config)
|
|
|
|
|
: extensions(config.rtp.extensions),
|
|
|
|
|
use_send_side_bwe(UseSendSideBwe(config)) {}
|
|
|
|
|
explicit ReceiveRtpConfig(const webrtc::VideoReceiveStream::Config& config)
|
|
|
|
|
: extensions(config.rtp.extensions),
|
|
|
|
|
use_send_side_bwe(UseSendSideBwe(config)) {}
|
|
|
|
|
explicit ReceiveRtpConfig(const FlexfecReceiveStream::Config& config)
|
|
|
|
|
: extensions(config.rtp_header_extensions),
|
|
|
|
|
use_send_side_bwe(UseSendSideBwe(config)) {}
|
2017-02-06 02:23:00 -08:00
|
|
|
|
|
|
|
|
// Registered RTP header extensions for each stream. Note that RTP header
|
|
|
|
|
// extensions are negotiated per track ("m= line") in the SDP, but we have
|
|
|
|
|
// no notion of tracks at the Call level. We therefore store the RTP header
|
|
|
|
|
// extensions per SSRC instead, which leads to some storage overhead.
|
2018-03-14 15:16:50 +01:00
|
|
|
const RtpHeaderExtensionMap extensions;
|
2017-02-07 01:18:43 -08:00
|
|
|
// Set if both RTP extension the RTCP feedback message needed for
|
|
|
|
|
// send side BWE are negotiated.
|
2018-03-14 15:16:50 +01:00
|
|
|
const bool use_send_side_bwe;
|
2017-02-06 02:23:00 -08:00
|
|
|
};
|
|
|
|
|
std::map<uint32_t, ReceiveRtpConfig> receive_rtp_config_
|
2017-09-09 04:17:22 -07:00
|
|
|
RTC_GUARDED_BY(receive_crit_);
|
2016-12-21 06:37:18 -08:00
|
|
|
|
2016-03-12 06:10:44 -08:00
|
|
|
std::unique_ptr<RWLockWrapper> send_crit_;
|
2015-10-16 14:35:07 -07:00
|
|
|
// Audio and Video send streams are owned by the client that creates them.
|
2017-09-09 04:17:22 -07:00
|
|
|
std::map<uint32_t, AudioSendStream*> audio_send_ssrcs_
|
|
|
|
|
RTC_GUARDED_BY(send_crit_);
|
|
|
|
|
std::map<uint32_t, VideoSendStream*> video_send_ssrcs_
|
|
|
|
|
RTC_GUARDED_BY(send_crit_);
|
|
|
|
|
std::set<VideoSendStream*> video_send_streams_ RTC_GUARDED_BY(send_crit_);
|
2013-10-28 16:32:01 +00:00
|
|
|
|
2017-05-23 06:07:11 -07:00
|
|
|
using RtpStateMap = std::map<uint32_t, RtpState>;
|
|
|
|
|
RtpStateMap suspended_audio_send_ssrcs_
|
2017-09-09 04:17:22 -07:00
|
|
|
RTC_GUARDED_BY(configuration_sequence_checker_);
|
2017-05-23 06:07:11 -07:00
|
|
|
RtpStateMap suspended_video_send_ssrcs_
|
2017-09-09 04:17:22 -07:00
|
|
|
RTC_GUARDED_BY(configuration_sequence_checker_);
|
2017-05-23 06:07:11 -07:00
|
|
|
|
2017-10-06 10:04:04 +02:00
|
|
|
using RtpPayloadStateMap = std::map<uint32_t, RtpPayloadState>;
|
|
|
|
|
RtpPayloadStateMap suspended_video_payload_states_
|
|
|
|
|
RTC_GUARDED_BY(configuration_sequence_checker_);
|
|
|
|
|
|
2016-10-07 11:53:05 -07:00
|
|
|
webrtc::RtcEventLog* event_log_;
|
2015-09-09 00:09:43 -07:00
|
|
|
|
2015-11-17 06:24:56 -08:00
|
|
|
// The following members are only accessed (exclusively) from one thread and
|
|
|
|
|
// from the destructor, and therefore doesn't need any explicit
|
|
|
|
|
// synchronization.
|
2016-09-08 00:07:21 -07:00
|
|
|
RateCounter received_bytes_per_second_counter_;
|
|
|
|
|
RateCounter received_audio_bytes_per_second_counter_;
|
|
|
|
|
RateCounter received_video_bytes_per_second_counter_;
|
|
|
|
|
RateCounter received_rtcp_bytes_per_second_counter_;
|
2018-06-15 12:28:07 +02:00
|
|
|
absl::optional<int64_t> first_received_rtp_audio_ms_;
|
|
|
|
|
absl::optional<int64_t> last_received_rtp_audio_ms_;
|
|
|
|
|
absl::optional<int64_t> first_received_rtp_video_ms_;
|
|
|
|
|
absl::optional<int64_t> last_received_rtp_video_ms_;
|
2015-11-11 10:13:02 -08:00
|
|
|
|
2018-03-12 15:59:12 +01:00
|
|
|
rtc::CriticalSection last_bandwidth_bps_crit_;
|
|
|
|
|
uint32_t last_bandwidth_bps_ RTC_GUARDED_BY(&last_bandwidth_bps_crit_);
|
2015-11-17 06:24:56 -08:00
|
|
|
// TODO(holmer): Remove this lock once BitrateController no longer calls
|
|
|
|
|
// OnNetworkChanged from multiple threads.
|
|
|
|
|
rtc::CriticalSection bitrate_crit_;
|
2019-08-08 12:27:53 +02:00
|
|
|
uint32_t min_allocated_send_bitrate_bps_
|
|
|
|
|
RTC_GUARDED_BY(&worker_sequence_checker_);
|
2017-09-09 04:17:22 -07:00
|
|
|
uint32_t configured_max_padding_bitrate_bps_ RTC_GUARDED_BY(&bitrate_crit_);
|
|
|
|
|
AvgCounter estimated_send_bitrate_kbps_counter_
|
|
|
|
|
RTC_GUARDED_BY(&bitrate_crit_);
|
|
|
|
|
AvgCounter pacer_bitrate_kbps_counter_ RTC_GUARDED_BY(&bitrate_crit_);
|
2015-11-17 06:24:56 -08:00
|
|
|
|
2017-03-21 06:41:12 -07:00
|
|
|
ReceiveSideCongestionController receive_side_cc_;
|
2018-03-21 14:38:32 +01:00
|
|
|
|
|
|
|
|
const std::unique_ptr<ReceiveTimeCalculator> receive_time_calculator_;
|
|
|
|
|
|
2016-05-02 23:44:01 -07:00
|
|
|
const std::unique_ptr<SendDelayStats> video_send_delay_stats_;
|
2016-07-27 00:39:09 -07:00
|
|
|
const int64_t start_ms_;
|
2015-11-12 21:02:42 -08:00
|
|
|
|
2018-05-04 14:08:15 +02:00
|
|
|
// Caches transport_send_.get(), to avoid racing with destructor.
|
|
|
|
|
// Note that this is declared before transport_send_ to ensure that it is not
|
|
|
|
|
// invalidated until no more tasks can be running on the transport_send_ task
|
|
|
|
|
// queue.
|
2019-08-08 12:27:53 +02:00
|
|
|
RtpTransportControllerSendInterface* const transport_send_ptr_;
|
2018-05-04 14:08:15 +02:00
|
|
|
// Declared last since it will issue callbacks from a task queue. Declaring it
|
|
|
|
|
// last ensures that it is destroyed first and any running tasks are finished.
|
|
|
|
|
std::unique_ptr<RtpTransportControllerSendInterface> transport_send_;
|
2018-11-15 08:26:19 -08:00
|
|
|
|
|
|
|
|
bool is_target_rate_observer_registered_
|
2019-08-08 12:27:53 +02:00
|
|
|
RTC_GUARDED_BY(&configuration_sequence_checker_) = false;
|
2018-11-15 08:26:19 -08:00
|
|
|
|
2015-09-16 05:37:44 -07:00
|
|
|
RTC_DISALLOW_COPY_AND_ASSIGN(Call);
|
2013-10-28 16:32:01 +00:00
|
|
|
};
|
2013-12-05 12:11:47 +00:00
|
|
|
} // namespace internal
|
2013-08-14 13:52:52 +00:00
|
|
|
|
2016-08-11 08:41:18 -07:00
|
|
|
std::string Call::Stats::ToString(int64_t time_ms) const {
|
2018-04-04 15:49:32 +02:00
|
|
|
char buf[1024];
|
|
|
|
|
rtc::SimpleStringBuilder ss(buf);
|
2016-08-11 08:41:18 -07:00
|
|
|
ss << "Call stats: " << time_ms << ", {";
|
|
|
|
|
ss << "send_bw_bps: " << send_bandwidth_bps << ", ";
|
|
|
|
|
ss << "recv_bw_bps: " << recv_bandwidth_bps << ", ";
|
|
|
|
|
ss << "max_pad_bps: " << max_padding_bitrate_bps << ", ";
|
|
|
|
|
ss << "pacer_delay_ms: " << pacer_delay_ms << ", ";
|
|
|
|
|
ss << "rtt_ms: " << rtt_ms;
|
|
|
|
|
ss << '}';
|
|
|
|
|
return ss.str();
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-04 10:24:26 +00:00
|
|
|
Call* Call::Create(const Call::Config& config) {
|
2019-04-01 10:46:36 +02:00
|
|
|
return Create(config, Clock::GetRealTimeClock(),
|
|
|
|
|
ProcessThread::Create("PacerThread"),
|
|
|
|
|
ProcessThread::Create("ModuleProcessThread"));
|
2019-03-01 18:48:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Call* Call::Create(const Call::Config& config,
|
2019-03-01 18:13:27 +01:00
|
|
|
Clock* clock,
|
2019-03-01 18:48:16 +01:00
|
|
|
std::unique_ptr<ProcessThread> call_thread,
|
2019-04-01 10:46:36 +02:00
|
|
|
std::unique_ptr<ProcessThread> pacer_thread) {
|
2019-07-03 14:56:33 +02:00
|
|
|
RTC_DCHECK(config.task_queue_factory);
|
2018-02-21 13:01:55 +01:00
|
|
|
return new internal::Call(
|
2019-03-01 18:13:27 +01:00
|
|
|
clock, config,
|
2019-03-01 14:45:21 +01:00
|
|
|
absl::make_unique<RtpTransportControllerSend>(
|
2019-04-10 13:48:24 +02:00
|
|
|
clock, config.event_log, config.network_state_predictor_factory,
|
|
|
|
|
config.network_controller_factory, config.bitrate_config,
|
2019-07-03 14:56:33 +02:00
|
|
|
std::move(pacer_thread), config.task_queue_factory),
|
|
|
|
|
std::move(call_thread), config.task_queue_factory);
|
2017-05-08 11:52:38 -07:00
|
|
|
}
|
|
|
|
|
|
Revert "Revert "Enables PeerConnectionFactory using external fec controller""
This reverts commit 00733015fafbbc61ddc12dfdc88b21a9fcd9d122.
Reason for revert: The reason for a downstream test failure on the original commit and a workaround has been found. Solution is to keep a PeerConnectionFactory constructor implementation as the same as before.
Original change's description:
> Revert "Enables PeerConnectionFactory using external fec controller"
>
> This reverts commit 4f07bdb25567d8ef528311e0b50a62c61d543fc3.
>
> Reason for revert: Speculatively reverting, because downstream test is now hitting "PeerConnectionFactory.initialize was not called before creating a PeerConnectionFactory" error, even though it did call initialize. I don't see how any change in this CL could cause that, but it's the only CL on the blamelist, and it does modify PeerConnectionFactory.java
>
> Original change's description:
> > Enables PeerConnectionFactory using external fec controller
> >
> > Bug: webrtc:8799
> > Change-Id: Ieb2cf6163b9a83844ab9ed4822b4a7f1db4c24b8
> > Reviewed-on: https://webrtc-review.googlesource.com/43961
> > Commit-Queue: Ying Wang <yinwa@webrtc.org>
> > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> > Reviewed-by: Niels Moller <nisse@webrtc.org>
> > Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#22038}
>
> TBR=sakal@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org,stefan@webrtc.org,yinwa@webrtc.org
>
> Change-Id: I95868c35d6f9973e0ebf563814cd71d0fcbd433d
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:8799
> Reviewed-on: https://webrtc-review.googlesource.com/54080
> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22040}
TBR=deadbeef@webrtc.org,sakal@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org,stefan@webrtc.org,yinwa@webrtc.org
Bug: webrtc:8799
Change-Id: If9f3292bfcc739782967530c49f006d0abbc38a8
Reviewed-on: https://webrtc-review.googlesource.com/55400
Commit-Queue: Ying Wang <yinwa@webrtc.org>
Reviewed-by: Ying Wang <yinwa@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22100}
2018-02-20 12:50:27 +01:00
|
|
|
// This method here to avoid subclasses has to implement this method.
|
|
|
|
|
// Call perf test will use Internal::Call::CreateVideoSendStream() to inject
|
|
|
|
|
// FecController.
|
2018-01-19 17:58:57 +01:00
|
|
|
VideoSendStream* Call::CreateVideoSendStream(
|
|
|
|
|
VideoSendStream::Config config,
|
|
|
|
|
VideoEncoderConfig encoder_config,
|
|
|
|
|
std::unique_ptr<FecController> fec_controller) {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-16 12:08:03 +00:00
|
|
|
namespace internal {
|
|
|
|
|
|
2019-03-01 18:13:27 +01:00
|
|
|
Call::Call(Clock* clock,
|
|
|
|
|
const Call::Config& config,
|
2019-03-01 18:48:16 +01:00
|
|
|
std::unique_ptr<RtpTransportControllerSendInterface> transport_send,
|
|
|
|
|
std::unique_ptr<ProcessThread> module_process_thread,
|
|
|
|
|
TaskQueueFactory* task_queue_factory)
|
2019-03-01 18:13:27 +01:00
|
|
|
: clock_(clock),
|
2019-03-01 18:48:16 +01:00
|
|
|
task_queue_factory_(task_queue_factory),
|
2015-11-11 10:13:02 -08:00
|
|
|
num_cpu_cores_(CpuInfo::DetectNumberOfCores()),
|
2019-03-01 18:48:16 +01:00
|
|
|
module_process_thread_(std::move(module_process_thread)),
|
2018-03-27 23:11:09 +02:00
|
|
|
call_stats_(new CallStats(clock_, module_process_thread_.get())),
|
2019-03-04 17:05:12 +01:00
|
|
|
bitrate_allocator_(new BitrateAllocator(clock_, this)),
|
2015-05-08 13:54:38 +02:00
|
|
|
config_(config),
|
2016-11-22 16:08:30 -08:00
|
|
|
audio_network_state_(kNetworkDown),
|
|
|
|
|
video_network_state_(kNetworkDown),
|
2018-03-07 18:49:55 +01:00
|
|
|
aggregate_network_up_(false),
|
2014-09-03 16:17:12 +00:00
|
|
|
receive_crit_(RWLockWrapper::CreateRWLock()),
|
2015-11-11 10:13:02 -08:00
|
|
|
send_crit_(RWLockWrapper::CreateRWLock()),
|
2016-10-07 11:53:05 -07:00
|
|
|
event_log_(config.event_log),
|
2016-09-08 00:07:21 -07:00
|
|
|
received_bytes_per_second_counter_(clock_, nullptr, true),
|
|
|
|
|
received_audio_bytes_per_second_counter_(clock_, nullptr, true),
|
|
|
|
|
received_video_bytes_per_second_counter_(clock_, nullptr, true),
|
|
|
|
|
received_rtcp_bytes_per_second_counter_(clock_, nullptr, true),
|
2018-03-12 15:59:12 +01:00
|
|
|
last_bandwidth_bps_(0),
|
2016-06-15 00:47:53 -07:00
|
|
|
min_allocated_send_bitrate_bps_(0),
|
2016-07-06 00:54:28 -07:00
|
|
|
configured_max_padding_bitrate_bps_(0),
|
2016-09-09 00:13:35 -07:00
|
|
|
estimated_send_bitrate_kbps_counter_(clock_, nullptr, true),
|
|
|
|
|
pacer_bitrate_kbps_counter_(clock_, nullptr, true),
|
2017-04-18 23:38:35 -07:00
|
|
|
receive_side_cc_(clock_, transport_send->packet_router()),
|
2018-03-21 14:38:32 +01:00
|
|
|
receive_time_calculator_(ReceiveTimeCalculator::CreateFromFieldTrial()),
|
2016-07-27 00:39:09 -07:00
|
|
|
video_send_delay_stats_(new SendDelayStats(clock_)),
|
2019-08-08 12:27:53 +02:00
|
|
|
start_ms_(clock_->TimeInMilliseconds()),
|
|
|
|
|
transport_send_ptr_(transport_send.get()),
|
|
|
|
|
transport_send_(std::move(transport_send)) {
|
2016-10-07 11:53:05 -07:00
|
|
|
RTC_DCHECK(config.event_log != nullptr);
|
2019-08-08 12:27:53 +02:00
|
|
|
worker_sequence_checker_.Detach();
|
2019-08-09 11:42:32 +02:00
|
|
|
|
|
|
|
|
call_stats_->RegisterStatsObserver(&receive_side_cc_);
|
|
|
|
|
|
|
|
|
|
module_process_thread_->RegisterModule(
|
|
|
|
|
receive_side_cc_.GetRemoteBitrateEstimator(true), RTC_FROM_HERE);
|
|
|
|
|
module_process_thread_->RegisterModule(call_stats_.get(), RTC_FROM_HERE);
|
|
|
|
|
module_process_thread_->RegisterModule(&receive_side_cc_, RTC_FROM_HERE);
|
2013-05-16 12:08:03 +00:00
|
|
|
}
|
|
|
|
|
|
2013-09-09 15:04:25 +00:00
|
|
|
Call::~Call() {
|
2019-04-09 13:44:04 +02:00
|
|
|
RTC_DCHECK_RUN_ON(&configuration_sequence_checker_);
|
2016-09-01 01:17:40 -07:00
|
|
|
|
2015-10-16 14:35:07 -07:00
|
|
|
RTC_CHECK(audio_send_ssrcs_.empty());
|
|
|
|
|
RTC_CHECK(video_send_ssrcs_.empty());
|
|
|
|
|
RTC_CHECK(video_send_streams_.empty());
|
2017-05-16 04:47:04 -07:00
|
|
|
RTC_CHECK(audio_receive_streams_.empty());
|
2015-10-16 14:35:07 -07:00
|
|
|
RTC_CHECK(video_receive_streams_.empty());
|
2015-02-12 10:48:23 +00:00
|
|
|
|
2019-08-09 11:42:32 +02:00
|
|
|
module_process_thread_->Stop();
|
2019-08-08 12:27:53 +02:00
|
|
|
module_process_thread_->DeRegisterModule(
|
|
|
|
|
receive_side_cc_.GetRemoteBitrateEstimator(true));
|
|
|
|
|
module_process_thread_->DeRegisterModule(&receive_side_cc_);
|
|
|
|
|
module_process_thread_->DeRegisterModule(call_stats_.get());
|
|
|
|
|
call_stats_->DeregisterStatsObserver(&receive_side_cc_);
|
2016-07-13 06:37:09 -07:00
|
|
|
|
2019-07-29 16:38:27 +02:00
|
|
|
absl::optional<Timestamp> first_sent_packet_ms =
|
|
|
|
|
transport_send_->GetFirstPacketTime();
|
2019-08-09 11:42:32 +02:00
|
|
|
|
2016-07-13 06:37:09 -07:00
|
|
|
// Only update histograms after process threads have been shut down, so that
|
|
|
|
|
// they won't try to concurrently update stats.
|
2019-07-24 14:52:55 +02:00
|
|
|
if (first_sent_packet_ms) {
|
2016-09-01 01:17:40 -07:00
|
|
|
rtc::CritScope lock(&bitrate_crit_);
|
2019-07-24 14:52:55 +02:00
|
|
|
UpdateSendHistograms(*first_sent_packet_ms);
|
2016-09-01 01:17:40 -07:00
|
|
|
}
|
2019-08-09 11:42:32 +02:00
|
|
|
|
2016-07-13 06:37:09 -07:00
|
|
|
UpdateReceiveHistograms();
|
2016-07-27 00:39:09 -07:00
|
|
|
UpdateHistograms();
|
2013-05-16 12:08:03 +00:00
|
|
|
}
|
|
|
|
|
|
2018-11-15 08:26:19 -08:00
|
|
|
void Call::RegisterRateObserver() {
|
2019-08-08 12:27:53 +02:00
|
|
|
RTC_DCHECK_RUN_ON(&configuration_sequence_checker_);
|
2018-11-15 08:26:19 -08:00
|
|
|
|
2019-08-08 12:27:53 +02:00
|
|
|
if (is_target_rate_observer_registered_)
|
2018-11-15 08:26:19 -08:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
is_target_rate_observer_registered_ = true;
|
|
|
|
|
|
2019-08-09 11:42:32 +02:00
|
|
|
// This call seems to kick off a number of things, so probably better left
|
|
|
|
|
// off being kicked off on request rather than in the ctor.
|
2019-08-08 12:27:53 +02:00
|
|
|
transport_send_ptr_->RegisterTargetTransferRateObserver(this);
|
2018-11-15 08:26:19 -08:00
|
|
|
|
2019-08-08 12:27:53 +02:00
|
|
|
module_process_thread_->Start();
|
2019-03-18 10:31:54 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Call::SetClientBitratePreferences(const BitrateSettings& preferences) {
|
2019-08-08 12:27:53 +02:00
|
|
|
RTC_DCHECK_RUN_ON(&configuration_sequence_checker_);
|
2019-03-18 10:31:54 -07:00
|
|
|
GetTransportControllerSend()->SetClientBitratePreferences(preferences);
|
2018-11-15 08:26:19 -08:00
|
|
|
}
|
|
|
|
|
|
2016-07-27 00:39:09 -07:00
|
|
|
void Call::UpdateHistograms() {
|
2016-09-09 22:40:25 -07:00
|
|
|
RTC_HISTOGRAM_COUNTS_100000(
|
2016-07-27 00:39:09 -07:00
|
|
|
"WebRTC.Call.LifetimeInSeconds",
|
|
|
|
|
(clock_->TimeInMilliseconds() - start_ms_) / 1000);
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-09 11:42:32 +02:00
|
|
|
// Called from the dtor.
|
2019-07-29 16:38:27 +02:00
|
|
|
void Call::UpdateSendHistograms(Timestamp first_sent_packet) {
|
2015-11-17 06:24:56 -08:00
|
|
|
int64_t elapsed_sec =
|
2019-07-29 16:38:27 +02:00
|
|
|
(clock_->TimeInMilliseconds() - first_sent_packet.ms()) / 1000;
|
2015-11-17 06:24:56 -08:00
|
|
|
if (elapsed_sec < metrics::kMinRunTimeInSeconds)
|
|
|
|
|
return;
|
2016-09-09 00:13:35 -07:00
|
|
|
const int kMinRequiredPeriodicSamples = 5;
|
|
|
|
|
AggregatedStats send_bitrate_stats =
|
|
|
|
|
estimated_send_bitrate_kbps_counter_.ProcessAndGetStats();
|
|
|
|
|
if (send_bitrate_stats.num_samples > kMinRequiredPeriodicSamples) {
|
2016-09-09 22:40:25 -07:00
|
|
|
RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.EstimatedSendBitrateInKbps",
|
|
|
|
|
send_bitrate_stats.average);
|
2017-11-09 11:09:25 +01:00
|
|
|
RTC_LOG(LS_INFO) << "WebRTC.Call.EstimatedSendBitrateInKbps, "
|
|
|
|
|
<< send_bitrate_stats.ToString();
|
2015-11-17 06:24:56 -08:00
|
|
|
}
|
2016-09-09 00:13:35 -07:00
|
|
|
AggregatedStats pacer_bitrate_stats =
|
|
|
|
|
pacer_bitrate_kbps_counter_.ProcessAndGetStats();
|
|
|
|
|
if (pacer_bitrate_stats.num_samples > kMinRequiredPeriodicSamples) {
|
2016-09-09 22:40:25 -07:00
|
|
|
RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.PacerBitrateInKbps",
|
|
|
|
|
pacer_bitrate_stats.average);
|
2017-11-09 11:09:25 +01:00
|
|
|
RTC_LOG(LS_INFO) << "WebRTC.Call.PacerBitrateInKbps, "
|
|
|
|
|
<< pacer_bitrate_stats.ToString();
|
2015-11-17 06:24:56 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Call::UpdateReceiveHistograms() {
|
2017-07-04 04:05:06 -07:00
|
|
|
if (first_received_rtp_audio_ms_) {
|
|
|
|
|
RTC_HISTOGRAM_COUNTS_100000(
|
|
|
|
|
"WebRTC.Call.TimeReceivingAudioRtpPacketsInSeconds",
|
|
|
|
|
(*last_received_rtp_audio_ms_ - *first_received_rtp_audio_ms_) / 1000);
|
|
|
|
|
}
|
|
|
|
|
if (first_received_rtp_video_ms_) {
|
|
|
|
|
RTC_HISTOGRAM_COUNTS_100000(
|
|
|
|
|
"WebRTC.Call.TimeReceivingVideoRtpPacketsInSeconds",
|
|
|
|
|
(*last_received_rtp_video_ms_ - *first_received_rtp_video_ms_) / 1000);
|
|
|
|
|
}
|
2016-09-08 00:07:21 -07:00
|
|
|
const int kMinRequiredPeriodicSamples = 5;
|
|
|
|
|
AggregatedStats video_bytes_per_sec =
|
|
|
|
|
received_video_bytes_per_second_counter_.GetStats();
|
|
|
|
|
if (video_bytes_per_sec.num_samples > kMinRequiredPeriodicSamples) {
|
2016-09-09 22:40:25 -07:00
|
|
|
RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.VideoBitrateReceivedInKbps",
|
|
|
|
|
video_bytes_per_sec.average * 8 / 1000);
|
2017-11-09 11:09:25 +01:00
|
|
|
RTC_LOG(LS_INFO) << "WebRTC.Call.VideoBitrateReceivedInBps, "
|
|
|
|
|
<< video_bytes_per_sec.ToStringWithMultiplier(8);
|
2015-11-11 10:13:02 -08:00
|
|
|
}
|
2016-09-08 00:07:21 -07:00
|
|
|
AggregatedStats audio_bytes_per_sec =
|
|
|
|
|
received_audio_bytes_per_second_counter_.GetStats();
|
|
|
|
|
if (audio_bytes_per_sec.num_samples > kMinRequiredPeriodicSamples) {
|
2016-09-09 22:40:25 -07:00
|
|
|
RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.AudioBitrateReceivedInKbps",
|
|
|
|
|
audio_bytes_per_sec.average * 8 / 1000);
|
2017-11-09 11:09:25 +01:00
|
|
|
RTC_LOG(LS_INFO) << "WebRTC.Call.AudioBitrateReceivedInBps, "
|
|
|
|
|
<< audio_bytes_per_sec.ToStringWithMultiplier(8);
|
2015-11-11 10:13:02 -08:00
|
|
|
}
|
2016-09-08 00:07:21 -07:00
|
|
|
AggregatedStats rtcp_bytes_per_sec =
|
|
|
|
|
received_rtcp_bytes_per_second_counter_.GetStats();
|
|
|
|
|
if (rtcp_bytes_per_sec.num_samples > kMinRequiredPeriodicSamples) {
|
2016-09-09 22:40:25 -07:00
|
|
|
RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.RtcpBitrateReceivedInBps",
|
|
|
|
|
rtcp_bytes_per_sec.average * 8);
|
2017-11-09 11:09:25 +01:00
|
|
|
RTC_LOG(LS_INFO) << "WebRTC.Call.RtcpBitrateReceivedInBps, "
|
|
|
|
|
<< rtcp_bytes_per_sec.ToStringWithMultiplier(8);
|
2016-09-08 00:07:21 -07:00
|
|
|
}
|
|
|
|
|
AggregatedStats recv_bytes_per_sec =
|
|
|
|
|
received_bytes_per_second_counter_.GetStats();
|
|
|
|
|
if (recv_bytes_per_sec.num_samples > kMinRequiredPeriodicSamples) {
|
2016-09-09 22:40:25 -07:00
|
|
|
RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.BitrateReceivedInKbps",
|
|
|
|
|
recv_bytes_per_sec.average * 8 / 1000);
|
2017-11-09 11:09:25 +01:00
|
|
|
RTC_LOG(LS_INFO) << "WebRTC.Call.BitrateReceivedInBps, "
|
|
|
|
|
<< recv_bytes_per_sec.ToStringWithMultiplier(8);
|
2015-11-11 10:13:02 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-19 03:39:20 -07:00
|
|
|
PacketReceiver* Call::Receiver() {
|
2019-04-09 13:44:04 +02:00
|
|
|
RTC_DCHECK_RUN_ON(&configuration_sequence_checker_);
|
2015-10-19 03:39:20 -07:00
|
|
|
return this;
|
|
|
|
|
}
|
2013-05-16 12:08:03 +00:00
|
|
|
|
2015-06-08 13:04:56 +02:00
|
|
|
webrtc::AudioSendStream* Call::CreateAudioSendStream(
|
|
|
|
|
const webrtc::AudioSendStream::Config& config) {
|
2015-10-16 14:35:07 -07:00
|
|
|
TRACE_EVENT0("webrtc", "Call::CreateAudioSendStream");
|
2019-04-09 13:44:04 +02:00
|
|
|
RTC_DCHECK_RUN_ON(&configuration_sequence_checker_);
|
2018-11-15 08:26:19 -08:00
|
|
|
|
|
|
|
|
RegisterRateObserver();
|
|
|
|
|
|
2018-10-30 16:11:02 +01:00
|
|
|
// Stream config is logged in AudioSendStream::ConfigureStream, as it may
|
|
|
|
|
// change during the stream's lifetime.
|
2018-06-15 12:28:07 +02:00
|
|
|
absl::optional<RtpState> suspended_rtp_state;
|
2017-05-23 06:07:11 -07:00
|
|
|
{
|
|
|
|
|
const auto& iter = suspended_audio_send_ssrcs_.find(config.rtp.ssrc);
|
|
|
|
|
if (iter != suspended_audio_send_ssrcs_.end()) {
|
|
|
|
|
suspended_rtp_state.emplace(iter->second);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-08 14:50:30 +01:00
|
|
|
AudioSendStream* send_stream =
|
|
|
|
|
new AudioSendStream(clock_, config, config_.audio_state,
|
|
|
|
|
task_queue_factory_, module_process_thread_.get(),
|
|
|
|
|
transport_send_ptr_, bitrate_allocator_.get(),
|
|
|
|
|
event_log_, call_stats_.get(), suspended_rtp_state);
|
2015-10-16 14:35:07 -07:00
|
|
|
{
|
|
|
|
|
WriteLockScoped write_lock(*send_crit_);
|
|
|
|
|
RTC_DCHECK(audio_send_ssrcs_.find(config.rtp.ssrc) ==
|
|
|
|
|
audio_send_ssrcs_.end());
|
|
|
|
|
audio_send_ssrcs_[config.rtp.ssrc] = send_stream;
|
|
|
|
|
}
|
2016-11-14 11:30:07 -08:00
|
|
|
{
|
|
|
|
|
ReadLockScoped read_lock(*receive_crit_);
|
2017-05-16 04:47:04 -07:00
|
|
|
for (AudioReceiveStream* stream : audio_receive_streams_) {
|
|
|
|
|
if (stream->config().rtp.local_ssrc == config.rtp.ssrc) {
|
|
|
|
|
stream->AssociateSendStream(send_stream);
|
2016-11-14 11:30:07 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-03-22 15:32:27 -07:00
|
|
|
send_stream->SignalNetworkState(audio_network_state_);
|
|
|
|
|
UpdateAggregateNetworkState();
|
2015-10-16 14:35:07 -07:00
|
|
|
return send_stream;
|
2015-06-08 13:04:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Call::DestroyAudioSendStream(webrtc::AudioSendStream* send_stream) {
|
2015-10-16 14:35:07 -07:00
|
|
|
TRACE_EVENT0("webrtc", "Call::DestroyAudioSendStream");
|
2019-04-09 13:44:04 +02:00
|
|
|
RTC_DCHECK_RUN_ON(&configuration_sequence_checker_);
|
2015-10-16 14:35:07 -07:00
|
|
|
RTC_DCHECK(send_stream != nullptr);
|
|
|
|
|
|
|
|
|
|
send_stream->Stop();
|
|
|
|
|
|
2017-07-26 02:09:44 -07:00
|
|
|
const uint32_t ssrc = send_stream->GetConfig().rtp.ssrc;
|
2015-10-16 14:35:07 -07:00
|
|
|
webrtc::internal::AudioSendStream* audio_send_stream =
|
|
|
|
|
static_cast<webrtc::internal::AudioSendStream*>(send_stream);
|
2017-05-23 06:07:11 -07:00
|
|
|
suspended_audio_send_ssrcs_[ssrc] = audio_send_stream->GetRtpState();
|
2015-10-16 14:35:07 -07:00
|
|
|
{
|
|
|
|
|
WriteLockScoped write_lock(*send_crit_);
|
2016-11-14 11:30:07 -08:00
|
|
|
size_t num_deleted = audio_send_ssrcs_.erase(ssrc);
|
|
|
|
|
RTC_DCHECK_EQ(1, num_deleted);
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
ReadLockScoped read_lock(*receive_crit_);
|
2017-05-16 04:47:04 -07:00
|
|
|
for (AudioReceiveStream* stream : audio_receive_streams_) {
|
|
|
|
|
if (stream->config().rtp.local_ssrc == ssrc) {
|
|
|
|
|
stream->AssociateSendStream(nullptr);
|
2016-11-14 11:30:07 -08:00
|
|
|
}
|
|
|
|
|
}
|
2015-10-16 14:35:07 -07:00
|
|
|
}
|
2016-03-22 15:32:27 -07:00
|
|
|
UpdateAggregateNetworkState();
|
2017-07-26 02:09:44 -07:00
|
|
|
delete send_stream;
|
2015-06-08 13:04:56 +02:00
|
|
|
}
|
|
|
|
|
|
2015-04-29 15:24:01 +02:00
|
|
|
webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream(
|
|
|
|
|
const webrtc::AudioReceiveStream::Config& config) {
|
|
|
|
|
TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream");
|
2019-04-09 13:44:04 +02:00
|
|
|
RTC_DCHECK_RUN_ON(&configuration_sequence_checker_);
|
2018-12-18 11:17:09 -08:00
|
|
|
RegisterRateObserver();
|
Use absl::make_unique and absl::WrapUnique directly
Instead of going through our wrappers in ptr_util.h.
This CL was generated by the following script:
git grep -l ptr_util | xargs perl -pi -e 's,#include "rtc_base/ptr_util.h",#include "absl/memory/memory.h",'
git grep -l MakeUnique | xargs perl -pi -e 's,\b(rtc::)?MakeUnique\b,absl::make_unique,g'
git grep -l WrapUnique | xargs perl -pi -e 's,\b(rtc::)?WrapUnique\b,absl::WrapUnique,g'
git checkout -- rtc_base/ptr_util{.h,_unittest.cc}
git cl format
Followed by manually adding dependencies on
//third_party/abseil-cpp/absl/memory until `gn check` stopped
complaining.
Bug: webrtc:9473
Change-Id: I89ccd363f070479b8c431eb2c3d404a46eaacc1c
Reviewed-on: https://webrtc-review.googlesource.com/86600
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23850}
2018-07-05 11:40:33 +02:00
|
|
|
event_log_->Log(absl::make_unique<RtcEventAudioReceiveStreamConfig>(
|
2017-10-03 16:11:34 +02:00
|
|
|
CreateRtcLogStreamConfig(config)));
|
2017-06-21 01:05:22 -07:00
|
|
|
AudioReceiveStream* receive_stream = new AudioReceiveStream(
|
2019-03-04 17:43:34 +01:00
|
|
|
clock_, &audio_receiver_controller_, transport_send_ptr_->packet_router(),
|
2018-01-11 13:52:30 +01:00
|
|
|
module_process_thread_.get(), config, config_.audio_state, event_log_);
|
2015-04-29 15:24:01 +02:00
|
|
|
{
|
|
|
|
|
WriteLockScoped write_lock(*receive_crit_);
|
2018-03-14 15:16:50 +01:00
|
|
|
receive_rtp_config_.emplace(config.rtp.remote_ssrc,
|
|
|
|
|
ReceiveRtpConfig(config));
|
2017-05-16 04:47:04 -07:00
|
|
|
audio_receive_streams_.insert(receive_stream);
|
2017-02-06 02:23:00 -08:00
|
|
|
|
2015-07-15 08:02:58 -07:00
|
|
|
ConfigureSync(config.sync_group);
|
2015-04-29 15:24:01 +02:00
|
|
|
}
|
2016-11-14 11:30:07 -08:00
|
|
|
{
|
|
|
|
|
ReadLockScoped read_lock(*send_crit_);
|
|
|
|
|
auto it = audio_send_ssrcs_.find(config.rtp.local_ssrc);
|
|
|
|
|
if (it != audio_send_ssrcs_.end()) {
|
|
|
|
|
receive_stream->AssociateSendStream(it->second);
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-03-22 15:32:27 -07:00
|
|
|
receive_stream->SignalNetworkState(audio_network_state_);
|
|
|
|
|
UpdateAggregateNetworkState();
|
2015-04-29 15:24:01 +02:00
|
|
|
return receive_stream;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Call::DestroyAudioReceiveStream(
|
|
|
|
|
webrtc::AudioReceiveStream* receive_stream) {
|
|
|
|
|
TRACE_EVENT0("webrtc", "Call::DestroyAudioReceiveStream");
|
2019-04-09 13:44:04 +02:00
|
|
|
RTC_DCHECK_RUN_ON(&configuration_sequence_checker_);
|
2015-09-17 00:24:34 -07:00
|
|
|
RTC_DCHECK(receive_stream != nullptr);
|
2015-10-16 14:35:07 -07:00
|
|
|
webrtc::internal::AudioReceiveStream* audio_receive_stream =
|
|
|
|
|
static_cast<webrtc::internal::AudioReceiveStream*>(receive_stream);
|
2015-04-29 15:24:01 +02:00
|
|
|
{
|
|
|
|
|
WriteLockScoped write_lock(*receive_crit_);
|
2017-02-07 01:18:43 -08:00
|
|
|
const AudioReceiveStream::Config& config = audio_receive_stream->config();
|
|
|
|
|
uint32_t ssrc = config.rtp.remote_ssrc;
|
2017-03-21 06:41:12 -07:00
|
|
|
receive_side_cc_.GetRemoteBitrateEstimator(UseSendSideBwe(config))
|
2017-02-07 01:18:43 -08:00
|
|
|
->RemoveStream(ssrc);
|
2017-05-16 04:47:04 -07:00
|
|
|
audio_receive_streams_.erase(audio_receive_stream);
|
2015-07-15 08:02:58 -07:00
|
|
|
const std::string& sync_group = audio_receive_stream->config().sync_group;
|
|
|
|
|
const auto it = sync_stream_mapping_.find(sync_group);
|
|
|
|
|
if (it != sync_stream_mapping_.end() &&
|
|
|
|
|
it->second == audio_receive_stream) {
|
|
|
|
|
sync_stream_mapping_.erase(it);
|
|
|
|
|
ConfigureSync(sync_group);
|
|
|
|
|
}
|
2017-02-06 02:23:00 -08:00
|
|
|
receive_rtp_config_.erase(ssrc);
|
2015-04-29 15:24:01 +02:00
|
|
|
}
|
2016-03-22 15:32:27 -07:00
|
|
|
UpdateAggregateNetworkState();
|
2015-04-29 15:24:01 +02:00
|
|
|
delete audio_receive_stream;
|
|
|
|
|
}
|
|
|
|
|
|
Revert "Revert "Enables PeerConnectionFactory using external fec controller""
This reverts commit 00733015fafbbc61ddc12dfdc88b21a9fcd9d122.
Reason for revert: The reason for a downstream test failure on the original commit and a workaround has been found. Solution is to keep a PeerConnectionFactory constructor implementation as the same as before.
Original change's description:
> Revert "Enables PeerConnectionFactory using external fec controller"
>
> This reverts commit 4f07bdb25567d8ef528311e0b50a62c61d543fc3.
>
> Reason for revert: Speculatively reverting, because downstream test is now hitting "PeerConnectionFactory.initialize was not called before creating a PeerConnectionFactory" error, even though it did call initialize. I don't see how any change in this CL could cause that, but it's the only CL on the blamelist, and it does modify PeerConnectionFactory.java
>
> Original change's description:
> > Enables PeerConnectionFactory using external fec controller
> >
> > Bug: webrtc:8799
> > Change-Id: Ieb2cf6163b9a83844ab9ed4822b4a7f1db4c24b8
> > Reviewed-on: https://webrtc-review.googlesource.com/43961
> > Commit-Queue: Ying Wang <yinwa@webrtc.org>
> > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> > Reviewed-by: Niels Moller <nisse@webrtc.org>
> > Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#22038}
>
> TBR=sakal@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org,stefan@webrtc.org,yinwa@webrtc.org
>
> Change-Id: I95868c35d6f9973e0ebf563814cd71d0fcbd433d
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:8799
> Reviewed-on: https://webrtc-review.googlesource.com/54080
> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22040}
TBR=deadbeef@webrtc.org,sakal@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org,stefan@webrtc.org,yinwa@webrtc.org
Bug: webrtc:8799
Change-Id: If9f3292bfcc739782967530c49f006d0abbc38a8
Reviewed-on: https://webrtc-review.googlesource.com/55400
Commit-Queue: Ying Wang <yinwa@webrtc.org>
Reviewed-by: Ying Wang <yinwa@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22100}
2018-02-20 12:50:27 +01:00
|
|
|
// This method can be used for Call tests with external fec controller factory.
|
2018-01-19 17:58:57 +01:00
|
|
|
webrtc::VideoSendStream* Call::CreateVideoSendStream(
|
|
|
|
|
webrtc::VideoSendStream::Config config,
|
|
|
|
|
VideoEncoderConfig encoder_config,
|
|
|
|
|
std::unique_ptr<FecController> fec_controller) {
|
2015-01-29 12:33:07 +00:00
|
|
|
TRACE_EVENT0("webrtc", "Call::CreateVideoSendStream");
|
2019-04-09 13:44:04 +02:00
|
|
|
RTC_DCHECK_RUN_ON(&configuration_sequence_checker_);
|
2013-06-10 13:48:26 +00:00
|
|
|
|
2018-11-15 08:26:19 -08:00
|
|
|
RegisterRateObserver();
|
|
|
|
|
|
2016-05-02 23:44:01 -07:00
|
|
|
video_send_delay_stats_->AddSsrcs(config);
|
2017-05-22 04:08:28 -07:00
|
|
|
for (size_t ssrc_index = 0; ssrc_index < config.rtp.ssrcs.size();
|
|
|
|
|
++ssrc_index) {
|
Use absl::make_unique and absl::WrapUnique directly
Instead of going through our wrappers in ptr_util.h.
This CL was generated by the following script:
git grep -l ptr_util | xargs perl -pi -e 's,#include "rtc_base/ptr_util.h",#include "absl/memory/memory.h",'
git grep -l MakeUnique | xargs perl -pi -e 's,\b(rtc::)?MakeUnique\b,absl::make_unique,g'
git grep -l WrapUnique | xargs perl -pi -e 's,\b(rtc::)?WrapUnique\b,absl::WrapUnique,g'
git checkout -- rtc_base/ptr_util{.h,_unittest.cc}
git cl format
Followed by manually adding dependencies on
//third_party/abseil-cpp/absl/memory until `gn check` stopped
complaining.
Bug: webrtc:9473
Change-Id: I89ccd363f070479b8c431eb2c3d404a46eaacc1c
Reviewed-on: https://webrtc-review.googlesource.com/86600
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23850}
2018-07-05 11:40:33 +02:00
|
|
|
event_log_->Log(absl::make_unique<RtcEventVideoSendStreamConfig>(
|
2017-10-03 16:11:34 +02:00
|
|
|
CreateRtcLogStreamConfig(config, ssrc_index)));
|
2017-05-22 04:08:28 -07:00
|
|
|
}
|
2016-09-01 01:17:40 -07:00
|
|
|
|
2014-06-16 08:57:39 +00:00
|
|
|
// TODO(mflodman): Base the start bitrate on a current bandwidth estimate, if
|
|
|
|
|
// the call has already started.
|
2016-09-01 01:17:40 -07:00
|
|
|
// Copy ssrcs from |config| since |config| is moved.
|
|
|
|
|
std::vector<uint32_t> ssrcs = config.rtp.ssrcs;
|
Revert "Revert "Enables PeerConnectionFactory using external fec controller""
This reverts commit 00733015fafbbc61ddc12dfdc88b21a9fcd9d122.
Reason for revert: The reason for a downstream test failure on the original commit and a workaround has been found. Solution is to keep a PeerConnectionFactory constructor implementation as the same as before.
Original change's description:
> Revert "Enables PeerConnectionFactory using external fec controller"
>
> This reverts commit 4f07bdb25567d8ef528311e0b50a62c61d543fc3.
>
> Reason for revert: Speculatively reverting, because downstream test is now hitting "PeerConnectionFactory.initialize was not called before creating a PeerConnectionFactory" error, even though it did call initialize. I don't see how any change in this CL could cause that, but it's the only CL on the blamelist, and it does modify PeerConnectionFactory.java
>
> Original change's description:
> > Enables PeerConnectionFactory using external fec controller
> >
> > Bug: webrtc:8799
> > Change-Id: Ieb2cf6163b9a83844ab9ed4822b4a7f1db4c24b8
> > Reviewed-on: https://webrtc-review.googlesource.com/43961
> > Commit-Queue: Ying Wang <yinwa@webrtc.org>
> > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> > Reviewed-by: Niels Moller <nisse@webrtc.org>
> > Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#22038}
>
> TBR=sakal@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org,stefan@webrtc.org,yinwa@webrtc.org
>
> Change-Id: I95868c35d6f9973e0ebf563814cd71d0fcbd433d
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:8799
> Reviewed-on: https://webrtc-review.googlesource.com/54080
> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22040}
TBR=deadbeef@webrtc.org,sakal@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org,stefan@webrtc.org,yinwa@webrtc.org
Bug: webrtc:8799
Change-Id: If9f3292bfcc739782967530c49f006d0abbc38a8
Reviewed-on: https://webrtc-review.googlesource.com/55400
Commit-Queue: Ying Wang <yinwa@webrtc.org>
Reviewed-by: Ying Wang <yinwa@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22100}
2018-02-20 12:50:27 +01:00
|
|
|
|
2015-10-21 15:52:16 +02:00
|
|
|
VideoSendStream* send_stream = new VideoSendStream(
|
2019-03-07 09:17:19 +01:00
|
|
|
clock_, num_cpu_cores_, module_process_thread_.get(), task_queue_factory_,
|
2019-03-01 11:50:20 +01:00
|
|
|
call_stats_.get(), transport_send_ptr_, bitrate_allocator_.get(),
|
2017-04-18 23:38:35 -07:00
|
|
|
video_send_delay_stats_.get(), event_log_, std::move(config),
|
2017-10-06 10:04:04 +02:00
|
|
|
std::move(encoder_config), suspended_video_send_ssrcs_,
|
2018-07-17 16:03:46 +02:00
|
|
|
suspended_video_payload_states_, std::move(fec_controller));
|
2016-09-01 01:17:40 -07:00
|
|
|
|
2016-03-22 15:32:27 -07:00
|
|
|
{
|
|
|
|
|
WriteLockScoped write_lock(*send_crit_);
|
2016-09-01 01:17:40 -07:00
|
|
|
for (uint32_t ssrc : ssrcs) {
|
2016-03-22 15:32:27 -07:00
|
|
|
RTC_DCHECK(video_send_ssrcs_.find(ssrc) == video_send_ssrcs_.end());
|
|
|
|
|
video_send_ssrcs_[ssrc] = send_stream;
|
|
|
|
|
}
|
|
|
|
|
video_send_streams_.insert(send_stream);
|
2013-05-16 12:08:03 +00:00
|
|
|
}
|
2016-03-22 15:32:27 -07:00
|
|
|
UpdateAggregateNetworkState();
|
2016-09-01 01:17:40 -07:00
|
|
|
|
2013-05-16 12:08:03 +00:00
|
|
|
return send_stream;
|
|
|
|
|
}
|
|
|
|
|
|
Revert "Revert "Enables PeerConnectionFactory using external fec controller""
This reverts commit 00733015fafbbc61ddc12dfdc88b21a9fcd9d122.
Reason for revert: The reason for a downstream test failure on the original commit and a workaround has been found. Solution is to keep a PeerConnectionFactory constructor implementation as the same as before.
Original change's description:
> Revert "Enables PeerConnectionFactory using external fec controller"
>
> This reverts commit 4f07bdb25567d8ef528311e0b50a62c61d543fc3.
>
> Reason for revert: Speculatively reverting, because downstream test is now hitting "PeerConnectionFactory.initialize was not called before creating a PeerConnectionFactory" error, even though it did call initialize. I don't see how any change in this CL could cause that, but it's the only CL on the blamelist, and it does modify PeerConnectionFactory.java
>
> Original change's description:
> > Enables PeerConnectionFactory using external fec controller
> >
> > Bug: webrtc:8799
> > Change-Id: Ieb2cf6163b9a83844ab9ed4822b4a7f1db4c24b8
> > Reviewed-on: https://webrtc-review.googlesource.com/43961
> > Commit-Queue: Ying Wang <yinwa@webrtc.org>
> > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> > Reviewed-by: Niels Moller <nisse@webrtc.org>
> > Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#22038}
>
> TBR=sakal@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org,stefan@webrtc.org,yinwa@webrtc.org
>
> Change-Id: I95868c35d6f9973e0ebf563814cd71d0fcbd433d
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:8799
> Reviewed-on: https://webrtc-review.googlesource.com/54080
> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22040}
TBR=deadbeef@webrtc.org,sakal@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org,stefan@webrtc.org,yinwa@webrtc.org
Bug: webrtc:8799
Change-Id: If9f3292bfcc739782967530c49f006d0abbc38a8
Reviewed-on: https://webrtc-review.googlesource.com/55400
Commit-Queue: Ying Wang <yinwa@webrtc.org>
Reviewed-by: Ying Wang <yinwa@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22100}
2018-02-20 12:50:27 +01:00
|
|
|
webrtc::VideoSendStream* Call::CreateVideoSendStream(
|
|
|
|
|
webrtc::VideoSendStream::Config config,
|
|
|
|
|
VideoEncoderConfig encoder_config) {
|
2018-03-05 15:44:23 +01:00
|
|
|
if (config_.fec_controller_factory) {
|
|
|
|
|
RTC_LOG(LS_INFO) << "External FEC Controller will be used.";
|
|
|
|
|
}
|
Revert "Revert "Enables PeerConnectionFactory using external fec controller""
This reverts commit 00733015fafbbc61ddc12dfdc88b21a9fcd9d122.
Reason for revert: The reason for a downstream test failure on the original commit and a workaround has been found. Solution is to keep a PeerConnectionFactory constructor implementation as the same as before.
Original change's description:
> Revert "Enables PeerConnectionFactory using external fec controller"
>
> This reverts commit 4f07bdb25567d8ef528311e0b50a62c61d543fc3.
>
> Reason for revert: Speculatively reverting, because downstream test is now hitting "PeerConnectionFactory.initialize was not called before creating a PeerConnectionFactory" error, even though it did call initialize. I don't see how any change in this CL could cause that, but it's the only CL on the blamelist, and it does modify PeerConnectionFactory.java
>
> Original change's description:
> > Enables PeerConnectionFactory using external fec controller
> >
> > Bug: webrtc:8799
> > Change-Id: Ieb2cf6163b9a83844ab9ed4822b4a7f1db4c24b8
> > Reviewed-on: https://webrtc-review.googlesource.com/43961
> > Commit-Queue: Ying Wang <yinwa@webrtc.org>
> > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> > Reviewed-by: Niels Moller <nisse@webrtc.org>
> > Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#22038}
>
> TBR=sakal@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org,stefan@webrtc.org,yinwa@webrtc.org
>
> Change-Id: I95868c35d6f9973e0ebf563814cd71d0fcbd433d
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:8799
> Reviewed-on: https://webrtc-review.googlesource.com/54080
> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22040}
TBR=deadbeef@webrtc.org,sakal@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org,stefan@webrtc.org,yinwa@webrtc.org
Bug: webrtc:8799
Change-Id: If9f3292bfcc739782967530c49f006d0abbc38a8
Reviewed-on: https://webrtc-review.googlesource.com/55400
Commit-Queue: Ying Wang <yinwa@webrtc.org>
Reviewed-by: Ying Wang <yinwa@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22100}
2018-02-20 12:50:27 +01:00
|
|
|
std::unique_ptr<FecController> fec_controller =
|
|
|
|
|
config_.fec_controller_factory
|
|
|
|
|
? config_.fec_controller_factory->CreateFecController()
|
2019-03-29 14:17:26 +01:00
|
|
|
: absl::make_unique<FecControllerDefault>(clock_);
|
Revert "Revert "Enables PeerConnectionFactory using external fec controller""
This reverts commit 00733015fafbbc61ddc12dfdc88b21a9fcd9d122.
Reason for revert: The reason for a downstream test failure on the original commit and a workaround has been found. Solution is to keep a PeerConnectionFactory constructor implementation as the same as before.
Original change's description:
> Revert "Enables PeerConnectionFactory using external fec controller"
>
> This reverts commit 4f07bdb25567d8ef528311e0b50a62c61d543fc3.
>
> Reason for revert: Speculatively reverting, because downstream test is now hitting "PeerConnectionFactory.initialize was not called before creating a PeerConnectionFactory" error, even though it did call initialize. I don't see how any change in this CL could cause that, but it's the only CL on the blamelist, and it does modify PeerConnectionFactory.java
>
> Original change's description:
> > Enables PeerConnectionFactory using external fec controller
> >
> > Bug: webrtc:8799
> > Change-Id: Ieb2cf6163b9a83844ab9ed4822b4a7f1db4c24b8
> > Reviewed-on: https://webrtc-review.googlesource.com/43961
> > Commit-Queue: Ying Wang <yinwa@webrtc.org>
> > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> > Reviewed-by: Niels Moller <nisse@webrtc.org>
> > Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#22038}
>
> TBR=sakal@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org,stefan@webrtc.org,yinwa@webrtc.org
>
> Change-Id: I95868c35d6f9973e0ebf563814cd71d0fcbd433d
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:8799
> Reviewed-on: https://webrtc-review.googlesource.com/54080
> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22040}
TBR=deadbeef@webrtc.org,sakal@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org,stefan@webrtc.org,yinwa@webrtc.org
Bug: webrtc:8799
Change-Id: If9f3292bfcc739782967530c49f006d0abbc38a8
Reviewed-on: https://webrtc-review.googlesource.com/55400
Commit-Queue: Ying Wang <yinwa@webrtc.org>
Reviewed-by: Ying Wang <yinwa@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22100}
2018-02-20 12:50:27 +01:00
|
|
|
return CreateVideoSendStream(std::move(config), std::move(encoder_config),
|
|
|
|
|
std::move(fec_controller));
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-21 13:49:43 +00:00
|
|
|
void Call::DestroyVideoSendStream(webrtc::VideoSendStream* send_stream) {
|
2015-01-29 12:33:07 +00:00
|
|
|
TRACE_EVENT0("webrtc", "Call::DestroyVideoSendStream");
|
2015-09-17 00:24:34 -07:00
|
|
|
RTC_DCHECK(send_stream != nullptr);
|
2019-04-09 13:44:04 +02:00
|
|
|
RTC_DCHECK_RUN_ON(&configuration_sequence_checker_);
|
2013-09-05 12:38:54 +00:00
|
|
|
|
2014-07-07 13:06:48 +00:00
|
|
|
send_stream->Stop();
|
|
|
|
|
|
2015-03-23 13:12:24 +00:00
|
|
|
VideoSendStream* send_stream_impl = nullptr;
|
2013-09-05 12:38:54 +00:00
|
|
|
{
|
2014-09-03 16:17:12 +00:00
|
|
|
WriteLockScoped write_lock(*send_crit_);
|
2015-04-29 15:24:01 +02:00
|
|
|
auto it = video_send_ssrcs_.begin();
|
|
|
|
|
while (it != video_send_ssrcs_.end()) {
|
2013-09-05 12:38:54 +00:00
|
|
|
if (it->second == static_cast<VideoSendStream*>(send_stream)) {
|
|
|
|
|
send_stream_impl = it->second;
|
2015-04-29 15:24:01 +02:00
|
|
|
video_send_ssrcs_.erase(it++);
|
2014-07-07 13:06:48 +00:00
|
|
|
} else {
|
|
|
|
|
++it;
|
2013-09-05 12:38:54 +00:00
|
|
|
}
|
|
|
|
|
}
|
2015-04-29 15:24:01 +02:00
|
|
|
video_send_streams_.erase(send_stream_impl);
|
2013-05-16 12:08:03 +00:00
|
|
|
}
|
2015-09-17 00:24:34 -07:00
|
|
|
RTC_CHECK(send_stream_impl != nullptr);
|
2013-09-05 12:38:54 +00:00
|
|
|
|
2017-10-06 10:04:04 +02:00
|
|
|
VideoSendStream::RtpStateMap rtp_states;
|
|
|
|
|
VideoSendStream::RtpPayloadStateMap rtp_payload_states;
|
|
|
|
|
send_stream_impl->StopPermanentlyAndGetRtpStates(&rtp_states,
|
|
|
|
|
&rtp_payload_states);
|
|
|
|
|
for (const auto& kv : rtp_states) {
|
|
|
|
|
suspended_video_send_ssrcs_[kv.first] = kv.second;
|
|
|
|
|
}
|
|
|
|
|
for (const auto& kv : rtp_payload_states) {
|
|
|
|
|
suspended_video_payload_states_[kv.first] = kv.second;
|
2014-07-07 13:06:48 +00:00
|
|
|
}
|
|
|
|
|
|
2016-03-22 15:32:27 -07:00
|
|
|
UpdateAggregateNetworkState();
|
2013-09-05 12:38:54 +00:00
|
|
|
delete send_stream_impl;
|
2013-05-16 12:08:03 +00:00
|
|
|
}
|
|
|
|
|
|
2015-04-29 15:24:01 +02:00
|
|
|
webrtc::VideoReceiveStream* Call::CreateVideoReceiveStream(
|
2016-06-10 17:58:01 +02:00
|
|
|
webrtc::VideoReceiveStream::Config configuration) {
|
2015-01-29 12:33:07 +00:00
|
|
|
TRACE_EVENT0("webrtc", "Call::CreateVideoReceiveStream");
|
2019-04-09 13:44:04 +02:00
|
|
|
RTC_DCHECK_RUN_ON(&configuration_sequence_checker_);
|
2017-01-27 06:47:55 -08:00
|
|
|
|
2019-04-08 12:57:06 +02:00
|
|
|
receive_side_cc_.SetSendPeriodicFeedback(
|
|
|
|
|
SendPeriodicFeedback(configuration.rtp.extensions));
|
2019-02-07 12:50:18 +01:00
|
|
|
|
2018-12-18 11:17:09 -08:00
|
|
|
RegisterRateObserver();
|
|
|
|
|
|
2017-06-21 01:05:22 -07:00
|
|
|
VideoReceiveStream* receive_stream = new VideoReceiveStream(
|
2019-03-01 18:48:16 +01:00
|
|
|
task_queue_factory_, &video_receiver_controller_, num_cpu_cores_,
|
2018-05-04 14:08:15 +02:00
|
|
|
transport_send_ptr_->packet_router(), std::move(configuration),
|
2019-03-04 19:39:01 +01:00
|
|
|
module_process_thread_.get(), call_stats_.get(), clock_);
|
2016-06-10 17:58:01 +02:00
|
|
|
|
|
|
|
|
const webrtc::VideoReceiveStream::Config& config = receive_stream->config();
|
2016-03-22 15:32:27 -07:00
|
|
|
{
|
|
|
|
|
WriteLockScoped write_lock(*receive_crit_);
|
2017-02-06 02:23:00 -08:00
|
|
|
if (config.rtp.rtx_ssrc) {
|
|
|
|
|
// We record identical config for the rtx stream as for the main
|
2017-03-27 05:36:15 -07:00
|
|
|
// stream. Since the transport_send_cc negotiation is per payload
|
2017-02-06 02:23:00 -08:00
|
|
|
// type, we may get an incorrect value for the rtx stream, but
|
|
|
|
|
// that is unlikely to matter in practice.
|
2018-03-14 15:16:50 +01:00
|
|
|
receive_rtp_config_.emplace(config.rtp.rtx_ssrc,
|
|
|
|
|
ReceiveRtpConfig(config));
|
2017-02-06 02:23:00 -08:00
|
|
|
}
|
2018-03-14 15:16:50 +01:00
|
|
|
receive_rtp_config_.emplace(config.rtp.remote_ssrc,
|
|
|
|
|
ReceiveRtpConfig(config));
|
2016-03-22 15:32:27 -07:00
|
|
|
video_receive_streams_.insert(receive_stream);
|
|
|
|
|
ConfigureSync(config.sync_group);
|
|
|
|
|
}
|
|
|
|
|
receive_stream->SignalNetworkState(video_network_state_);
|
|
|
|
|
UpdateAggregateNetworkState();
|
Use absl::make_unique and absl::WrapUnique directly
Instead of going through our wrappers in ptr_util.h.
This CL was generated by the following script:
git grep -l ptr_util | xargs perl -pi -e 's,#include "rtc_base/ptr_util.h",#include "absl/memory/memory.h",'
git grep -l MakeUnique | xargs perl -pi -e 's,\b(rtc::)?MakeUnique\b,absl::make_unique,g'
git grep -l WrapUnique | xargs perl -pi -e 's,\b(rtc::)?WrapUnique\b,absl::WrapUnique,g'
git checkout -- rtc_base/ptr_util{.h,_unittest.cc}
git cl format
Followed by manually adding dependencies on
//third_party/abseil-cpp/absl/memory until `gn check` stopped
complaining.
Bug: webrtc:9473
Change-Id: I89ccd363f070479b8c431eb2c3d404a46eaacc1c
Reviewed-on: https://webrtc-review.googlesource.com/86600
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23850}
2018-07-05 11:40:33 +02:00
|
|
|
event_log_->Log(absl::make_unique<RtcEventVideoReceiveStreamConfig>(
|
2017-10-03 16:11:34 +02:00
|
|
|
CreateRtcLogStreamConfig(config)));
|
2013-05-16 12:08:03 +00:00
|
|
|
return receive_stream;
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-21 13:49:43 +00:00
|
|
|
void Call::DestroyVideoReceiveStream(
|
|
|
|
|
webrtc::VideoReceiveStream* receive_stream) {
|
2015-01-29 12:33:07 +00:00
|
|
|
TRACE_EVENT0("webrtc", "Call::DestroyVideoReceiveStream");
|
2019-04-09 13:44:04 +02:00
|
|
|
RTC_DCHECK_RUN_ON(&configuration_sequence_checker_);
|
2015-09-17 00:24:34 -07:00
|
|
|
RTC_DCHECK(receive_stream != nullptr);
|
2017-05-16 04:47:04 -07:00
|
|
|
VideoReceiveStream* receive_stream_impl =
|
|
|
|
|
static_cast<VideoReceiveStream*>(receive_stream);
|
|
|
|
|
const VideoReceiveStream::Config& config = receive_stream_impl->config();
|
2013-09-05 12:38:54 +00:00
|
|
|
{
|
2014-09-03 16:17:12 +00:00
|
|
|
WriteLockScoped write_lock(*receive_crit_);
|
2014-01-24 09:30:53 +00:00
|
|
|
// Remove all ssrcs pointing to a receive stream. As RTX retransmits on a
|
|
|
|
|
// separate SSRC there can be either one or two.
|
2017-05-16 04:47:04 -07:00
|
|
|
receive_rtp_config_.erase(config.rtp.remote_ssrc);
|
|
|
|
|
if (config.rtp.rtx_ssrc) {
|
|
|
|
|
receive_rtp_config_.erase(config.rtp.rtx_ssrc);
|
2013-09-05 12:38:54 +00:00
|
|
|
}
|
2015-04-29 15:24:01 +02:00
|
|
|
video_receive_streams_.erase(receive_stream_impl);
|
2017-05-16 04:47:04 -07:00
|
|
|
ConfigureSync(config.sync_group);
|
2013-05-16 12:08:03 +00:00
|
|
|
}
|
2017-02-07 01:18:43 -08:00
|
|
|
|
2017-03-21 06:41:12 -07:00
|
|
|
receive_side_cc_.GetRemoteBitrateEstimator(UseSendSideBwe(config))
|
2017-02-07 01:18:43 -08:00
|
|
|
->RemoveStream(config.rtp.remote_ssrc);
|
|
|
|
|
|
2016-03-22 15:32:27 -07:00
|
|
|
UpdateAggregateNetworkState();
|
2013-09-05 12:38:54 +00:00
|
|
|
delete receive_stream_impl;
|
2013-05-16 12:08:03 +00:00
|
|
|
}
|
|
|
|
|
|
2016-12-19 01:13:46 -08:00
|
|
|
FlexfecReceiveStream* Call::CreateFlexfecReceiveStream(
|
|
|
|
|
const FlexfecReceiveStream::Config& config) {
|
2016-10-23 23:37:14 -07:00
|
|
|
TRACE_EVENT0("webrtc", "Call::CreateFlexfecReceiveStream");
|
2019-04-09 13:44:04 +02:00
|
|
|
RTC_DCHECK_RUN_ON(&configuration_sequence_checker_);
|
2016-12-21 06:37:18 -08:00
|
|
|
|
|
|
|
|
RecoveredPacketReceiver* recovered_packet_receiver = this;
|
2016-10-23 23:37:14 -07:00
|
|
|
|
2017-06-21 01:05:22 -07:00
|
|
|
FlexfecReceiveStreamImpl* receive_stream;
|
2016-10-23 23:37:14 -07:00
|
|
|
{
|
|
|
|
|
WriteLockScoped write_lock(*receive_crit_);
|
2017-06-21 01:05:22 -07:00
|
|
|
// Unlike the video and audio receive streams,
|
|
|
|
|
// FlexfecReceiveStream implements RtpPacketSinkInterface itself,
|
|
|
|
|
// and hence its constructor passes its |this| pointer to
|
2017-07-03 09:25:27 -07:00
|
|
|
// video_receiver_controller_->CreateStream(). Calling the
|
2017-06-21 01:05:22 -07:00
|
|
|
// constructor while holding |receive_crit_| ensures that we don't
|
|
|
|
|
// call OnRtpPacket until the constructor is finished and the
|
|
|
|
|
// object is in a valid state.
|
|
|
|
|
// TODO(nisse): Fix constructor so that it can be moved outside of
|
|
|
|
|
// this locked scope.
|
|
|
|
|
receive_stream = new FlexfecReceiveStreamImpl(
|
2019-03-04 19:39:01 +01:00
|
|
|
clock_, &video_receiver_controller_, config, recovered_packet_receiver,
|
2018-03-27 23:11:09 +02:00
|
|
|
call_stats_.get(), module_process_thread_.get());
|
2016-12-21 06:37:18 -08:00
|
|
|
|
2017-02-06 02:23:00 -08:00
|
|
|
RTC_DCHECK(receive_rtp_config_.find(config.remote_ssrc) ==
|
|
|
|
|
receive_rtp_config_.end());
|
2018-03-14 15:16:50 +01:00
|
|
|
receive_rtp_config_.emplace(config.remote_ssrc, ReceiveRtpConfig(config));
|
2016-10-23 23:37:14 -07:00
|
|
|
}
|
2016-12-21 06:37:18 -08:00
|
|
|
|
2016-10-23 23:37:14 -07:00
|
|
|
// TODO(brandtr): Store config in RtcEventLog here.
|
2016-12-21 06:37:18 -08:00
|
|
|
|
2016-10-23 23:37:14 -07:00
|
|
|
return receive_stream;
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-19 01:13:46 -08:00
|
|
|
void Call::DestroyFlexfecReceiveStream(FlexfecReceiveStream* receive_stream) {
|
2016-10-23 23:37:14 -07:00
|
|
|
TRACE_EVENT0("webrtc", "Call::DestroyFlexfecReceiveStream");
|
2019-04-09 13:44:04 +02:00
|
|
|
RTC_DCHECK_RUN_ON(&configuration_sequence_checker_);
|
2016-12-21 06:37:18 -08:00
|
|
|
|
2016-10-23 23:37:14 -07:00
|
|
|
RTC_DCHECK(receive_stream != nullptr);
|
|
|
|
|
{
|
|
|
|
|
WriteLockScoped write_lock(*receive_crit_);
|
2016-12-21 06:37:18 -08:00
|
|
|
|
2017-07-25 06:40:06 -07:00
|
|
|
const FlexfecReceiveStream::Config& config = receive_stream->GetConfig();
|
2017-02-07 01:18:43 -08:00
|
|
|
uint32_t ssrc = config.remote_ssrc;
|
2017-02-06 02:23:00 -08:00
|
|
|
receive_rtp_config_.erase(ssrc);
|
2016-12-21 06:37:18 -08:00
|
|
|
|
2016-12-19 01:13:46 -08:00
|
|
|
// Remove all SSRCs pointing to the FlexfecReceiveStreamImpl to be
|
|
|
|
|
// destroyed.
|
2017-03-21 06:41:12 -07:00
|
|
|
receive_side_cc_.GetRemoteBitrateEstimator(UseSendSideBwe(config))
|
2017-02-07 01:18:43 -08:00
|
|
|
->RemoveStream(ssrc);
|
2016-10-23 23:37:14 -07:00
|
|
|
}
|
2016-12-21 06:37:18 -08:00
|
|
|
|
2017-07-25 06:40:06 -07:00
|
|
|
delete receive_stream;
|
2016-10-23 23:37:14 -07:00
|
|
|
}
|
|
|
|
|
|
2018-02-21 13:07:13 +01:00
|
|
|
RtpTransportControllerSendInterface* Call::GetTransportControllerSend() {
|
2018-05-04 14:08:15 +02:00
|
|
|
return transport_send_ptr_;
|
2018-02-21 13:07:13 +01:00
|
|
|
}
|
|
|
|
|
|
2014-11-05 14:05:29 +00:00
|
|
|
Call::Stats Call::GetStats() const {
|
2019-08-09 11:42:32 +02:00
|
|
|
RTC_DCHECK_RUN_ON(&configuration_sequence_checker_);
|
|
|
|
|
|
|
|
|
|
// TODO(tommi): The following stats are managed on the process thread:
|
|
|
|
|
// - pacer_delay_ms (PacedSender::Process)
|
|
|
|
|
// - rtt_ms
|
|
|
|
|
// - recv_bandwidth_bps
|
|
|
|
|
// These are delivered on the network TQ:
|
|
|
|
|
// - send_bandwidth_bps (see OnTargetTransferRate)
|
|
|
|
|
// - max_padding_bitrate_bps (see OnAllocationLimitsChanged)
|
|
|
|
|
|
2014-11-05 14:05:29 +00:00
|
|
|
Stats stats;
|
2019-08-09 11:42:32 +02:00
|
|
|
// TODO(srte): It is unclear if we only want to report queues if network is
|
|
|
|
|
// available.
|
|
|
|
|
stats.pacer_delay_ms =
|
|
|
|
|
aggregate_network_up_ ? transport_send_ptr_->GetPacerQueuingDelayMs() : 0;
|
|
|
|
|
|
|
|
|
|
stats.rtt_ms = call_stats_->LastProcessedRtt();
|
|
|
|
|
|
2015-05-08 13:54:38 +02:00
|
|
|
// Fetch available send/receive bitrates.
|
|
|
|
|
std::vector<unsigned int> ssrcs;
|
2014-11-05 14:05:29 +00:00
|
|
|
uint32_t recv_bandwidth = 0;
|
2017-03-21 06:41:12 -07:00
|
|
|
receive_side_cc_.GetRemoteBitrateEstimator(false)->LatestEstimate(
|
2015-10-18 22:08:19 -07:00
|
|
|
&ssrcs, &recv_bandwidth);
|
2019-08-09 11:42:32 +02:00
|
|
|
stats.recv_bandwidth_bps = recv_bandwidth;
|
2018-03-12 15:59:12 +01:00
|
|
|
|
|
|
|
|
{
|
|
|
|
|
rtc::CritScope cs(&last_bandwidth_bps_crit_);
|
|
|
|
|
stats.send_bandwidth_bps = last_bandwidth_bps_;
|
|
|
|
|
}
|
2018-03-07 18:49:55 +01:00
|
|
|
|
2016-07-06 00:54:28 -07:00
|
|
|
{
|
|
|
|
|
rtc::CritScope cs(&bitrate_crit_);
|
|
|
|
|
stats.max_padding_bitrate_bps = configured_max_padding_bitrate_bps_;
|
|
|
|
|
}
|
2019-08-09 11:42:32 +02:00
|
|
|
|
2014-11-05 14:05:29 +00:00
|
|
|
return stats;
|
2013-05-16 12:08:03 +00:00
|
|
|
}
|
|
|
|
|
|
2016-03-22 15:32:27 -07:00
|
|
|
void Call::SignalChannelNetworkState(MediaType media, NetworkState state) {
|
2019-04-09 13:44:04 +02:00
|
|
|
RTC_DCHECK_RUN_ON(&configuration_sequence_checker_);
|
2016-03-22 15:32:27 -07:00
|
|
|
switch (media) {
|
|
|
|
|
case MediaType::AUDIO:
|
|
|
|
|
audio_network_state_ = state;
|
|
|
|
|
break;
|
|
|
|
|
case MediaType::VIDEO:
|
|
|
|
|
video_network_state_ = state;
|
|
|
|
|
break;
|
|
|
|
|
case MediaType::ANY:
|
|
|
|
|
case MediaType::DATA:
|
|
|
|
|
RTC_NOTREACHED();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UpdateAggregateNetworkState();
|
2014-09-03 16:17:12 +00:00
|
|
|
{
|
2016-03-22 15:32:27 -07:00
|
|
|
ReadLockScoped read_lock(*send_crit_);
|
2015-10-16 14:35:07 -07:00
|
|
|
for (auto& kv : audio_send_ssrcs_) {
|
2016-03-22 15:32:27 -07:00
|
|
|
kv.second->SignalNetworkState(audio_network_state_);
|
2015-10-16 14:35:07 -07:00
|
|
|
}
|
2014-09-03 16:17:12 +00:00
|
|
|
}
|
|
|
|
|
{
|
2016-03-22 15:32:27 -07:00
|
|
|
ReadLockScoped read_lock(*receive_crit_);
|
2017-05-16 04:47:04 -07:00
|
|
|
for (AudioReceiveStream* audio_receive_stream : audio_receive_streams_) {
|
|
|
|
|
audio_receive_stream->SignalNetworkState(audio_network_state_);
|
2016-03-22 15:32:27 -07:00
|
|
|
}
|
2017-05-16 04:47:04 -07:00
|
|
|
for (VideoReceiveStream* video_receive_stream : video_receive_streams_) {
|
|
|
|
|
video_receive_stream->SignalNetworkState(video_network_state_);
|
2014-09-03 16:17:12 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-04 15:21:55 +02:00
|
|
|
void Call::OnAudioTransportOverheadChanged(int transport_overhead_per_packet) {
|
|
|
|
|
ReadLockScoped read_lock(*send_crit_);
|
|
|
|
|
for (auto& kv : audio_send_ssrcs_) {
|
|
|
|
|
kv.second->SetTransportOverhead(transport_overhead_per_packet);
|
2016-11-08 02:50:09 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-22 15:32:27 -07:00
|
|
|
void Call::UpdateAggregateNetworkState() {
|
2019-04-09 13:44:04 +02:00
|
|
|
RTC_DCHECK_RUN_ON(&configuration_sequence_checker_);
|
2016-03-22 15:32:27 -07:00
|
|
|
|
|
|
|
|
bool have_audio = false;
|
|
|
|
|
bool have_video = false;
|
|
|
|
|
{
|
|
|
|
|
ReadLockScoped read_lock(*send_crit_);
|
2019-03-13 18:03:29 -07:00
|
|
|
if (!audio_send_ssrcs_.empty())
|
2016-03-22 15:32:27 -07:00
|
|
|
have_audio = true;
|
2019-03-13 18:03:29 -07:00
|
|
|
if (!video_send_ssrcs_.empty())
|
2016-03-22 15:32:27 -07:00
|
|
|
have_video = true;
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
ReadLockScoped read_lock(*receive_crit_);
|
2019-03-13 18:03:29 -07:00
|
|
|
if (!audio_receive_streams_.empty())
|
2016-03-22 15:32:27 -07:00
|
|
|
have_audio = true;
|
2019-03-13 18:03:29 -07:00
|
|
|
if (!video_receive_streams_.empty())
|
2016-03-22 15:32:27 -07:00
|
|
|
have_video = true;
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-07 18:49:55 +01:00
|
|
|
bool aggregate_network_up =
|
|
|
|
|
((have_video && video_network_state_ == kNetworkUp) ||
|
|
|
|
|
(have_audio && audio_network_state_ == kNetworkUp));
|
2016-03-22 15:32:27 -07:00
|
|
|
|
2017-11-09 11:09:25 +01:00
|
|
|
RTC_LOG(LS_INFO) << "UpdateAggregateNetworkState: aggregate_state="
|
2018-03-07 18:49:55 +01:00
|
|
|
<< (aggregate_network_up ? "up" : "down");
|
2019-08-09 11:42:32 +02:00
|
|
|
aggregate_network_up_ = aggregate_network_up;
|
|
|
|
|
|
2018-05-04 14:08:15 +02:00
|
|
|
transport_send_ptr_->OnNetworkAvailability(aggregate_network_up);
|
2016-03-22 15:32:27 -07:00
|
|
|
}
|
|
|
|
|
|
2015-10-15 07:26:07 -07:00
|
|
|
void Call::OnSentPacket(const rtc::SentPacket& sent_packet) {
|
2016-05-02 23:44:01 -07:00
|
|
|
video_send_delay_stats_->OnSentPacket(sent_packet.packet_id,
|
|
|
|
|
clock_->TimeInMilliseconds());
|
2018-05-04 14:08:15 +02:00
|
|
|
transport_send_ptr_->OnSentPacket(sent_packet);
|
2015-10-15 07:26:07 -07:00
|
|
|
}
|
|
|
|
|
|
2018-12-11 15:02:47 +01:00
|
|
|
void Call::OnStartRateUpdate(DataRate start_rate) {
|
2019-08-09 11:42:32 +02:00
|
|
|
RTC_DCHECK(network_queue()->IsCurrent());
|
2018-12-11 15:02:47 +01:00
|
|
|
bitrate_allocator_->UpdateStartRate(start_rate.bps<uint32_t>());
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-12 15:59:12 +01:00
|
|
|
void Call::OnTargetTransferRate(TargetTransferRate msg) {
|
2019-08-09 11:42:32 +02:00
|
|
|
RTC_DCHECK(network_queue()->IsCurrent());
|
2019-08-08 12:27:53 +02:00
|
|
|
RTC_DCHECK_RUN_ON(&worker_sequence_checker_);
|
2018-11-15 08:26:19 -08:00
|
|
|
|
2018-03-12 15:59:12 +01:00
|
|
|
uint32_t target_bitrate_bps = msg.target_rate.bps();
|
|
|
|
|
int loss_ratio_255 = msg.network_estimate.loss_rate_ratio * 255;
|
|
|
|
|
uint8_t fraction_loss =
|
|
|
|
|
rtc::dchecked_cast<uint8_t>(rtc::SafeClamp(loss_ratio_255, 0, 255));
|
|
|
|
|
int64_t rtt_ms = msg.network_estimate.round_trip_time.ms();
|
|
|
|
|
int64_t probing_interval_ms = msg.network_estimate.bwe_period.ms();
|
|
|
|
|
uint32_t bandwidth_bps = msg.network_estimate.bandwidth.bps();
|
|
|
|
|
{
|
|
|
|
|
rtc::CritScope cs(&last_bandwidth_bps_crit_);
|
|
|
|
|
last_bandwidth_bps_ = bandwidth_bps;
|
|
|
|
|
}
|
2017-03-21 06:41:12 -07:00
|
|
|
// For controlling the rate of feedback messages.
|
|
|
|
|
receive_side_cc_.OnBitrateChanged(target_bitrate_bps);
|
2018-11-20 17:16:36 +01:00
|
|
|
bitrate_allocator_->OnNetworkChanged(target_bitrate_bps, bandwidth_bps,
|
|
|
|
|
fraction_loss, rtt_ms,
|
|
|
|
|
probing_interval_ms);
|
2015-11-12 21:02:42 -08:00
|
|
|
|
2016-09-09 00:13:35 -07:00
|
|
|
// Ignore updates if bitrate is zero (the aggregate network state is down).
|
|
|
|
|
if (target_bitrate_bps == 0) {
|
2015-11-17 06:24:56 -08:00
|
|
|
rtc::CritScope lock(&bitrate_crit_);
|
2016-09-09 00:13:35 -07:00
|
|
|
estimated_send_bitrate_kbps_counter_.ProcessAndPause();
|
|
|
|
|
pacer_bitrate_kbps_counter_.ProcessAndPause();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool sending_video;
|
|
|
|
|
{
|
|
|
|
|
ReadLockScoped read_lock(*send_crit_);
|
|
|
|
|
sending_video = !video_send_streams_.empty();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rtc::CritScope lock(&bitrate_crit_);
|
|
|
|
|
if (!sending_video) {
|
|
|
|
|
// Do not update the stats if we are not sending video.
|
|
|
|
|
estimated_send_bitrate_kbps_counter_.ProcessAndPause();
|
|
|
|
|
pacer_bitrate_kbps_counter_.ProcessAndPause();
|
|
|
|
|
return;
|
2015-11-17 06:24:56 -08:00
|
|
|
}
|
2016-09-09 00:13:35 -07:00
|
|
|
estimated_send_bitrate_kbps_counter_.Add(target_bitrate_bps / 1000);
|
|
|
|
|
// Pacer bitrate may be higher than bitrate estimate if enforcing min bitrate.
|
|
|
|
|
uint32_t pacer_bitrate_bps =
|
|
|
|
|
std::max(target_bitrate_bps, min_allocated_send_bitrate_bps_);
|
|
|
|
|
pacer_bitrate_kbps_counter_.Add(pacer_bitrate_bps / 1000);
|
2016-06-15 00:47:53 -07:00
|
|
|
}
|
2016-06-09 17:21:19 +02:00
|
|
|
|
2016-06-15 00:47:53 -07:00
|
|
|
void Call::OnAllocationLimitsChanged(uint32_t min_send_bitrate_bps,
|
2018-02-28 13:06:28 +01:00
|
|
|
uint32_t max_padding_bitrate_bps,
|
2019-01-23 09:41:43 +01:00
|
|
|
uint32_t total_bitrate_bps) {
|
2019-08-09 11:42:32 +02:00
|
|
|
RTC_DCHECK(network_queue()->IsCurrent());
|
2019-08-08 12:27:53 +02:00
|
|
|
RTC_DCHECK_RUN_ON(&worker_sequence_checker_);
|
2019-08-09 11:42:32 +02:00
|
|
|
|
2018-05-04 14:08:15 +02:00
|
|
|
transport_send_ptr_->SetAllocatedSendBitrateLimits(
|
2018-03-19 13:29:42 +00:00
|
|
|
min_send_bitrate_bps, max_padding_bitrate_bps, total_bitrate_bps);
|
2018-10-01 09:16:12 +02:00
|
|
|
|
2019-08-08 12:27:53 +02:00
|
|
|
min_allocated_send_bitrate_bps_ = min_send_bitrate_bps;
|
2019-01-28 06:50:38 -08:00
|
|
|
|
2016-06-15 00:47:53 -07:00
|
|
|
rtc::CritScope lock(&bitrate_crit_);
|
2016-07-06 00:54:28 -07:00
|
|
|
configured_max_padding_bitrate_bps_ = max_padding_bitrate_bps;
|
2015-11-12 21:02:42 -08:00
|
|
|
}
|
|
|
|
|
|
2015-07-15 08:02:58 -07:00
|
|
|
void Call::ConfigureSync(const std::string& sync_group) {
|
|
|
|
|
// Set sync only if there was no previous one.
|
2017-01-31 03:58:40 -08:00
|
|
|
if (sync_group.empty())
|
2015-07-15 08:02:58 -07:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
AudioReceiveStream* sync_audio_stream = nullptr;
|
|
|
|
|
// Find existing audio stream.
|
|
|
|
|
const auto it = sync_stream_mapping_.find(sync_group);
|
|
|
|
|
if (it != sync_stream_mapping_.end()) {
|
|
|
|
|
sync_audio_stream = it->second;
|
|
|
|
|
} else {
|
|
|
|
|
// No configured audio stream, see if we can find one.
|
2017-05-16 04:47:04 -07:00
|
|
|
for (AudioReceiveStream* stream : audio_receive_streams_) {
|
|
|
|
|
if (stream->config().sync_group == sync_group) {
|
2015-07-15 08:02:58 -07:00
|
|
|
if (sync_audio_stream != nullptr) {
|
2017-11-09 11:09:25 +01:00
|
|
|
RTC_LOG(LS_WARNING)
|
|
|
|
|
<< "Attempting to sync more than one audio stream "
|
|
|
|
|
"within the same sync group. This is not "
|
|
|
|
|
"supported in the current implementation.";
|
2015-07-15 08:02:58 -07:00
|
|
|
break;
|
|
|
|
|
}
|
2017-05-16 04:47:04 -07:00
|
|
|
sync_audio_stream = stream;
|
2015-07-15 08:02:58 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (sync_audio_stream)
|
|
|
|
|
sync_stream_mapping_[sync_group] = sync_audio_stream;
|
|
|
|
|
size_t num_synced_streams = 0;
|
|
|
|
|
for (VideoReceiveStream* video_stream : video_receive_streams_) {
|
|
|
|
|
if (video_stream->config().sync_group != sync_group)
|
|
|
|
|
continue;
|
|
|
|
|
++num_synced_streams;
|
|
|
|
|
if (num_synced_streams > 1) {
|
|
|
|
|
// TODO(pbos): Support synchronizing more than one A/V pair.
|
|
|
|
|
// https://code.google.com/p/webrtc/issues/detail?id=4762
|
2017-11-09 11:09:25 +01:00
|
|
|
RTC_LOG(LS_WARNING)
|
|
|
|
|
<< "Attempting to sync more than one audio/video pair "
|
|
|
|
|
"within the same sync group. This is not supported in "
|
|
|
|
|
"the current implementation.";
|
2015-07-15 08:02:58 -07:00
|
|
|
}
|
|
|
|
|
// Only sync the first A/V pair within this sync group.
|
2017-01-31 03:58:40 -08:00
|
|
|
if (num_synced_streams == 1) {
|
|
|
|
|
// sync_audio_stream may be null and that's ok.
|
|
|
|
|
video_stream->SetSync(sync_audio_stream);
|
2015-07-15 08:02:58 -07:00
|
|
|
} else {
|
2017-01-31 03:58:40 -08:00
|
|
|
video_stream->SetSync(nullptr);
|
2015-07-15 08:02:58 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-29 15:24:01 +02:00
|
|
|
PacketReceiver::DeliveryStatus Call::DeliverRtcp(MediaType media_type,
|
|
|
|
|
const uint8_t* packet,
|
|
|
|
|
size_t length) {
|
2015-12-07 23:17:15 +01:00
|
|
|
TRACE_EVENT0("webrtc", "Call::DeliverRtcp");
|
2016-04-29 00:57:13 -07:00
|
|
|
// TODO(pbos): Make sure it's a valid packet.
|
2014-05-14 13:57:12 +00:00
|
|
|
// Return DELIVERY_UNKNOWN_SSRC if it can be determined that
|
|
|
|
|
// there's no receiver of the packet.
|
2016-09-08 00:07:21 -07:00
|
|
|
if (received_bytes_per_second_counter_.HasSample()) {
|
|
|
|
|
// First RTP packet has been received.
|
|
|
|
|
received_bytes_per_second_counter_.Add(static_cast<int>(length));
|
|
|
|
|
received_rtcp_bytes_per_second_counter_.Add(static_cast<int>(length));
|
|
|
|
|
}
|
2013-05-16 12:08:03 +00:00
|
|
|
bool rtcp_delivered = false;
|
2015-04-29 15:24:01 +02:00
|
|
|
if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) {
|
2014-09-03 16:17:12 +00:00
|
|
|
ReadLockScoped read_lock(*receive_crit_);
|
2015-04-29 15:24:01 +02:00
|
|
|
for (VideoReceiveStream* stream : video_receive_streams_) {
|
2016-04-29 00:57:13 -07:00
|
|
|
if (stream->DeliverRtcp(packet, length))
|
|
|
|
|
rtcp_delivered = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (media_type == MediaType::ANY || media_type == MediaType::AUDIO) {
|
|
|
|
|
ReadLockScoped read_lock(*receive_crit_);
|
2017-05-16 04:47:04 -07:00
|
|
|
for (AudioReceiveStream* stream : audio_receive_streams_) {
|
2019-03-05 14:29:42 +01:00
|
|
|
stream->DeliverRtcp(packet, length);
|
|
|
|
|
rtcp_delivered = true;
|
2013-08-05 12:01:36 +00:00
|
|
|
}
|
|
|
|
|
}
|
2015-04-29 15:24:01 +02:00
|
|
|
if (media_type == MediaType::ANY || media_type == MediaType::VIDEO) {
|
2014-09-03 16:17:12 +00:00
|
|
|
ReadLockScoped read_lock(*send_crit_);
|
2015-04-29 15:24:01 +02:00
|
|
|
for (VideoSendStream* stream : video_send_streams_) {
|
2019-03-05 14:29:42 +01:00
|
|
|
stream->DeliverRtcp(packet, length);
|
|
|
|
|
rtcp_delivered = true;
|
2013-05-16 12:08:03 +00:00
|
|
|
}
|
|
|
|
|
}
|
2016-04-29 00:57:13 -07:00
|
|
|
if (media_type == MediaType::ANY || media_type == MediaType::AUDIO) {
|
|
|
|
|
ReadLockScoped read_lock(*send_crit_);
|
|
|
|
|
for (auto& kv : audio_send_ssrcs_) {
|
2019-03-05 14:29:42 +01:00
|
|
|
kv.second->DeliverRtcp(packet, length);
|
|
|
|
|
rtcp_delivered = true;
|
2016-04-29 00:57:13 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-03 16:11:34 +02:00
|
|
|
if (rtcp_delivered) {
|
Use absl::make_unique and absl::WrapUnique directly
Instead of going through our wrappers in ptr_util.h.
This CL was generated by the following script:
git grep -l ptr_util | xargs perl -pi -e 's,#include "rtc_base/ptr_util.h",#include "absl/memory/memory.h",'
git grep -l MakeUnique | xargs perl -pi -e 's,\b(rtc::)?MakeUnique\b,absl::make_unique,g'
git grep -l WrapUnique | xargs perl -pi -e 's,\b(rtc::)?WrapUnique\b,absl::WrapUnique,g'
git checkout -- rtc_base/ptr_util{.h,_unittest.cc}
git cl format
Followed by manually adding dependencies on
//third_party/abseil-cpp/absl/memory until `gn check` stopped
complaining.
Bug: webrtc:9473
Change-Id: I89ccd363f070479b8c431eb2c3d404a46eaacc1c
Reviewed-on: https://webrtc-review.googlesource.com/86600
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23850}
2018-07-05 11:40:33 +02:00
|
|
|
event_log_->Log(absl::make_unique<RtcEventRtcpPacketIncoming>(
|
2017-10-03 16:11:34 +02:00
|
|
|
rtc::MakeArrayView(packet, length)));
|
|
|
|
|
}
|
2016-04-29 00:57:13 -07:00
|
|
|
|
2014-05-14 13:57:12 +00:00
|
|
|
return rtcp_delivered ? DELIVERY_OK : DELIVERY_PACKET_ERROR;
|
2013-05-16 12:08:03 +00:00
|
|
|
}
|
|
|
|
|
|
2015-04-29 15:24:01 +02:00
|
|
|
PacketReceiver::DeliveryStatus Call::DeliverRtp(MediaType media_type,
|
2017-12-07 17:00:40 +01:00
|
|
|
rtc::CopyOnWriteBuffer packet,
|
2018-08-07 11:03:12 +02:00
|
|
|
int64_t packet_time_us) {
|
2015-12-07 23:17:15 +01:00
|
|
|
TRACE_EVENT0("webrtc", "Call::DeliverRtp");
|
2017-02-01 03:06:58 -08:00
|
|
|
|
2017-10-04 14:01:45 +02:00
|
|
|
RtpPacketReceived parsed_packet;
|
2017-12-07 17:00:40 +01:00
|
|
|
if (!parsed_packet.Parse(std::move(packet)))
|
2017-10-04 14:01:45 +02:00
|
|
|
return DELIVERY_PACKET_ERROR;
|
|
|
|
|
|
2018-08-07 11:03:12 +02:00
|
|
|
if (packet_time_us != -1) {
|
2018-03-21 14:38:32 +01:00
|
|
|
if (receive_time_calculator_) {
|
2018-10-30 15:14:36 +01:00
|
|
|
// Repair packet_time_us for clock resets by comparing a new read of
|
|
|
|
|
// the same clock (TimeUTCMicros) to a monotonic clock reading.
|
2018-08-07 11:03:12 +02:00
|
|
|
packet_time_us = receive_time_calculator_->ReconcileReceiveTimes(
|
2018-10-30 15:14:36 +01:00
|
|
|
packet_time_us, rtc::TimeUTCMicros(), clock_->TimeInMicroseconds());
|
2018-03-21 14:38:32 +01:00
|
|
|
}
|
2018-08-07 11:03:12 +02:00
|
|
|
parsed_packet.set_arrival_time_ms((packet_time_us + 500) / 1000);
|
2017-10-04 14:01:45 +02:00
|
|
|
} else {
|
|
|
|
|
parsed_packet.set_arrival_time_ms(clock_->TimeInMilliseconds());
|
|
|
|
|
}
|
2017-02-06 02:23:00 -08:00
|
|
|
|
2017-07-11 03:56:21 -07:00
|
|
|
// We might get RTP keep-alive packets in accordance with RFC6263 section 4.6.
|
|
|
|
|
// These are empty (zero length payload) RTP packets with an unsignaled
|
|
|
|
|
// payload type.
|
2017-10-04 14:01:45 +02:00
|
|
|
const bool is_keep_alive_packet = parsed_packet.payload_size() == 0;
|
2017-07-11 03:56:21 -07:00
|
|
|
|
|
|
|
|
RTC_DCHECK(media_type == MediaType::AUDIO || media_type == MediaType::VIDEO ||
|
|
|
|
|
is_keep_alive_packet);
|
|
|
|
|
|
|
|
|
|
ReadLockScoped read_lock(*receive_crit_);
|
2017-10-04 14:01:45 +02:00
|
|
|
auto it = receive_rtp_config_.find(parsed_packet.Ssrc());
|
2017-06-21 01:05:22 -07:00
|
|
|
if (it == receive_rtp_config_.end()) {
|
2017-11-09 11:09:25 +01:00
|
|
|
RTC_LOG(LS_ERROR) << "receive_rtp_config_ lookup failed for ssrc "
|
|
|
|
|
<< parsed_packet.Ssrc();
|
2017-06-21 01:05:22 -07:00
|
|
|
// Destruction of the receive stream, including deregistering from the
|
|
|
|
|
// RtpDemuxer, is not protected by the |receive_crit_| lock. But
|
|
|
|
|
// deregistering in the |receive_rtp_config_| map is protected by that lock.
|
|
|
|
|
// So by not passing the packet on to demuxing in this case, we prevent
|
|
|
|
|
// incoming packets to be passed on via the demuxer to a receive stream
|
|
|
|
|
// which is being torned down.
|
|
|
|
|
return DELIVERY_UNKNOWN_SSRC;
|
|
|
|
|
}
|
2019-03-18 10:59:40 +01:00
|
|
|
|
2017-10-04 14:01:45 +02:00
|
|
|
parsed_packet.IdentifyExtensions(it->second.extensions);
|
2017-06-21 01:05:22 -07:00
|
|
|
|
2017-10-04 14:01:45 +02:00
|
|
|
NotifyBweOfReceivedPacket(parsed_packet, media_type);
|
2017-02-06 02:23:00 -08:00
|
|
|
|
2017-12-08 14:05:20 +01:00
|
|
|
// RateCounters expect input parameter as int, save it as int,
|
|
|
|
|
// instead of converting each time it is passed to RateCounter::Add below.
|
|
|
|
|
int length = static_cast<int>(parsed_packet.size());
|
Reland of Don't hardcode MediaType::ANY in FakeNetworkPipe. (patchset #1 id:1 of https://codereview.webrtc.org/2784543002/ )
Reason for revert:
Intend to fix perf failures and reland.
Original issue's description:
> Revert of Don't hardcode MediaType::ANY in FakeNetworkPipe. (patchset #4 id:60001 of https://codereview.webrtc.org/2774463003/ )
>
> Reason for revert:
> Reverting since this seems to break multiple WebRTC Perf buildbots
>
> Original issue's description:
> > Don't hardcode MediaType::ANY in FakeNetworkPipe.
> >
> > Instead let each test set the appropriate media type. This simplifies
> > demuxing in Call and later in RtpTransportController.
> >
> > BUG=webrtc:7135
> >
> > Review-Url: https://codereview.webrtc.org/2774463003
> > Cr-Commit-Position: refs/heads/master@{#17418}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/9c47b00e24da2941eb095df5a4459c6d98a8a88d
>
> TBR=stefan@webrtc.org,deadbeef@webrtc.org,solenberg@webrtc.org,pbos@webrtc.org,sprang@webrtc.org,nisse@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7135
>
> Review-Url: https://codereview.webrtc.org/2784543002
> Cr-Commit-Position: refs/heads/master@{#17427}
> Committed: https://chromium.googlesource.com/external/webrtc/+/3a3bd5061089da5327fc549337a8430054d66057
TBR=stefan@webrtc.org,deadbeef@webrtc.org,solenberg@webrtc.org,pbos@webrtc.org,sprang@webrtc.org,lliuu@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:7135
Review-Url: https://codereview.webrtc.org/2783853002
Cr-Commit-Position: refs/heads/master@{#17459}
2017-03-29 23:57:43 -07:00
|
|
|
if (media_type == MediaType::AUDIO) {
|
2017-10-04 14:01:45 +02:00
|
|
|
if (audio_receiver_controller_.OnRtpPacket(parsed_packet)) {
|
2017-12-07 17:00:40 +01:00
|
|
|
received_bytes_per_second_counter_.Add(length);
|
|
|
|
|
received_audio_bytes_per_second_counter_.Add(length);
|
2017-10-03 16:11:34 +02:00
|
|
|
event_log_->Log(
|
Use absl::make_unique and absl::WrapUnique directly
Instead of going through our wrappers in ptr_util.h.
This CL was generated by the following script:
git grep -l ptr_util | xargs perl -pi -e 's,#include "rtc_base/ptr_util.h",#include "absl/memory/memory.h",'
git grep -l MakeUnique | xargs perl -pi -e 's,\b(rtc::)?MakeUnique\b,absl::make_unique,g'
git grep -l WrapUnique | xargs perl -pi -e 's,\b(rtc::)?WrapUnique\b,absl::WrapUnique,g'
git checkout -- rtc_base/ptr_util{.h,_unittest.cc}
git cl format
Followed by manually adding dependencies on
//third_party/abseil-cpp/absl/memory until `gn check` stopped
complaining.
Bug: webrtc:9473
Change-Id: I89ccd363f070479b8c431eb2c3d404a46eaacc1c
Reviewed-on: https://webrtc-review.googlesource.com/86600
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23850}
2018-07-05 11:40:33 +02:00
|
|
|
absl::make_unique<RtcEventRtpPacketIncoming>(parsed_packet));
|
2017-10-04 14:01:45 +02:00
|
|
|
const int64_t arrival_time_ms = parsed_packet.arrival_time_ms();
|
2017-07-04 04:05:06 -07:00
|
|
|
if (!first_received_rtp_audio_ms_) {
|
|
|
|
|
first_received_rtp_audio_ms_.emplace(arrival_time_ms);
|
|
|
|
|
}
|
|
|
|
|
last_received_rtp_audio_ms_.emplace(arrival_time_ms);
|
2017-02-21 06:28:10 -08:00
|
|
|
return DELIVERY_OK;
|
2015-04-29 15:24:01 +02:00
|
|
|
}
|
2017-05-16 04:47:04 -07:00
|
|
|
} else if (media_type == MediaType::VIDEO) {
|
2018-08-09 16:16:34 +02:00
|
|
|
parsed_packet.set_payload_type_frequency(kVideoPayloadTypeFrequency);
|
2017-10-04 14:01:45 +02:00
|
|
|
if (video_receiver_controller_.OnRtpPacket(parsed_packet)) {
|
2017-12-07 17:00:40 +01:00
|
|
|
received_bytes_per_second_counter_.Add(length);
|
|
|
|
|
received_video_bytes_per_second_counter_.Add(length);
|
2017-10-03 16:11:34 +02:00
|
|
|
event_log_->Log(
|
Use absl::make_unique and absl::WrapUnique directly
Instead of going through our wrappers in ptr_util.h.
This CL was generated by the following script:
git grep -l ptr_util | xargs perl -pi -e 's,#include "rtc_base/ptr_util.h",#include "absl/memory/memory.h",'
git grep -l MakeUnique | xargs perl -pi -e 's,\b(rtc::)?MakeUnique\b,absl::make_unique,g'
git grep -l WrapUnique | xargs perl -pi -e 's,\b(rtc::)?WrapUnique\b,absl::WrapUnique,g'
git checkout -- rtc_base/ptr_util{.h,_unittest.cc}
git cl format
Followed by manually adding dependencies on
//third_party/abseil-cpp/absl/memory until `gn check` stopped
complaining.
Bug: webrtc:9473
Change-Id: I89ccd363f070479b8c431eb2c3d404a46eaacc1c
Reviewed-on: https://webrtc-review.googlesource.com/86600
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23850}
2018-07-05 11:40:33 +02:00
|
|
|
absl::make_unique<RtcEventRtpPacketIncoming>(parsed_packet));
|
2017-10-04 14:01:45 +02:00
|
|
|
const int64_t arrival_time_ms = parsed_packet.arrival_time_ms();
|
2017-07-04 04:05:06 -07:00
|
|
|
if (!first_received_rtp_video_ms_) {
|
|
|
|
|
first_received_rtp_video_ms_.emplace(arrival_time_ms);
|
|
|
|
|
}
|
|
|
|
|
last_received_rtp_video_ms_.emplace(arrival_time_ms);
|
2017-02-16 06:52:32 -08:00
|
|
|
return DELIVERY_OK;
|
2015-04-29 15:24:01 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return DELIVERY_UNKNOWN_SSRC;
|
2013-05-16 12:08:03 +00:00
|
|
|
}
|
|
|
|
|
|
2015-09-08 05:36:15 -07:00
|
|
|
PacketReceiver::DeliveryStatus Call::DeliverPacket(
|
|
|
|
|
MediaType media_type,
|
2017-12-07 17:00:40 +01:00
|
|
|
rtc::CopyOnWriteBuffer packet,
|
2018-08-07 11:03:12 +02:00
|
|
|
int64_t packet_time_us) {
|
2019-04-09 13:44:04 +02:00
|
|
|
RTC_DCHECK_RUN_ON(&configuration_sequence_checker_);
|
2017-12-07 17:00:40 +01:00
|
|
|
if (RtpHeaderParser::IsRtcp(packet.cdata(), packet.size()))
|
|
|
|
|
return DeliverRtcp(media_type, packet.cdata(), packet.size());
|
2013-05-16 12:08:03 +00:00
|
|
|
|
2018-08-07 11:03:12 +02:00
|
|
|
return DeliverRtp(media_type, std::move(packet), packet_time_us);
|
2013-05-16 12:08:03 +00:00
|
|
|
}
|
|
|
|
|
|
2017-05-11 08:00:58 -07:00
|
|
|
void Call::OnRecoveredPacket(const uint8_t* packet, size_t length) {
|
2017-10-04 14:01:45 +02:00
|
|
|
RtpPacketReceived parsed_packet;
|
|
|
|
|
if (!parsed_packet.Parse(packet, length))
|
2017-05-11 08:00:58 -07:00
|
|
|
return;
|
|
|
|
|
|
2017-10-04 14:01:45 +02:00
|
|
|
parsed_packet.set_recovered(true);
|
2017-05-11 08:00:58 -07:00
|
|
|
|
2017-08-23 00:55:17 -07:00
|
|
|
ReadLockScoped read_lock(*receive_crit_);
|
2017-10-04 14:01:45 +02:00
|
|
|
auto it = receive_rtp_config_.find(parsed_packet.Ssrc());
|
2017-08-23 00:55:17 -07:00
|
|
|
if (it == receive_rtp_config_.end()) {
|
2017-11-09 11:09:25 +01:00
|
|
|
RTC_LOG(LS_ERROR) << "receive_rtp_config_ lookup failed for ssrc "
|
|
|
|
|
<< parsed_packet.Ssrc();
|
2017-08-23 00:55:17 -07:00
|
|
|
// Destruction of the receive stream, including deregistering from the
|
|
|
|
|
// RtpDemuxer, is not protected by the |receive_crit_| lock. But
|
|
|
|
|
// deregistering in the |receive_rtp_config_| map is protected by that lock.
|
|
|
|
|
// So by not passing the packet on to demuxing in this case, we prevent
|
|
|
|
|
// incoming packets to be passed on via the demuxer to a receive stream
|
2018-03-14 15:16:50 +01:00
|
|
|
// which is being torn down.
|
2017-08-23 00:55:17 -07:00
|
|
|
return;
|
|
|
|
|
}
|
2017-10-04 14:01:45 +02:00
|
|
|
parsed_packet.IdentifyExtensions(it->second.extensions);
|
2017-08-23 00:55:17 -07:00
|
|
|
|
|
|
|
|
// TODO(brandtr): Update here when we support protecting audio packets too.
|
2018-08-09 16:16:34 +02:00
|
|
|
parsed_packet.set_payload_type_frequency(kVideoPayloadTypeFrequency);
|
2017-10-04 14:01:45 +02:00
|
|
|
video_receiver_controller_.OnRtpPacket(parsed_packet);
|
2016-10-18 23:50:45 -07:00
|
|
|
}
|
|
|
|
|
|
2017-02-06 02:23:00 -08:00
|
|
|
void Call::NotifyBweOfReceivedPacket(const RtpPacketReceived& packet,
|
|
|
|
|
MediaType media_type) {
|
|
|
|
|
auto it = receive_rtp_config_.find(packet.Ssrc());
|
2017-02-07 01:18:43 -08:00
|
|
|
bool use_send_side_bwe =
|
|
|
|
|
(it != receive_rtp_config_.end()) && it->second.use_send_side_bwe;
|
2017-02-06 02:23:00 -08:00
|
|
|
|
2016-12-21 06:37:18 -08:00
|
|
|
RTPHeader header;
|
|
|
|
|
packet.GetHeader(&header);
|
2017-02-06 02:23:00 -08:00
|
|
|
|
2019-06-13 17:48:53 +02:00
|
|
|
ReceivedPacket packet_msg;
|
|
|
|
|
packet_msg.size = DataSize::bytes(packet.payload_size());
|
|
|
|
|
packet_msg.receive_time = Timestamp::ms(packet.arrival_time_ms());
|
2019-06-14 13:35:51 +02:00
|
|
|
if (header.extension.hasAbsoluteSendTime) {
|
|
|
|
|
packet_msg.send_time = header.extension.GetAbsoluteSendTimestamp();
|
|
|
|
|
}
|
2019-06-13 17:48:53 +02:00
|
|
|
transport_send_ptr_->OnReceivedPacket(packet_msg);
|
2019-05-27 17:19:08 +02:00
|
|
|
|
2017-02-07 01:18:43 -08:00
|
|
|
if (!use_send_side_bwe && header.extension.hasTransportSequenceNumber) {
|
2017-02-06 02:23:00 -08:00
|
|
|
// Inconsistent configuration of send side BWE. Do nothing.
|
|
|
|
|
// TODO(nisse): Without this check, we may produce RTCP feedback
|
|
|
|
|
// packets even when not negotiated. But it would be cleaner to
|
|
|
|
|
// move the check down to RTCPSender::SendFeedbackPacket, which
|
|
|
|
|
// would also help the PacketRouter to select an appropriate rtp
|
|
|
|
|
// module in the case that some, but not all, have RTCP feedback
|
|
|
|
|
// enabled.
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// For audio, we only support send side BWE.
|
Reland of Don't hardcode MediaType::ANY in FakeNetworkPipe. (patchset #1 id:1 of https://codereview.webrtc.org/2784543002/ )
Reason for revert:
Intend to fix perf failures and reland.
Original issue's description:
> Revert of Don't hardcode MediaType::ANY in FakeNetworkPipe. (patchset #4 id:60001 of https://codereview.webrtc.org/2774463003/ )
>
> Reason for revert:
> Reverting since this seems to break multiple WebRTC Perf buildbots
>
> Original issue's description:
> > Don't hardcode MediaType::ANY in FakeNetworkPipe.
> >
> > Instead let each test set the appropriate media type. This simplifies
> > demuxing in Call and later in RtpTransportController.
> >
> > BUG=webrtc:7135
> >
> > Review-Url: https://codereview.webrtc.org/2774463003
> > Cr-Commit-Position: refs/heads/master@{#17418}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/9c47b00e24da2941eb095df5a4459c6d98a8a88d
>
> TBR=stefan@webrtc.org,deadbeef@webrtc.org,solenberg@webrtc.org,pbos@webrtc.org,sprang@webrtc.org,nisse@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7135
>
> Review-Url: https://codereview.webrtc.org/2784543002
> Cr-Commit-Position: refs/heads/master@{#17427}
> Committed: https://chromium.googlesource.com/external/webrtc/+/3a3bd5061089da5327fc549337a8430054d66057
TBR=stefan@webrtc.org,deadbeef@webrtc.org,solenberg@webrtc.org,pbos@webrtc.org,sprang@webrtc.org,lliuu@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:7135
Review-Url: https://codereview.webrtc.org/2783853002
Cr-Commit-Position: refs/heads/master@{#17459}
2017-03-29 23:57:43 -07:00
|
|
|
if (media_type == MediaType::VIDEO ||
|
2017-02-07 01:18:43 -08:00
|
|
|
(use_send_side_bwe && header.extension.hasTransportSequenceNumber)) {
|
2017-03-21 06:41:12 -07:00
|
|
|
receive_side_cc_.OnReceivedPacket(
|
2017-02-06 02:23:00 -08:00
|
|
|
packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(),
|
|
|
|
|
header);
|
|
|
|
|
}
|
2016-12-21 06:37:18 -08:00
|
|
|
}
|
|
|
|
|
|
2013-05-16 12:08:03 +00:00
|
|
|
} // namespace internal
|
2017-03-27 05:36:15 -07:00
|
|
|
|
2013-05-16 12:08:03 +00:00
|
|
|
} // namespace webrtc
|