Replace rtc::Optional with absl::optional in audio, call and video
This is a no-op change because rtc::Optional is an alias to absl::optional
This CL generated by running script with parameters 'audio call video':
#!/bin/bash
find $@ -type f \( -name \*.h -o -name \*.cc \) \
-exec sed -i 's|rtc::Optional|absl::optional|g' {} \+ \
-exec sed -i 's|rtc::nullopt|absl::nullopt|g' {} \+ \
-exec sed -i 's|#include "api/optional.h"|#include "absl/types/optional.h"|' {} \+
find $@ -type f -name BUILD.gn \
-exec sed -r -i 's|"(../)*api:optional"|"//third_party/abseil-cpp/absl/types:optional"|' {} \+;
git cl format
Bug: webrtc:9078
Change-Id: I02c5db956846a88a268a300ba086703a02d62e36
Reviewed-on: https://webrtc-review.googlesource.com/83722
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23628}
This commit is contained in:
parent
e61d72b37c
commit
b9b146c9fe
@ -49,7 +49,6 @@ rtc_static_library("audio") {
|
||||
"../api:array_view",
|
||||
"../api:call_api",
|
||||
"../api:libjingle_peerconnection_api",
|
||||
"../api:optional",
|
||||
"../api:transport_api",
|
||||
"../api/audio:aec3_factory",
|
||||
"../api/audio:audio_frame_api",
|
||||
@ -87,6 +86,7 @@ rtc_static_library("audio") {
|
||||
"../system_wrappers:field_trial_api",
|
||||
"../system_wrappers:metrics_api",
|
||||
"utility:audio_frame_operations",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
if (rtc_include_tests) {
|
||||
|
||||
@ -257,7 +257,7 @@ int AudioReceiveStream::id() const {
|
||||
return config_.rtp.remote_ssrc;
|
||||
}
|
||||
|
||||
rtc::Optional<Syncable::Info> AudioReceiveStream::GetInfo() const {
|
||||
absl::optional<Syncable::Info> AudioReceiveStream::GetInfo() const {
|
||||
RTC_DCHECK_RUN_ON(&module_process_thread_checker_);
|
||||
Syncable::Info info;
|
||||
|
||||
@ -270,14 +270,14 @@ rtc::Optional<Syncable::Info> AudioReceiveStream::GetInfo() const {
|
||||
if (!rtp_receiver->GetLatestTimestamps(
|
||||
&info.latest_received_capture_timestamp,
|
||||
&info.latest_receive_time_ms)) {
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
if (rtp_rtcp->RemoteNTP(&info.capture_time_ntp_secs,
|
||||
&info.capture_time_ntp_frac,
|
||||
nullptr,
|
||||
nullptr,
|
||||
&info.capture_time_source_clock) != 0) {
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
info.current_delay_ms = channel_proxy_->GetDelayEstimate();
|
||||
|
||||
@ -80,7 +80,7 @@ class AudioReceiveStream final : public webrtc::AudioReceiveStream,
|
||||
|
||||
// Syncable
|
||||
int id() const override;
|
||||
rtc::Optional<Syncable::Info> GetInfo() const override;
|
||||
absl::optional<Syncable::Info> GetInfo() const override;
|
||||
uint32_t GetPlayoutTimestamp() const override;
|
||||
void SetMinimumPlayoutDelay(int delay_ms) override;
|
||||
|
||||
|
||||
@ -91,7 +91,7 @@ AudioSendStream::AudioSendStream(
|
||||
BitrateAllocator* bitrate_allocator,
|
||||
RtcEventLog* event_log,
|
||||
RtcpRttStats* rtcp_rtt_stats,
|
||||
const rtc::Optional<RtpState>& suspended_rtp_state,
|
||||
const absl::optional<RtpState>& suspended_rtp_state,
|
||||
TimeInterval* overall_call_lifetime)
|
||||
: AudioSendStream(config,
|
||||
audio_state,
|
||||
@ -115,7 +115,7 @@ AudioSendStream::AudioSendStream(
|
||||
BitrateAllocator* bitrate_allocator,
|
||||
RtcEventLog* event_log,
|
||||
RtcpRttStats* rtcp_rtt_stats,
|
||||
const rtc::Optional<RtpState>& suspended_rtp_state,
|
||||
const absl::optional<RtpState>& suspended_rtp_state,
|
||||
TimeInterval* overall_call_lifetime,
|
||||
std::unique_ptr<voe::ChannelProxy> channel_proxy)
|
||||
: worker_queue_(worker_queue),
|
||||
@ -445,8 +445,8 @@ void AudioSendStream::OnPacketAdded(uint32_t ssrc, uint16_t seq_num) {
|
||||
void AudioSendStream::OnPacketFeedbackVector(
|
||||
const std::vector<PacketFeedback>& packet_feedback_vector) {
|
||||
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
|
||||
rtc::Optional<float> plr;
|
||||
rtc::Optional<float> rplr;
|
||||
absl::optional<float> plr;
|
||||
absl::optional<float> rplr;
|
||||
{
|
||||
rtc::CritScope lock(&packet_loss_tracker_cs_);
|
||||
packet_loss_tracker_.OnPacketFeedbackVector(packet_feedback_vector);
|
||||
@ -584,7 +584,7 @@ bool AudioSendStream::ReconfigureSendCodec(AudioSendStream* stream,
|
||||
return SetupSendCodec(stream, new_config);
|
||||
}
|
||||
|
||||
const rtc::Optional<int>& new_target_bitrate_bps =
|
||||
const absl::optional<int>& new_target_bitrate_bps =
|
||||
new_config.send_codec_spec->target_bitrate_bps;
|
||||
// If a bitrate has been specified for the codec, use it over the
|
||||
// codec's default.
|
||||
|
||||
@ -49,7 +49,7 @@ class AudioSendStream final : public webrtc::AudioSendStream,
|
||||
BitrateAllocator* bitrate_allocator,
|
||||
RtcEventLog* event_log,
|
||||
RtcpRttStats* rtcp_rtt_stats,
|
||||
const rtc::Optional<RtpState>& suspended_rtp_state,
|
||||
const absl::optional<RtpState>& suspended_rtp_state,
|
||||
TimeInterval* overall_call_lifetime);
|
||||
// For unit tests, which need to supply a mock channel proxy.
|
||||
AudioSendStream(const webrtc::AudioSendStream::Config& config,
|
||||
@ -59,7 +59,7 @@ class AudioSendStream final : public webrtc::AudioSendStream,
|
||||
BitrateAllocator* bitrate_allocator,
|
||||
RtcEventLog* event_log,
|
||||
RtcpRttStats* rtcp_rtt_stats,
|
||||
const rtc::Optional<RtpState>& suspended_rtp_state,
|
||||
const absl::optional<RtpState>& suspended_rtp_state,
|
||||
TimeInterval* overall_call_lifetime,
|
||||
std::unique_ptr<voe::ChannelProxy> channel_proxy);
|
||||
~AudioSendStream() override;
|
||||
@ -146,7 +146,7 @@ class AudioSendStream final : public webrtc::AudioSendStream,
|
||||
RTC_GUARDED_BY(&packet_loss_tracker_cs_);
|
||||
|
||||
RtpRtcp* rtp_rtcp_module_;
|
||||
rtc::Optional<RtpState> const suspended_rtp_state_;
|
||||
absl::optional<RtpState> const suspended_rtp_state_;
|
||||
|
||||
std::unique_ptr<TimedTransport> timed_send_transport_adapter_;
|
||||
TimeInterval active_lifetime_;
|
||||
|
||||
@ -109,17 +109,17 @@ rtc::scoped_refptr<MockAudioEncoderFactory> SetupEncoderFactoryMock() {
|
||||
std::begin(kCodecSpecs), std::end(kCodecSpecs))));
|
||||
ON_CALL(*factory.get(), QueryAudioEncoder(_))
|
||||
.WillByDefault(Invoke(
|
||||
[](const SdpAudioFormat& format) -> rtc::Optional<AudioCodecInfo> {
|
||||
[](const SdpAudioFormat& format) -> absl::optional<AudioCodecInfo> {
|
||||
for (const auto& spec : kCodecSpecs) {
|
||||
if (format == spec.format) {
|
||||
return spec.info;
|
||||
}
|
||||
}
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
}));
|
||||
ON_CALL(*factory.get(), MakeAudioEncoderMock(_, _, _, _))
|
||||
.WillByDefault(Invoke([](int payload_type, const SdpAudioFormat& format,
|
||||
rtc::Optional<AudioCodecPairId> codec_pair_id,
|
||||
absl::optional<AudioCodecPairId> codec_pair_id,
|
||||
std::unique_ptr<AudioEncoder>* return_value) {
|
||||
*return_value = SetupAudioEncoderMock(payload_type, format);
|
||||
}));
|
||||
@ -166,7 +166,7 @@ struct ConfigHelper {
|
||||
return std::unique_ptr<internal::AudioSendStream>(
|
||||
new internal::AudioSendStream(
|
||||
stream_config_, audio_state_, &worker_queue_, &rtp_transport_,
|
||||
&bitrate_allocator_, &event_log_, &rtcp_rtt_stats_, rtc::nullopt,
|
||||
&bitrate_allocator_, &event_log_, &rtcp_rtt_stats_, absl::nullopt,
|
||||
&active_lifetime_,
|
||||
std::unique_ptr<voe::ChannelProxy>(channel_proxy_)));
|
||||
}
|
||||
@ -424,7 +424,7 @@ TEST(AudioSendStreamTest, SendCodecAppliesAudioNetworkAdaptor) {
|
||||
EXPECT_CALL(helper.mock_encoder_factory(), MakeAudioEncoderMock(_, _, _, _))
|
||||
.WillOnce(Invoke([&kAnaConfigString, &kAnaReconfigString](
|
||||
int payload_type, const SdpAudioFormat& format,
|
||||
rtc::Optional<AudioCodecPairId> codec_pair_id,
|
||||
absl::optional<AudioCodecPairId> codec_pair_id,
|
||||
std::unique_ptr<AudioEncoder>* return_value) {
|
||||
auto mock_encoder = SetupAudioEncoderMock(payload_type, format);
|
||||
EXPECT_CALL(*mock_encoder,
|
||||
|
||||
@ -509,7 +509,7 @@ Channel::Channel(rtc::TaskQueue* encoder_queue,
|
||||
0,
|
||||
false,
|
||||
rtc::scoped_refptr<AudioDecoderFactory>(),
|
||||
rtc::nullopt) {
|
||||
absl::nullopt) {
|
||||
RTC_DCHECK(encoder_queue);
|
||||
encoder_queue_ = encoder_queue;
|
||||
}
|
||||
@ -520,7 +520,7 @@ Channel::Channel(ProcessThread* module_process_thread,
|
||||
size_t jitter_buffer_max_packets,
|
||||
bool jitter_buffer_fast_playout,
|
||||
rtc::scoped_refptr<AudioDecoderFactory> decoder_factory,
|
||||
rtc::Optional<AudioCodecPairId> codec_pair_id)
|
||||
absl::optional<AudioCodecPairId> codec_pair_id)
|
||||
: event_log_proxy_(new RtcEventLogProxy()),
|
||||
rtp_payload_registry_(new RTPPayloadRegistry()),
|
||||
rtp_receive_statistics_(
|
||||
|
||||
@ -16,11 +16,11 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/audio/audio_mixer.h"
|
||||
#include "api/audio_codecs/audio_encoder.h"
|
||||
#include "api/call/audio_sink.h"
|
||||
#include "api/call/transport.h"
|
||||
#include "api/optional.h"
|
||||
#include "audio/audio_level.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "modules/audio_coding/include/audio_coding_module.h"
|
||||
@ -158,7 +158,7 @@ class Channel
|
||||
size_t jitter_buffer_max_packets,
|
||||
bool jitter_buffer_fast_playout,
|
||||
rtc::scoped_refptr<AudioDecoderFactory> decoder_factory,
|
||||
rtc::Optional<AudioCodecPairId> codec_pair_id);
|
||||
absl::optional<AudioCodecPairId> codec_pair_id);
|
||||
virtual ~Channel();
|
||||
|
||||
void SetSink(AudioSinkInterface* sink);
|
||||
@ -353,7 +353,7 @@ class Channel
|
||||
RemoteNtpTimeEstimator ntp_estimator_ RTC_GUARDED_BY(ts_stats_lock_);
|
||||
|
||||
// Timestamp of the audio pulled from NetEq.
|
||||
rtc::Optional<uint32_t> jitter_buffer_playout_timestamp_;
|
||||
absl::optional<uint32_t> jitter_buffer_playout_timestamp_;
|
||||
|
||||
rtc::CriticalSection video_sync_lock_;
|
||||
uint32_t playout_timestamp_rtp_ RTC_GUARDED_BY(video_sync_lock_);
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -57,7 +57,7 @@ class TimeInterval {
|
||||
|
||||
int64_t first, last;
|
||||
};
|
||||
rtc::Optional<Interval> interval_;
|
||||
absl::optional<Interval> interval_;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -116,12 +116,12 @@ void TransportFeedbackPacketLossTracker::OnPacketFeedbackVector(
|
||||
}
|
||||
}
|
||||
|
||||
rtc::Optional<float>
|
||||
TransportFeedbackPacketLossTracker::GetPacketLossRate() const {
|
||||
absl::optional<float> TransportFeedbackPacketLossTracker::GetPacketLossRate()
|
||||
const {
|
||||
return plr_state_.GetMetric();
|
||||
}
|
||||
|
||||
rtc::Optional<float>
|
||||
absl::optional<float>
|
||||
TransportFeedbackPacketLossTracker::GetRecoverablePacketLossRate() const {
|
||||
return rplr_state_.GetMetric();
|
||||
}
|
||||
@ -344,20 +344,20 @@ void TransportFeedbackPacketLossTracker::Validate() const { // Testing only!
|
||||
RTC_CHECK_EQ(rplr_state_.num_recoverable_losses_, recoverable_losses);
|
||||
}
|
||||
|
||||
rtc::Optional<float>
|
||||
TransportFeedbackPacketLossTracker::PlrState::GetMetric() const {
|
||||
absl::optional<float> TransportFeedbackPacketLossTracker::PlrState::GetMetric()
|
||||
const {
|
||||
const size_t total = num_lost_packets_ + num_received_packets_;
|
||||
if (total < min_num_acked_packets_) {
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
} else {
|
||||
return static_cast<float>(num_lost_packets_) / total;
|
||||
}
|
||||
}
|
||||
|
||||
rtc::Optional<float>
|
||||
TransportFeedbackPacketLossTracker::RplrState::GetMetric() const {
|
||||
absl::optional<float> TransportFeedbackPacketLossTracker::RplrState::GetMetric()
|
||||
const {
|
||||
if (num_acked_pairs_ < min_num_acked_pairs_) {
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
} else {
|
||||
return static_cast<float>(num_recoverable_losses_) / num_acked_pairs_;
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -43,11 +43,11 @@ class TransportFeedbackPacketLossTracker final {
|
||||
|
||||
// Returns the packet loss rate, if the window has enough packet statuses to
|
||||
// reliably compute it. Otherwise, returns empty.
|
||||
rtc::Optional<float> GetPacketLossRate() const;
|
||||
absl::optional<float> GetPacketLossRate() const;
|
||||
|
||||
// Returns the first-order-FEC recoverable packet loss rate, if the window has
|
||||
// enough status pairs to reliably compute it. Otherwise, returns empty.
|
||||
rtc::Optional<float> GetRecoverablePacketLossRate() const;
|
||||
absl::optional<float> GetRecoverablePacketLossRate() const;
|
||||
|
||||
// Verifies that the internal states are correct. Only used for tests.
|
||||
void Validate() const;
|
||||
@ -108,7 +108,7 @@ class TransportFeedbackPacketLossTracker final {
|
||||
num_received_packets_ = 0;
|
||||
num_lost_packets_ = 0;
|
||||
}
|
||||
rtc::Optional<float> GetMetric() const;
|
||||
absl::optional<float> GetMetric() const;
|
||||
const size_t min_num_acked_packets_;
|
||||
size_t num_received_packets_;
|
||||
size_t num_lost_packets_;
|
||||
@ -124,7 +124,7 @@ class TransportFeedbackPacketLossTracker final {
|
||||
num_acked_pairs_ = 0;
|
||||
num_recoverable_losses_ = 0;
|
||||
}
|
||||
rtc::Optional<float> GetMetric() const;
|
||||
absl::optional<float> GetMetric() const;
|
||||
// Recoverable packets are those which were lost, but immediately followed
|
||||
// by a properly received packet. If that second packet carried FEC,
|
||||
// the data from the former (lost) packet could be recovered.
|
||||
|
||||
@ -94,18 +94,18 @@ class TransportFeedbackPacketLossTrackerTest
|
||||
// value is as expected.
|
||||
void ValidatePacketLossStatistics(
|
||||
const TransportFeedbackPacketLossTracker& tracker,
|
||||
rtc::Optional<float> expected_plr,
|
||||
rtc::Optional<float> expected_rplr) {
|
||||
// TODO(eladalon): Comparing the rtc::Optional<float> directly would have
|
||||
absl::optional<float> expected_plr,
|
||||
absl::optional<float> expected_rplr) {
|
||||
// TODO(eladalon): Comparing the absl::optional<float> directly would have
|
||||
// given concise code, but less readable error messages. If we modify
|
||||
// the way rtc::Optional is printed, we can get rid of this.
|
||||
rtc::Optional<float> plr = tracker.GetPacketLossRate();
|
||||
// the way absl::optional is printed, we can get rid of this.
|
||||
absl::optional<float> plr = tracker.GetPacketLossRate();
|
||||
EXPECT_EQ(static_cast<bool>(expected_plr), static_cast<bool>(plr));
|
||||
if (expected_plr && plr) {
|
||||
EXPECT_EQ(*expected_plr, *plr);
|
||||
}
|
||||
|
||||
rtc::Optional<float> rplr = tracker.GetRecoverablePacketLossRate();
|
||||
absl::optional<float> rplr = tracker.GetRecoverablePacketLossRate();
|
||||
EXPECT_EQ(static_cast<bool>(expected_rplr), static_cast<bool>(rplr));
|
||||
if (expected_rplr && rplr) {
|
||||
EXPECT_EQ(*expected_rplr, *rplr);
|
||||
@ -127,7 +127,7 @@ TEST_P(TransportFeedbackPacketLossTrackerTest, EmptyWindow) {
|
||||
TransportFeedbackPacketLossTracker tracker(kDefaultMaxWindowSizeMs, 5, 5);
|
||||
|
||||
// PLR and RPLR reported as unknown before reception of first feedback.
|
||||
ValidatePacketLossStatistics(tracker, rtc::nullopt, rtc::nullopt);
|
||||
ValidatePacketLossStatistics(tracker, absl::nullopt, absl::nullopt);
|
||||
}
|
||||
|
||||
// A feedback received for an empty window has no effect.
|
||||
@ -136,7 +136,7 @@ TEST_P(TransportFeedbackPacketLossTrackerTest, EmptyWindowFeedback) {
|
||||
|
||||
// Feedback doesn't correspond to any packets - ignored.
|
||||
AddTransportFeedbackAndValidate(&tracker, base_, {true, false, true});
|
||||
ValidatePacketLossStatistics(tracker, rtc::nullopt, rtc::nullopt);
|
||||
ValidatePacketLossStatistics(tracker, absl::nullopt, absl::nullopt);
|
||||
|
||||
// After the packets are transmitted, acking them would have an effect.
|
||||
SendPackets(&tracker, base_, 3, kDefaultSendIntervalMs);
|
||||
@ -153,7 +153,7 @@ TEST_P(TransportFeedbackPacketLossTrackerTest, PartiallyFilledWindow) {
|
||||
// Expected window contents: [] -> [1001].
|
||||
SendPackets(&tracker, base_, 3, kDefaultSendIntervalMs);
|
||||
AddTransportFeedbackAndValidate(&tracker, base_, {true, false, false, true});
|
||||
ValidatePacketLossStatistics(tracker, rtc::nullopt, rtc::nullopt);
|
||||
ValidatePacketLossStatistics(tracker, absl::nullopt, absl::nullopt);
|
||||
}
|
||||
|
||||
// Sanity check on minimum filled window - PLR known, RPLR unknown.
|
||||
@ -166,7 +166,7 @@ TEST_P(TransportFeedbackPacketLossTrackerTest, PlrMinimumFilledWindow) {
|
||||
SendPackets(&tracker, base_, 5, kDefaultSendIntervalMs);
|
||||
AddTransportFeedbackAndValidate(&tracker, base_,
|
||||
{true, false, false, true, true});
|
||||
ValidatePacketLossStatistics(tracker, 2.0f / 5.0f, rtc::nullopt);
|
||||
ValidatePacketLossStatistics(tracker, 2.0f / 5.0f, absl::nullopt);
|
||||
}
|
||||
|
||||
// Sanity check on minimum filled window - PLR unknown, RPLR known.
|
||||
@ -179,7 +179,7 @@ TEST_P(TransportFeedbackPacketLossTrackerTest, RplrMinimumFilledWindow) {
|
||||
SendPackets(&tracker, base_, 5, kDefaultSendIntervalMs);
|
||||
AddTransportFeedbackAndValidate(&tracker, base_,
|
||||
{true, false, false, true, true});
|
||||
ValidatePacketLossStatistics(tracker, rtc::nullopt, 1.0f / 4.0f);
|
||||
ValidatePacketLossStatistics(tracker, absl::nullopt, 1.0f / 4.0f);
|
||||
}
|
||||
|
||||
// If packets are sent close enough together that the clock reading for both
|
||||
@ -203,7 +203,7 @@ TEST_P(TransportFeedbackPacketLossTrackerTest, ExtendWindow) {
|
||||
// Expected window contents: [] -> [10011].
|
||||
AddTransportFeedbackAndValidate(&tracker, base_,
|
||||
{true, false, false, true, true});
|
||||
ValidatePacketLossStatistics(tracker, 2.0f / 5.0f, rtc::nullopt);
|
||||
ValidatePacketLossStatistics(tracker, 2.0f / 5.0f, absl::nullopt);
|
||||
|
||||
// Expected window contents: [10011] -> [1001110101].
|
||||
AddTransportFeedbackAndValidate(&tracker, base_ + 5,
|
||||
@ -520,7 +520,7 @@ TEST_P(TransportFeedbackPacketLossTrackerTest, RepeatedSeqNumResetsWindow) {
|
||||
// A reset occurs.
|
||||
SendPackets(&tracker, {static_cast<uint16_t>(base_ + 2)},
|
||||
kDefaultSendIntervalMs);
|
||||
ValidatePacketLossStatistics(tracker, rtc::nullopt, rtc::nullopt);
|
||||
ValidatePacketLossStatistics(tracker, absl::nullopt, absl::nullopt);
|
||||
}
|
||||
|
||||
// The window is reset by the sending of a packet which is 0x8000 or more
|
||||
@ -539,7 +539,7 @@ TEST_P(TransportFeedbackPacketLossTrackerTest,
|
||||
// A reset occurs.
|
||||
SendPackets(&tracker, {static_cast<uint16_t>(base_ + 5 + 0x8000)},
|
||||
kDefaultSendIntervalMs);
|
||||
ValidatePacketLossStatistics(tracker, rtc::nullopt, rtc::nullopt);
|
||||
ValidatePacketLossStatistics(tracker, absl::nullopt, absl::nullopt);
|
||||
}
|
||||
|
||||
#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
|
||||
|
||||
@ -33,7 +33,6 @@ rtc_source_set("call_interfaces") {
|
||||
"../:typedefs",
|
||||
"../api:fec_controller_api",
|
||||
"../api:libjingle_peerconnection_api",
|
||||
"../api:optional",
|
||||
"../api:transport_api",
|
||||
"../api/audio:audio_mixer_api",
|
||||
"../api/audio_codecs:audio_codecs_api",
|
||||
@ -44,6 +43,7 @@ rtc_source_set("call_interfaces") {
|
||||
"../rtc_base:audio_format_to_string",
|
||||
"../rtc_base:rtc_base",
|
||||
"../rtc_base:rtc_base_approved",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
|
||||
@ -61,9 +61,9 @@ rtc_source_set("rtp_interfaces") {
|
||||
]
|
||||
deps = [
|
||||
"../api:array_view",
|
||||
"../api:optional",
|
||||
"../api/transport:bitrate_settings",
|
||||
"../rtc_base:rtc_base_approved",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
|
||||
@ -87,11 +87,11 @@ rtc_source_set("rtp_receiver") {
|
||||
"..:webrtc_common",
|
||||
"../api:array_view",
|
||||
"../api:libjingle_peerconnection_api",
|
||||
"../api:optional",
|
||||
"../modules/rtp_rtcp",
|
||||
"../modules/rtp_rtcp:rtp_rtcp_format",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:rtc_base_approved",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
|
||||
@ -177,7 +177,6 @@ rtc_static_library("call") {
|
||||
":video_stream_api",
|
||||
"..:webrtc_common",
|
||||
"../api:callfactory_api",
|
||||
"../api:optional",
|
||||
"../api:transport_api",
|
||||
"../api/transport:network_control",
|
||||
"../audio",
|
||||
@ -204,6 +203,7 @@ rtc_static_library("call") {
|
||||
"../system_wrappers:field_trial_api",
|
||||
"../system_wrappers:metrics_api",
|
||||
"../video",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
|
||||
@ -220,7 +220,6 @@ rtc_source_set("video_stream_api") {
|
||||
"../:typedefs",
|
||||
"../:webrtc_common",
|
||||
"../api:libjingle_peerconnection_api",
|
||||
"../api:optional",
|
||||
"../api:transport_api",
|
||||
"../api/video:video_frame",
|
||||
"../api/video_codecs:video_codecs_api",
|
||||
@ -228,6 +227,7 @@ rtc_source_set("video_stream_api") {
|
||||
"../modules/rtp_rtcp:rtp_rtcp_format",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:rtc_base_approved",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@ -16,9 +16,9 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/audio_codecs/audio_decoder_factory.h"
|
||||
#include "api/call/transport.h"
|
||||
#include "api/optional.h"
|
||||
#include "api/rtpparameters.h"
|
||||
#include "api/rtpreceiverinterface.h"
|
||||
#include "call/rtp_config.h"
|
||||
@ -40,7 +40,7 @@ class AudioReceiveStream {
|
||||
uint32_t packets_lost = 0;
|
||||
float fraction_lost = 0.0f;
|
||||
std::string codec_name;
|
||||
rtc::Optional<int> codec_payload_type;
|
||||
absl::optional<int> codec_payload_type;
|
||||
uint32_t ext_seqnum = 0;
|
||||
uint32_t jitter_ms = 0;
|
||||
uint32_t jitter_buffer_ms = 0;
|
||||
@ -120,7 +120,7 @@ class AudioReceiveStream {
|
||||
|
||||
rtc::scoped_refptr<AudioDecoderFactory> decoder_factory;
|
||||
|
||||
rtc::Optional<AudioCodecPairId> codec_pair_id;
|
||||
absl::optional<AudioCodecPairId> codec_pair_id;
|
||||
};
|
||||
|
||||
// Reconfigure the stream according to the Configuration.
|
||||
|
||||
@ -15,12 +15,12 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/audio_codecs/audio_codec_pair_id.h"
|
||||
#include "api/audio_codecs/audio_encoder.h"
|
||||
#include "api/audio_codecs/audio_encoder_factory.h"
|
||||
#include "api/audio_codecs/audio_format.h"
|
||||
#include "api/call/transport.h"
|
||||
#include "api/optional.h"
|
||||
#include "api/rtpparameters.h"
|
||||
#include "call/rtp_config.h"
|
||||
#include "modules/audio_processing/include/audio_processing_statistics.h"
|
||||
@ -44,7 +44,7 @@ class AudioSendStream {
|
||||
int32_t packets_lost = -1;
|
||||
float fraction_lost = -1.0f;
|
||||
std::string codec_name;
|
||||
rtc::Optional<int> codec_payload_type;
|
||||
absl::optional<int> codec_payload_type;
|
||||
int32_t ext_seqnum = -1;
|
||||
int32_t jitter_ms = -1;
|
||||
int64_t rtt_ms = -1;
|
||||
@ -102,7 +102,7 @@ class AudioSendStream {
|
||||
|
||||
// Defines whether to turn on audio network adaptor, and defines its config
|
||||
// string.
|
||||
rtc::Optional<std::string> audio_network_adaptor_config;
|
||||
absl::optional<std::string> audio_network_adaptor_config;
|
||||
|
||||
struct SendCodecSpec {
|
||||
SendCodecSpec(int payload_type, const SdpAudioFormat& format);
|
||||
@ -118,14 +118,14 @@ class AudioSendStream {
|
||||
SdpAudioFormat format;
|
||||
bool nack_enabled = false;
|
||||
bool transport_cc_enabled = false;
|
||||
rtc::Optional<int> cng_payload_type;
|
||||
absl::optional<int> cng_payload_type;
|
||||
// If unset, use the encoder's default target bitrate.
|
||||
rtc::Optional<int> target_bitrate_bps;
|
||||
absl::optional<int> target_bitrate_bps;
|
||||
};
|
||||
|
||||
rtc::Optional<SendCodecSpec> send_codec_spec;
|
||||
absl::optional<SendCodecSpec> send_codec_spec;
|
||||
rtc::scoped_refptr<AudioEncoderFactory> encoder_factory;
|
||||
rtc::Optional<AudioCodecPairId> codec_pair_id;
|
||||
absl::optional<AudioCodecPairId> codec_pair_id;
|
||||
|
||||
// Track ID as specified during track creation.
|
||||
std::string track_id;
|
||||
|
||||
@ -167,7 +167,7 @@ class BitrateEstimatorTest : public test::CallTest {
|
||||
test_->video_encoder_config_.Copy());
|
||||
RTC_DCHECK_EQ(1, test_->video_encoder_config_.number_of_streams);
|
||||
frame_generator_capturer_.reset(test::FrameGeneratorCapturer::Create(
|
||||
kDefaultWidth, kDefaultHeight, rtc::nullopt, rtc::nullopt,
|
||||
kDefaultWidth, kDefaultHeight, absl::nullopt, absl::nullopt,
|
||||
kDefaultFramerate, Clock::GetRealTimeClock()));
|
||||
send_stream_->SetSource(frame_generator_capturer_.get(),
|
||||
DegradationPreference::MAINTAIN_FRAMERATE);
|
||||
|
||||
12
call/call.cc
12
call/call.cc
@ -16,7 +16,7 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/transport/network_control.h"
|
||||
#include "audio/audio_receive_stream.h"
|
||||
#include "audio/audio_send_stream.h"
|
||||
@ -343,10 +343,10 @@ class Call final : public webrtc::Call,
|
||||
RateCounter received_audio_bytes_per_second_counter_;
|
||||
RateCounter received_video_bytes_per_second_counter_;
|
||||
RateCounter received_rtcp_bytes_per_second_counter_;
|
||||
rtc::Optional<int64_t> first_received_rtp_audio_ms_;
|
||||
rtc::Optional<int64_t> last_received_rtp_audio_ms_;
|
||||
rtc::Optional<int64_t> first_received_rtp_video_ms_;
|
||||
rtc::Optional<int64_t> last_received_rtp_video_ms_;
|
||||
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_;
|
||||
TimeInterval sent_rtp_audio_timer_ms_;
|
||||
|
||||
rtc::CriticalSection last_bandwidth_bps_crit_;
|
||||
@ -584,7 +584,7 @@ webrtc::AudioSendStream* Call::CreateAudioSendStream(
|
||||
event_log_->Log(rtc::MakeUnique<RtcEventAudioSendStreamConfig>(
|
||||
CreateRtcLogStreamConfig(config)));
|
||||
|
||||
rtc::Optional<RtpState> suspended_rtp_state;
|
||||
absl::optional<RtpState> suspended_rtp_state;
|
||||
{
|
||||
const auto& iter = suspended_audio_send_ssrcs_.find(config.rtp.ssrc);
|
||||
if (iter != suspended_audio_send_ssrcs_.end()) {
|
||||
|
||||
@ -914,7 +914,7 @@ void CallPerfTest::TestMinAudioVideoBitrate(
|
||||
send_config->max_bitrate_bps = kOpusBitrateFbBps;
|
||||
} else {
|
||||
send_config->send_codec_spec->target_bitrate_bps =
|
||||
rtc::Optional<int>(kOpusBitrateFbBps);
|
||||
absl::optional<int>(kOpusBitrateFbBps);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "call/call.h"
|
||||
#include "call/degraded_call.h"
|
||||
#include "call/fake_network_pipe.h"
|
||||
@ -30,7 +30,7 @@ bool ParseConfigParam(std::string exp_name, int* field) {
|
||||
return (sscanf(group.c_str(), "%d", field) == 1);
|
||||
}
|
||||
|
||||
rtc::Optional<webrtc::FakeNetworkPipe::Config> ParseDegradationConfig(
|
||||
absl::optional<webrtc::FakeNetworkPipe::Config> ParseDegradationConfig(
|
||||
bool send) {
|
||||
std::string exp_prefix = "WebRTCFakeNetwork";
|
||||
if (send) {
|
||||
@ -62,15 +62,15 @@ rtc::Optional<webrtc::FakeNetworkPipe::Config> ParseDegradationConfig(
|
||||
}
|
||||
configured |= ParseConfigParam(exp_prefix + "AvgBurstLossLength",
|
||||
&config.avg_burst_loss_length);
|
||||
return configured ? rtc::Optional<webrtc::FakeNetworkPipe::Config>(config)
|
||||
: rtc::nullopt;
|
||||
return configured ? absl::optional<webrtc::FakeNetworkPipe::Config>(config)
|
||||
: absl::nullopt;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
Call* CallFactory::CreateCall(const Call::Config& config) {
|
||||
rtc::Optional<webrtc::FakeNetworkPipe::Config> send_degradation_config =
|
||||
absl::optional<webrtc::FakeNetworkPipe::Config> send_degradation_config =
|
||||
ParseDegradationConfig(true);
|
||||
rtc::Optional<webrtc::FakeNetworkPipe::Config> receive_degradation_config =
|
||||
absl::optional<webrtc::FakeNetworkPipe::Config> receive_degradation_config =
|
||||
ParseDegradationConfig(false);
|
||||
|
||||
if (send_degradation_config || receive_degradation_config) {
|
||||
|
||||
@ -17,8 +17,8 @@
|
||||
namespace webrtc {
|
||||
DegradedCall::DegradedCall(
|
||||
std::unique_ptr<Call> call,
|
||||
rtc::Optional<FakeNetworkPipe::Config> send_config,
|
||||
rtc::Optional<FakeNetworkPipe::Config> receive_config)
|
||||
absl::optional<FakeNetworkPipe::Config> send_config,
|
||||
absl::optional<FakeNetworkPipe::Config> receive_config)
|
||||
: clock_(Clock::GetRealTimeClock()),
|
||||
call_(std::move(call)),
|
||||
send_config_(send_config),
|
||||
|
||||
@ -13,8 +13,8 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/call/transport.h"
|
||||
#include "api/optional.h"
|
||||
#include "call/call.h"
|
||||
#include "call/fake_network_pipe.h"
|
||||
#include "modules/utility/include/process_thread.h"
|
||||
@ -25,8 +25,8 @@ namespace webrtc {
|
||||
class DegradedCall : public Call, private Transport, private PacketReceiver {
|
||||
public:
|
||||
explicit DegradedCall(std::unique_ptr<Call> call,
|
||||
rtc::Optional<FakeNetworkPipe::Config> send_config,
|
||||
rtc::Optional<FakeNetworkPipe::Config> receive_config);
|
||||
absl::optional<FakeNetworkPipe::Config> send_config,
|
||||
absl::optional<FakeNetworkPipe::Config> receive_config);
|
||||
~DegradedCall() override;
|
||||
|
||||
// Implements Call.
|
||||
@ -90,12 +90,12 @@ class DegradedCall : public Call, private Transport, private PacketReceiver {
|
||||
Clock* const clock_;
|
||||
const std::unique_ptr<Call> call_;
|
||||
|
||||
const rtc::Optional<FakeNetworkPipe::Config> send_config_;
|
||||
const absl::optional<FakeNetworkPipe::Config> send_config_;
|
||||
const std::unique_ptr<ProcessThread> send_process_thread_;
|
||||
std::unique_ptr<FakeNetworkPipe> send_pipe_;
|
||||
size_t num_send_streams_;
|
||||
|
||||
const rtc::Optional<FakeNetworkPipe::Config> receive_config_;
|
||||
const absl::optional<FakeNetworkPipe::Config> receive_config_;
|
||||
std::unique_ptr<FakeNetworkPipe> receive_pipe_;
|
||||
};
|
||||
|
||||
|
||||
@ -32,10 +32,10 @@ constexpr int64_t kLogIntervalMs = 5000;
|
||||
NetworkPacket::NetworkPacket(rtc::CopyOnWriteBuffer packet,
|
||||
int64_t send_time,
|
||||
int64_t arrival_time,
|
||||
rtc::Optional<PacketOptions> packet_options,
|
||||
absl::optional<PacketOptions> packet_options,
|
||||
bool is_rtcp,
|
||||
MediaType media_type,
|
||||
rtc::Optional<PacketTime> packet_time)
|
||||
absl::optional<PacketTime> packet_time)
|
||||
: packet_(std::move(packet)),
|
||||
send_time_(send_time),
|
||||
arrival_time_(arrival_time),
|
||||
@ -115,14 +115,14 @@ bool FakeNetworkPipe::SendRtp(const uint8_t* packet,
|
||||
const PacketOptions& options) {
|
||||
RTC_DCHECK(HasTransport());
|
||||
EnqueuePacket(rtc::CopyOnWriteBuffer(packet, length), options, false,
|
||||
MediaType::ANY, rtc::nullopt);
|
||||
MediaType::ANY, absl::nullopt);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FakeNetworkPipe::SendRtcp(const uint8_t* packet, size_t length) {
|
||||
RTC_DCHECK(HasTransport());
|
||||
EnqueuePacket(rtc::CopyOnWriteBuffer(packet, length), rtc::nullopt, true,
|
||||
MediaType::ANY, rtc::nullopt);
|
||||
EnqueuePacket(rtc::CopyOnWriteBuffer(packet, length), absl::nullopt, true,
|
||||
MediaType::ANY, absl::nullopt);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -130,7 +130,7 @@ PacketReceiver::DeliveryStatus FakeNetworkPipe::DeliverPacket(
|
||||
MediaType media_type,
|
||||
rtc::CopyOnWriteBuffer packet,
|
||||
const PacketTime& packet_time) {
|
||||
return EnqueuePacket(std::move(packet), rtc::nullopt, false, media_type,
|
||||
return EnqueuePacket(std::move(packet), absl::nullopt, false, media_type,
|
||||
packet_time)
|
||||
? PacketReceiver::DELIVERY_OK
|
||||
: PacketReceiver::DELIVERY_PACKET_ERROR;
|
||||
@ -213,20 +213,20 @@ bool SimulatedNetwork::EnqueuePacket(PacketInFlightInfo packet) {
|
||||
return true;
|
||||
}
|
||||
|
||||
rtc::Optional<int64_t> SimulatedNetwork::NextDeliveryTimeUs() const {
|
||||
absl::optional<int64_t> SimulatedNetwork::NextDeliveryTimeUs() const {
|
||||
if (!delay_link_.empty())
|
||||
return delay_link_.begin()->arrival_time_us;
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
FakeNetworkPipe::StoredPacket::StoredPacket(NetworkPacket&& packet)
|
||||
: packet(std::move(packet)) {}
|
||||
|
||||
bool FakeNetworkPipe::EnqueuePacket(rtc::CopyOnWriteBuffer packet,
|
||||
rtc::Optional<PacketOptions> options,
|
||||
absl::optional<PacketOptions> options,
|
||||
bool is_rtcp,
|
||||
MediaType media_type,
|
||||
rtc::Optional<PacketTime> packet_time) {
|
||||
absl::optional<PacketTime> packet_time) {
|
||||
int64_t time_now_us = clock_->TimeInMicroseconds();
|
||||
rtc::CritScope crit(&process_lock_);
|
||||
size_t packet_size = packet.size();
|
||||
@ -413,7 +413,7 @@ void FakeNetworkPipe::Process() {
|
||||
packets_to_deliver.pop();
|
||||
DeliverPacket(&packet);
|
||||
}
|
||||
rtc::Optional<int64_t> delivery_us =
|
||||
absl::optional<int64_t> delivery_us =
|
||||
network_simulation_->NextDeliveryTimeUs();
|
||||
next_process_time_us_ = delivery_us
|
||||
? *delivery_us
|
||||
|
||||
@ -40,10 +40,10 @@ class NetworkPacket {
|
||||
NetworkPacket(rtc::CopyOnWriteBuffer packet,
|
||||
int64_t send_time,
|
||||
int64_t arrival_time,
|
||||
rtc::Optional<PacketOptions> packet_options,
|
||||
absl::optional<PacketOptions> packet_options,
|
||||
bool is_rtcp,
|
||||
MediaType media_type_,
|
||||
rtc::Optional<PacketTime> packet_time_);
|
||||
absl::optional<PacketTime> packet_time_);
|
||||
// Disallow copy constructor and copy assignment (no deep copies of |data_|).
|
||||
NetworkPacket(const NetworkPacket&) = delete;
|
||||
NetworkPacket& operator=(const NetworkPacket&) = delete;
|
||||
@ -74,14 +74,14 @@ class NetworkPacket {
|
||||
int64_t arrival_time_;
|
||||
// If using a Transport for outgoing degradation, populate with
|
||||
// PacketOptions (transport-wide sequence number) for RTP.
|
||||
rtc::Optional<PacketOptions> packet_options_;
|
||||
absl::optional<PacketOptions> packet_options_;
|
||||
bool is_rtcp_;
|
||||
// If using a PacketReceiver for incoming degradation, populate with
|
||||
// appropriate MediaType and PacketTime. This type/timing will be kept and
|
||||
// forwarded. The PacketTime might be altered to reflect time spent in fake
|
||||
// network pipe.
|
||||
MediaType media_type_;
|
||||
rtc::Optional<PacketTime> packet_time_;
|
||||
absl::optional<PacketTime> packet_time_;
|
||||
};
|
||||
|
||||
struct PacketInFlightInfo {
|
||||
@ -108,7 +108,7 @@ class NetworkSimulationInterface {
|
||||
// Retrieves all packets that should be delivered by the given receive time.
|
||||
virtual std::vector<PacketDeliveryInfo> DequeueDeliverablePackets(
|
||||
int64_t receive_time_us) = 0;
|
||||
virtual rtc::Optional<int64_t> NextDeliveryTimeUs() const = 0;
|
||||
virtual absl::optional<int64_t> NextDeliveryTimeUs() const = 0;
|
||||
virtual ~NetworkSimulationInterface() = default;
|
||||
};
|
||||
|
||||
@ -144,7 +144,7 @@ class SimulatedNetwork : public NetworkSimulationInterface {
|
||||
std::vector<PacketDeliveryInfo> DequeueDeliverablePackets(
|
||||
int64_t receive_time_us) override;
|
||||
|
||||
rtc::Optional<int64_t> NextDeliveryTimeUs() const override;
|
||||
absl::optional<int64_t> NextDeliveryTimeUs() const override;
|
||||
|
||||
private:
|
||||
struct PacketInfo {
|
||||
@ -260,10 +260,10 @@ class FakeNetworkPipe : public Transport, public PacketReceiver, public Module {
|
||||
|
||||
// Returns true if enqueued, or false if packet was dropped.
|
||||
virtual bool EnqueuePacket(rtc::CopyOnWriteBuffer packet,
|
||||
rtc::Optional<PacketOptions> options,
|
||||
bool is_rtcp,
|
||||
MediaType media_type,
|
||||
rtc::Optional<PacketTime> packet_time);
|
||||
absl::optional<PacketOptions> options,
|
||||
bool is_rtcp,
|
||||
MediaType media_type,
|
||||
absl::optional<PacketTime> packet_time);
|
||||
void DeliverPacket(NetworkPacket* packet)
|
||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(config_lock_);
|
||||
bool HasTransport() const;
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
#include <stdint.h>
|
||||
#include <memory>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -39,7 +39,7 @@ class ReceiveTimeCalculator {
|
||||
private:
|
||||
const int64_t min_delta_us_;
|
||||
const int64_t max_delta_diff_us_;
|
||||
rtc::Optional<int64_t> receive_time_offset_us_;
|
||||
absl::optional<int64_t> receive_time_offset_us_;
|
||||
int64_t last_packet_time_us_ = 0;
|
||||
int64_t last_safe_time_us_ = 0;
|
||||
};
|
||||
|
||||
@ -66,7 +66,7 @@ void RtcpDemuxer::RemoveBroadcastSink(const RtcpPacketSinkInterface* sink) {
|
||||
|
||||
void RtcpDemuxer::OnRtcpPacket(rtc::ArrayView<const uint8_t> packet) {
|
||||
// Perform sender-SSRC-based demuxing for packets with a sender-SSRC.
|
||||
rtc::Optional<uint32_t> sender_ssrc = ParseRtcpPacketSenderSsrc(packet);
|
||||
absl::optional<uint32_t> sender_ssrc = ParseRtcpPacketSenderSsrc(packet);
|
||||
if (sender_ssrc) {
|
||||
auto it_range = ssrc_sinks_.equal_range(*sender_ssrc);
|
||||
for (auto it = it_range.first; it != it_range.second; ++it) {
|
||||
|
||||
@ -33,7 +33,7 @@ BitrateConstraints RtpBitrateConfigurator::GetConfig() const {
|
||||
return bitrate_config_;
|
||||
}
|
||||
|
||||
rtc::Optional<BitrateConstraints>
|
||||
absl::optional<BitrateConstraints>
|
||||
RtpBitrateConfigurator::UpdateWithSdpParameters(
|
||||
const BitrateConstraints& bitrate_config) {
|
||||
RTC_DCHECK_GE(bitrate_config.min_bitrate_bps, 0);
|
||||
@ -42,7 +42,7 @@ RtpBitrateConfigurator::UpdateWithSdpParameters(
|
||||
RTC_DCHECK_GT(bitrate_config.max_bitrate_bps, 0);
|
||||
}
|
||||
|
||||
rtc::Optional<int> new_start;
|
||||
absl::optional<int> new_start;
|
||||
// Only update the "start" bitrate if it's set, and different from the old
|
||||
// value. In practice, this value comes from the x-google-start-bitrate codec
|
||||
// parameter in SDP, and setting the same remote description twice shouldn't
|
||||
@ -56,15 +56,15 @@ RtpBitrateConfigurator::UpdateWithSdpParameters(
|
||||
return UpdateConstraints(new_start);
|
||||
}
|
||||
|
||||
rtc::Optional<BitrateConstraints>
|
||||
absl::optional<BitrateConstraints>
|
||||
RtpBitrateConfigurator::UpdateWithClientPreferences(
|
||||
const BitrateSettings& bitrate_mask) {
|
||||
bitrate_config_mask_ = bitrate_mask;
|
||||
return UpdateConstraints(bitrate_mask.start_bitrate_bps);
|
||||
}
|
||||
|
||||
rtc::Optional<BitrateConstraints> RtpBitrateConfigurator::UpdateConstraints(
|
||||
const rtc::Optional<int>& new_start) {
|
||||
absl::optional<BitrateConstraints> RtpBitrateConfigurator::UpdateConstraints(
|
||||
const absl::optional<int>& new_start) {
|
||||
BitrateConstraints updated;
|
||||
updated.min_bitrate_bps =
|
||||
std::max(bitrate_config_mask_.min_bitrate_bps.value_or(0),
|
||||
@ -86,7 +86,7 @@ rtc::Optional<BitrateConstraints> RtpBitrateConfigurator::UpdateConstraints(
|
||||
if (updated.min_bitrate_bps == bitrate_config_.min_bitrate_bps &&
|
||||
updated.max_bitrate_bps == bitrate_config_.max_bitrate_bps &&
|
||||
!new_start) {
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
if (new_start) {
|
||||
|
||||
@ -32,7 +32,7 @@ class RtpBitrateConfigurator {
|
||||
// implemented. Passing -1 leaves the start bitrate unchanged. Behavior is not
|
||||
// guaranteed for other negative values or 0.
|
||||
// The optional return value is set with new configuration if it was updated.
|
||||
rtc::Optional<BitrateConstraints> UpdateWithSdpParameters(
|
||||
absl::optional<BitrateConstraints> UpdateWithSdpParameters(
|
||||
const BitrateConstraints& bitrate_config_);
|
||||
|
||||
// The greater min and smaller max set by this and SetSdpBitrateParameters
|
||||
@ -41,14 +41,14 @@ class RtpBitrateConfigurator {
|
||||
// Assumes 0 <= min <= start <= max holds for set parameters.
|
||||
// Update the bitrate configuration
|
||||
// The optional return value is set with new configuration if it was updated.
|
||||
rtc::Optional<BitrateConstraints> UpdateWithClientPreferences(
|
||||
absl::optional<BitrateConstraints> UpdateWithClientPreferences(
|
||||
const BitrateSettings& bitrate_mask);
|
||||
|
||||
private:
|
||||
// Applies update to the BitrateConstraints cached in |config_|, resetting
|
||||
// with |new_start| if set.
|
||||
rtc::Optional<BitrateConstraints> UpdateConstraints(
|
||||
const rtc::Optional<int>& new_start);
|
||||
absl::optional<BitrateConstraints> UpdateConstraints(
|
||||
const absl::optional<int>& new_start);
|
||||
|
||||
// Bitrate config used until valid bitrate estimates are calculated. Also
|
||||
// used to cap total bitrate used. This comes from the remote connection.
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
#include "test/gtest.h"
|
||||
|
||||
namespace webrtc {
|
||||
using rtc::nullopt;
|
||||
using absl::nullopt;
|
||||
|
||||
class RtpBitrateConfiguratorTest : public testing::Test {
|
||||
public:
|
||||
@ -21,10 +21,10 @@ class RtpBitrateConfiguratorTest : public testing::Test {
|
||||
: configurator_(new RtpBitrateConfigurator(BitrateConstraints())) {}
|
||||
std::unique_ptr<RtpBitrateConfigurator> configurator_;
|
||||
void UpdateConfigMatches(BitrateConstraints bitrate_config,
|
||||
rtc::Optional<int> min_bitrate_bps,
|
||||
rtc::Optional<int> start_bitrate_bps,
|
||||
rtc::Optional<int> max_bitrate_bps) {
|
||||
rtc::Optional<BitrateConstraints> result =
|
||||
absl::optional<int> min_bitrate_bps,
|
||||
absl::optional<int> start_bitrate_bps,
|
||||
absl::optional<int> max_bitrate_bps) {
|
||||
absl::optional<BitrateConstraints> result =
|
||||
configurator_->UpdateWithSdpParameters(bitrate_config);
|
||||
EXPECT_TRUE(result.has_value());
|
||||
if (start_bitrate_bps.has_value())
|
||||
@ -36,10 +36,10 @@ class RtpBitrateConfiguratorTest : public testing::Test {
|
||||
}
|
||||
|
||||
void UpdateMaskMatches(BitrateSettings bitrate_mask,
|
||||
rtc::Optional<int> min_bitrate_bps,
|
||||
rtc::Optional<int> start_bitrate_bps,
|
||||
rtc::Optional<int> max_bitrate_bps) {
|
||||
rtc::Optional<BitrateConstraints> result =
|
||||
absl::optional<int> min_bitrate_bps,
|
||||
absl::optional<int> start_bitrate_bps,
|
||||
absl::optional<int> max_bitrate_bps) {
|
||||
absl::optional<BitrateConstraints> result =
|
||||
configurator_->UpdateWithClientPreferences(bitrate_mask);
|
||||
EXPECT_TRUE(result.has_value());
|
||||
if (start_bitrate_bps.has_value())
|
||||
|
||||
@ -21,13 +21,13 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
rtc::Optional<uint32_t> ParseRtcpPacketSenderSsrc(
|
||||
absl::optional<uint32_t> ParseRtcpPacketSenderSsrc(
|
||||
rtc::ArrayView<const uint8_t> packet) {
|
||||
rtcp::CommonHeader header;
|
||||
for (const uint8_t* next_packet = packet.begin(); next_packet < packet.end();
|
||||
next_packet = header.NextPacket()) {
|
||||
if (!header.Parse(next_packet, packet.end() - next_packet)) {
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
switch (header.type()) {
|
||||
@ -43,13 +43,13 @@ rtc::Optional<uint32_t> ParseRtcpPacketSenderSsrc(
|
||||
ByteReader<uint32_t>::ReadBigEndian(header.payload());
|
||||
return ssrc_sender;
|
||||
} else {
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -15,8 +15,8 @@
|
||||
#include <map>
|
||||
#include <utility>
|
||||
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/array_view.h"
|
||||
#include "api/optional.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -89,7 +89,7 @@ bool MultimapHasKey(const Container& c,
|
||||
return it_range.first != it_range.second;
|
||||
}
|
||||
|
||||
rtc::Optional<uint32_t> ParseRtcpPacketSenderSsrc(
|
||||
absl::optional<uint32_t> ParseRtcpPacketSenderSsrc(
|
||||
rtc::ArrayView<const uint8_t> packet);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -34,7 +34,7 @@ TEST(RtpRtcpDemuxerHelperTest, ParseRtcpPacketSenderSsrc_ByePacket) {
|
||||
rtcp_packet.SetSenderSsrc(kSsrc);
|
||||
rtc::Buffer raw_packet = rtcp_packet.Build();
|
||||
|
||||
rtc::Optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(raw_packet);
|
||||
absl::optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(raw_packet);
|
||||
EXPECT_EQ(ssrc, kSsrc);
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ TEST(RtpRtcpDemuxerHelperTest,
|
||||
rtcp_packet.SetSenderSsrc(kSsrc);
|
||||
rtc::Buffer raw_packet = rtcp_packet.Build();
|
||||
|
||||
rtc::Optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(raw_packet);
|
||||
absl::optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(raw_packet);
|
||||
EXPECT_EQ(ssrc, kSsrc);
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ TEST(RtpRtcpDemuxerHelperTest, ParseRtcpPacketSenderSsrc_PsfbPacket) {
|
||||
rtcp_packet.SetSenderSsrc(kSsrc);
|
||||
rtc::Buffer raw_packet = rtcp_packet.Build();
|
||||
|
||||
rtc::Optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(raw_packet);
|
||||
absl::optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(raw_packet);
|
||||
EXPECT_EQ(ssrc, kSsrc);
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ TEST(RtpRtcpDemuxerHelperTest, ParseRtcpPacketSenderSsrc_ReceiverReportPacket) {
|
||||
rtcp_packet.SetSenderSsrc(kSsrc);
|
||||
rtc::Buffer raw_packet = rtcp_packet.Build();
|
||||
|
||||
rtc::Optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(raw_packet);
|
||||
absl::optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(raw_packet);
|
||||
EXPECT_EQ(ssrc, kSsrc);
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ TEST(RtpRtcpDemuxerHelperTest, ParseRtcpPacketSenderSsrc_RtpfbPacket) {
|
||||
rtcp_packet.SetSenderSsrc(kSsrc);
|
||||
rtc::Buffer raw_packet = rtcp_packet.Build();
|
||||
|
||||
rtc::Optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(raw_packet);
|
||||
absl::optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(raw_packet);
|
||||
EXPECT_EQ(ssrc, kSsrc);
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ TEST(RtpRtcpDemuxerHelperTest, ParseRtcpPacketSenderSsrc_SenderReportPacket) {
|
||||
rtcp_packet.SetSenderSsrc(kSsrc);
|
||||
rtc::Buffer raw_packet = rtcp_packet.Build();
|
||||
|
||||
rtc::Optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(raw_packet);
|
||||
absl::optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(raw_packet);
|
||||
EXPECT_EQ(ssrc, kSsrc);
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ TEST(RtpRtcpDemuxerHelperTest, ParseRtcpPacketSenderSsrc_MalformedRtcpPacket) {
|
||||
uint8_t garbage[100];
|
||||
memset(&garbage[0], 0, arraysize(garbage));
|
||||
|
||||
rtc::Optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(garbage);
|
||||
absl::optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(garbage);
|
||||
EXPECT_FALSE(ssrc);
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ TEST(RtpRtcpDemuxerHelperTest,
|
||||
webrtc::rtcp::ExtendedJitterReport rtcp_packet; // Has no sender SSRC.
|
||||
rtc::Buffer raw_packet = rtcp_packet.Build();
|
||||
|
||||
rtc::Optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(raw_packet);
|
||||
absl::optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(raw_packet);
|
||||
EXPECT_FALSE(ssrc);
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ TEST(RtpRtcpDemuxerHelperTest, ParseRtcpPacketSenderSsrc_TruncatedRtcpMessage) {
|
||||
constexpr size_t rtcp_length_bytes = 8;
|
||||
ASSERT_EQ(rtcp_length_bytes, raw_packet.size());
|
||||
|
||||
rtc::Optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(
|
||||
absl::optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(
|
||||
rtc::ArrayView<const uint8_t>(raw_packet.data(), rtcp_length_bytes - 1));
|
||||
EXPECT_FALSE(ssrc);
|
||||
}
|
||||
|
||||
@ -237,7 +237,7 @@ void RtpTransportControllerSend::OnSentPacket(
|
||||
|
||||
void RtpTransportControllerSend::SetSdpBitrateParameters(
|
||||
const BitrateConstraints& constraints) {
|
||||
rtc::Optional<BitrateConstraints> updated =
|
||||
absl::optional<BitrateConstraints> updated =
|
||||
bitrate_configurator_.UpdateWithSdpParameters(constraints);
|
||||
if (updated.has_value()) {
|
||||
send_side_cc_->SetBweBitrates(updated->min_bitrate_bps,
|
||||
@ -252,7 +252,7 @@ void RtpTransportControllerSend::SetSdpBitrateParameters(
|
||||
|
||||
void RtpTransportControllerSend::SetClientBitratePreferences(
|
||||
const BitrateSettings& preferences) {
|
||||
rtc::Optional<BitrateConstraints> updated =
|
||||
absl::optional<BitrateConstraints> updated =
|
||||
bitrate_configurator_.UpdateWithClientPreferences(preferences);
|
||||
if (updated.has_value()) {
|
||||
send_side_cc_->SetBweBitrates(updated->min_bitrate_bps,
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/transport/bitrate_settings.h"
|
||||
#include "call/bitrate_constraints.h"
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -34,7 +34,7 @@ class Syncable {
|
||||
virtual ~Syncable();
|
||||
|
||||
virtual int id() const = 0;
|
||||
virtual rtc::Optional<Info> GetInfo() const = 0;
|
||||
virtual absl::optional<Info> GetInfo() const = 0;
|
||||
virtual uint32_t GetPlayoutTimestamp() const = 0;
|
||||
virtual void SetMinimumPlayoutDelay(int delay_ms) = 0;
|
||||
};
|
||||
|
||||
@ -82,7 +82,7 @@ class VideoReceiveStream {
|
||||
int render_delay_ms = 10;
|
||||
int64_t interframe_delay_max_ms = -1;
|
||||
uint32_t frames_decoded = 0;
|
||||
rtc::Optional<uint64_t> qp_sum;
|
||||
absl::optional<uint64_t> qp_sum;
|
||||
|
||||
int current_payload_type = -1;
|
||||
|
||||
@ -104,7 +104,7 @@ class VideoReceiveStream {
|
||||
|
||||
// Timing frame info: all important timestamps for a full lifetime of a
|
||||
// single 'timing frame'.
|
||||
rtc::Optional<webrtc::TimingFrameInfo> timing_frame_info;
|
||||
absl::optional<webrtc::TimingFrameInfo> timing_frame_info;
|
||||
};
|
||||
|
||||
struct Config {
|
||||
|
||||
@ -68,7 +68,7 @@ class VideoSendStream {
|
||||
uint32_t frames_dropped_by_encoder_queue = 0;
|
||||
uint32_t frames_dropped_by_rate_limiter = 0;
|
||||
uint32_t frames_dropped_by_encoder = 0;
|
||||
rtc::Optional<uint64_t> qp_sum;
|
||||
absl::optional<uint64_t> qp_sum;
|
||||
// Bitrate the encoder is currently configured to use due to bandwidth
|
||||
// limitations.
|
||||
int target_media_bitrate_bps = 0;
|
||||
|
||||
@ -62,7 +62,6 @@ rtc_static_library("video") {
|
||||
"../:typedefs",
|
||||
"../api:fec_controller_api",
|
||||
"../api:libjingle_peerconnection_api",
|
||||
"../api:optional",
|
||||
"../api:transport_api",
|
||||
"../api/video:video_frame",
|
||||
"../api/video:video_frame_i420",
|
||||
@ -84,6 +83,7 @@ rtc_static_library("video") {
|
||||
"../rtc_base/system:fallthrough",
|
||||
"../system_wrappers:field_trial_api",
|
||||
"../system_wrappers:metrics_api",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
|
||||
# For RtxReceiveStream.
|
||||
"../call:rtp_receiver",
|
||||
@ -121,7 +121,6 @@ rtc_source_set("video_stream_decoder_impl") {
|
||||
]
|
||||
|
||||
deps = [
|
||||
"../api:optional",
|
||||
"../api/video:encoded_frame",
|
||||
"../api/video:video_frame",
|
||||
"../api/video:video_stream_decoder",
|
||||
@ -130,6 +129,7 @@ rtc_source_set("video_stream_decoder_impl") {
|
||||
"../rtc_base:rtc_base_approved",
|
||||
"../rtc_base:rtc_task_queue_api",
|
||||
"../system_wrappers:system_wrappers",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
|
||||
@ -364,7 +364,6 @@ if (rtc_include_tests) {
|
||||
deps = [
|
||||
":video",
|
||||
":video_mocks",
|
||||
"../api:optional",
|
||||
"../api/video:video_frame",
|
||||
"../api/video:video_frame_i420",
|
||||
"../api/video_codecs:video_codecs_api",
|
||||
@ -417,6 +416,7 @@ if (rtc_include_tests) {
|
||||
"../test:test_support",
|
||||
"../test:video_test_common",
|
||||
"//testing/gtest",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
if (!build_with_chromium && is_clang) {
|
||||
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
|
||||
|
||||
@ -134,7 +134,7 @@ TEST_P(CallOperationEndToEndTest, RendersSingleDelayedFrame) {
|
||||
// to check that the callbacks are done after processing video.
|
||||
std::unique_ptr<test::FrameGenerator> frame_generator(
|
||||
test::FrameGenerator::CreateSquareGenerator(
|
||||
kWidth, kHeight, rtc::nullopt, rtc::nullopt));
|
||||
kWidth, kHeight, absl::nullopt, absl::nullopt));
|
||||
video_send_stream_->SetSource(&frame_forwarder,
|
||||
DegradationPreference::MAINTAIN_FRAMERATE);
|
||||
|
||||
@ -190,7 +190,7 @@ TEST_P(CallOperationEndToEndTest, TransmitsFirstFrame) {
|
||||
Start();
|
||||
|
||||
frame_generator = test::FrameGenerator::CreateSquareGenerator(
|
||||
kDefaultWidth, kDefaultHeight, rtc::nullopt, rtc::nullopt);
|
||||
kDefaultWidth, kDefaultHeight, absl::nullopt, absl::nullopt);
|
||||
video_send_stream_->SetSource(&frame_forwarder,
|
||||
DegradationPreference::MAINTAIN_FRAMERATE);
|
||||
frame_forwarder.IncomingCapturedFrame(*frame_generator->NextFrame());
|
||||
@ -268,7 +268,7 @@ TEST_P(CallOperationEndToEndTest, ObserversEncodedFrames) {
|
||||
Start();
|
||||
|
||||
frame_generator = test::FrameGenerator::CreateSquareGenerator(
|
||||
kDefaultWidth, kDefaultHeight, rtc::nullopt, rtc::nullopt);
|
||||
kDefaultWidth, kDefaultHeight, absl::nullopt, absl::nullopt);
|
||||
video_send_stream_->SetSource(&forwarder,
|
||||
DegradationPreference::MAINTAIN_FRAMERATE);
|
||||
forwarder.IncomingCapturedFrame(*frame_generator->NextFrame());
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "modules/video_coding/codecs/vp8/include/vp8.h"
|
||||
#include "system_wrappers/include/metrics.h"
|
||||
#include "system_wrappers/include/metrics_default.h"
|
||||
@ -123,7 +123,7 @@ void HistogramTest::VerifyHistogramStats(bool use_rtx,
|
||||
const bool use_fec_;
|
||||
const bool screenshare_;
|
||||
test::FunctionVideoEncoderFactory encoder_factory_;
|
||||
rtc::Optional<int64_t> start_runtime_ms_;
|
||||
absl::optional<int64_t> start_runtime_ms_;
|
||||
int num_frames_received_ RTC_GUARDED_BY(&crit_);
|
||||
} test(use_rtx, use_fec, screenshare);
|
||||
|
||||
|
||||
@ -132,8 +132,8 @@ class FrameObserver : public test::RtpRtcpObserver,
|
||||
}
|
||||
|
||||
rtc::CriticalSection crit_;
|
||||
rtc::Optional<uint32_t> last_timestamp_;
|
||||
rtc::Optional<uint8_t> last_payload_type_;
|
||||
absl::optional<uint32_t> last_timestamp_;
|
||||
absl::optional<uint8_t> last_payload_type_;
|
||||
int num_sent_frames_ RTC_GUARDED_BY(crit_) = 0;
|
||||
int num_rendered_frames_ RTC_GUARDED_BY(crit_) = 0;
|
||||
std::vector<uint32_t> sent_timestamps_ RTC_GUARDED_BY(crit_);
|
||||
|
||||
@ -99,7 +99,7 @@ void MultiStreamTester::RunTest() {
|
||||
receive_streams[i]->Start();
|
||||
|
||||
frame_generators[i] = test::FrameGeneratorCapturer::Create(
|
||||
width, height, rtc::nullopt, rtc::nullopt, 30,
|
||||
width, height, absl::nullopt, absl::nullopt, 30,
|
||||
Clock::GetRealTimeClock());
|
||||
send_streams[i]->SetSource(frame_generators[i],
|
||||
DegradationPreference::MAINTAIN_FRAMERATE);
|
||||
|
||||
@ -190,7 +190,7 @@ TEST_P(RetransmissionEndToEndTest, ReceivesNackAndRetransmitsAudio) {
|
||||
uint32_t local_ssrc_;
|
||||
uint32_t remote_ssrc_;
|
||||
Transport* receive_transport_;
|
||||
rtc::Optional<uint16_t> sequence_number_to_retransmit_;
|
||||
absl::optional<uint16_t> sequence_number_to_retransmit_;
|
||||
} test;
|
||||
|
||||
RunBaseTest(&test);
|
||||
|
||||
@ -453,9 +453,9 @@ TEST_F(RtpRtcpEndToEndTest, TestFlexfecRtpStatePreservation) {
|
||||
return SEND_PACKET;
|
||||
}
|
||||
|
||||
rtc::Optional<uint16_t> last_observed_sequence_number_
|
||||
absl::optional<uint16_t> last_observed_sequence_number_
|
||||
RTC_GUARDED_BY(crit_);
|
||||
rtc::Optional<uint32_t> last_observed_timestamp_ RTC_GUARDED_BY(crit_);
|
||||
absl::optional<uint32_t> last_observed_timestamp_ RTC_GUARDED_BY(crit_);
|
||||
size_t num_flexfec_packets_sent_ RTC_GUARDED_BY(crit_);
|
||||
rtc::CriticalSection crit_;
|
||||
} observer;
|
||||
|
||||
@ -110,12 +110,12 @@ class SendProcessingUsage1 : public OveruseFrameDetector::ProcessingUsage {
|
||||
time_when_first_seen_us));
|
||||
}
|
||||
|
||||
rtc::Optional<int> FrameSent(
|
||||
absl::optional<int> FrameSent(
|
||||
uint32_t timestamp,
|
||||
int64_t time_sent_in_us,
|
||||
int64_t /* capture_time_us */,
|
||||
rtc::Optional<int> /* encode_duration_us */) override {
|
||||
rtc::Optional<int> encode_duration_us;
|
||||
absl::optional<int> /* encode_duration_us */) override {
|
||||
absl::optional<int> encode_duration_us;
|
||||
// Delay before reporting actual encoding time, used to have the ability to
|
||||
// detect total encoding time when encoding more than one layer. Encoding is
|
||||
// here assumed to finish within a second (or that we get enough long-time
|
||||
@ -241,10 +241,11 @@ class SendProcessingUsage2 : public OveruseFrameDetector::ProcessingUsage {
|
||||
int64_t time_when_first_seen_us,
|
||||
int64_t last_capture_time_us) override {}
|
||||
|
||||
rtc::Optional<int> FrameSent(uint32_t timestamp,
|
||||
int64_t time_sent_in_us,
|
||||
int64_t capture_time_us,
|
||||
rtc::Optional<int> encode_duration_us) override {
|
||||
absl::optional<int> FrameSent(
|
||||
uint32_t timestamp,
|
||||
int64_t time_sent_in_us,
|
||||
int64_t capture_time_us,
|
||||
absl::optional<int> encode_duration_us) override {
|
||||
if (encode_duration_us) {
|
||||
if (prev_time_us_ != -1) {
|
||||
AddSample(1e-6 * (*encode_duration_us),
|
||||
@ -321,13 +322,13 @@ class OverdoseInjector : public OveruseFrameDetector::ProcessingUsage {
|
||||
usage_->FrameCaptured(frame, time_when_first_seen_us, last_capture_time_us);
|
||||
}
|
||||
|
||||
rtc::Optional<int> FrameSent(
|
||||
absl::optional<int> FrameSent(
|
||||
// These two argument used by old estimator.
|
||||
uint32_t timestamp,
|
||||
int64_t time_sent_in_us,
|
||||
// And these two by the new estimator.
|
||||
int64_t capture_time_us,
|
||||
rtc::Optional<int> encode_duration_us) override {
|
||||
absl::optional<int> encode_duration_us) override {
|
||||
return usage_->FrameSent(timestamp, time_sent_in_us, capture_time_us,
|
||||
encode_duration_us);
|
||||
}
|
||||
@ -362,7 +363,7 @@ class OverdoseInjector : public OveruseFrameDetector::ProcessingUsage {
|
||||
}
|
||||
}
|
||||
|
||||
rtc::Optional<int> overried_usage_value;
|
||||
absl::optional<int> overried_usage_value;
|
||||
switch (state_) {
|
||||
case State::kNormal:
|
||||
break;
|
||||
@ -514,7 +515,7 @@ OveruseFrameDetector::OveruseFrameDetector(
|
||||
: check_overuse_task_(nullptr),
|
||||
metrics_observer_(metrics_observer),
|
||||
num_process_times_(0),
|
||||
// TODO(nisse): Use rtc::Optional
|
||||
// TODO(nisse): Use absl::optional
|
||||
last_capture_time_us_(-1),
|
||||
num_pixels_(0),
|
||||
max_framerate_(kDefaultFrameRate),
|
||||
@ -582,7 +583,7 @@ void OveruseFrameDetector::ResetAll(int num_pixels) {
|
||||
usage_->Reset();
|
||||
last_capture_time_us_ = -1;
|
||||
num_process_times_ = 0;
|
||||
metrics_ = rtc::nullopt;
|
||||
metrics_ = absl::nullopt;
|
||||
OnTargetFramerateUpdated(max_framerate_);
|
||||
}
|
||||
|
||||
@ -610,7 +611,7 @@ void OveruseFrameDetector::FrameCaptured(const VideoFrame& frame,
|
||||
void OveruseFrameDetector::FrameSent(uint32_t timestamp,
|
||||
int64_t time_sent_in_us,
|
||||
int64_t capture_time_us,
|
||||
rtc::Optional<int> encode_duration_us) {
|
||||
absl::optional<int> encode_duration_us) {
|
||||
RTC_DCHECK_CALLED_SEQUENTIALLY(&task_checker_);
|
||||
encode_duration_us = usage_->FrameSent(timestamp, time_sent_in_us,
|
||||
capture_time_us, encode_duration_us);
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
#include <list>
|
||||
#include <memory>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "modules/video_coding/utility/quality_scaler.h"
|
||||
#include "rtc_base/constructormagic.h"
|
||||
#include "rtc_base/numerics/exp_filter.h"
|
||||
@ -90,7 +90,7 @@ class OveruseFrameDetector {
|
||||
void FrameSent(uint32_t timestamp,
|
||||
int64_t time_sent_in_us,
|
||||
int64_t capture_time_us,
|
||||
rtc::Optional<int> encode_duration_us);
|
||||
absl::optional<int> encode_duration_us);
|
||||
|
||||
// Interface for cpu load estimation. Intended for internal use only.
|
||||
class ProcessingUsage {
|
||||
@ -101,13 +101,13 @@ class OveruseFrameDetector {
|
||||
int64_t time_when_first_seen_us,
|
||||
int64_t last_capture_time_us) = 0;
|
||||
// Returns encode_time in us, if there's a new measurement.
|
||||
virtual rtc::Optional<int> FrameSent(
|
||||
virtual absl::optional<int> FrameSent(
|
||||
// These two argument used by old estimator.
|
||||
uint32_t timestamp,
|
||||
int64_t time_sent_in_us,
|
||||
// And these two by the new estimator.
|
||||
int64_t capture_time_us,
|
||||
rtc::Optional<int> encode_duration_us) = 0;
|
||||
absl::optional<int> encode_duration_us) = 0;
|
||||
|
||||
virtual int Value() = 0;
|
||||
virtual ~ProcessingUsage() = default;
|
||||
@ -141,7 +141,7 @@ class OveruseFrameDetector {
|
||||
|
||||
// Stats metrics.
|
||||
CpuOveruseMetricsObserver* const metrics_observer_;
|
||||
rtc::Optional<CpuOveruseMetrics> metrics_ RTC_GUARDED_BY(task_checker_);
|
||||
absl::optional<CpuOveruseMetrics> metrics_ RTC_GUARDED_BY(task_checker_);
|
||||
|
||||
int64_t num_process_times_ RTC_GUARDED_BY(task_checker_);
|
||||
|
||||
|
||||
@ -127,7 +127,7 @@ class OveruseFrameDetectorTest : public ::testing::Test,
|
||||
clock_.AdvanceTimeMicros(delay_us);
|
||||
overuse_detector_->FrameSent(timestamp, rtc::TimeMicros(),
|
||||
capture_time_us,
|
||||
rtc::Optional<int>(delay_us));
|
||||
absl::optional<int>(delay_us));
|
||||
|
||||
overuse_detector_->CheckForOveruse(observer_);
|
||||
// Avoid turning clock backwards.
|
||||
|
||||
@ -74,13 +74,13 @@ void QualityThreshold::AddMeasurement(int measurement) {
|
||||
}
|
||||
}
|
||||
|
||||
rtc::Optional<bool> QualityThreshold::IsHigh() const {
|
||||
absl::optional<bool> QualityThreshold::IsHigh() const {
|
||||
return is_high_;
|
||||
}
|
||||
|
||||
rtc::Optional<double> QualityThreshold::CalculateVariance() const {
|
||||
absl::optional<double> QualityThreshold::CalculateVariance() const {
|
||||
if (until_full_ > 0) {
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
double variance = 0;
|
||||
@ -91,11 +91,11 @@ rtc::Optional<double> QualityThreshold::CalculateVariance() const {
|
||||
return variance / (max_measurements_ - 1);
|
||||
}
|
||||
|
||||
rtc::Optional<double> QualityThreshold::FractionHigh(
|
||||
absl::optional<double> QualityThreshold::FractionHigh(
|
||||
int min_required_samples) const {
|
||||
RTC_DCHECK_GT(min_required_samples, 0);
|
||||
if (num_certain_states_ < min_required_samples)
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
|
||||
return static_cast<double>(num_high_states_) / num_certain_states_;
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -27,9 +27,9 @@ class QualityThreshold {
|
||||
int max_measurements);
|
||||
|
||||
void AddMeasurement(int measurement);
|
||||
rtc::Optional<bool> IsHigh() const;
|
||||
rtc::Optional<double> CalculateVariance() const;
|
||||
rtc::Optional<double> FractionHigh(int min_required_samples) const;
|
||||
absl::optional<bool> IsHigh() const;
|
||||
absl::optional<double> CalculateVariance() const;
|
||||
absl::optional<double> FractionHigh(int min_required_samples) const;
|
||||
|
||||
private:
|
||||
const std::unique_ptr<int[]> buffer_;
|
||||
@ -39,7 +39,7 @@ class QualityThreshold {
|
||||
const int high_threshold_;
|
||||
int until_full_;
|
||||
int next_index_;
|
||||
rtc::Optional<bool> is_high_;
|
||||
absl::optional<bool> is_high_;
|
||||
int sum_;
|
||||
int count_low_;
|
||||
int count_high_;
|
||||
|
||||
@ -209,7 +209,7 @@ void ReceiveStatisticsProxy::UpdateHistograms() {
|
||||
round(render_pixel_tracker_.ComputeTotalRate()));
|
||||
}
|
||||
|
||||
rtc::Optional<int> sync_offset_ms =
|
||||
absl::optional<int> sync_offset_ms =
|
||||
sync_offset_counter_.Avg(kMinRequiredSamples);
|
||||
if (sync_offset_ms) {
|
||||
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.AVSyncOffsetInMs",
|
||||
@ -236,17 +236,17 @@ void ReceiveStatisticsProxy::UpdateHistograms() {
|
||||
<< key_frames_permille << '\n';
|
||||
}
|
||||
|
||||
rtc::Optional<int> qp = qp_counters_.vp8.Avg(kMinRequiredSamples);
|
||||
absl::optional<int> qp = qp_counters_.vp8.Avg(kMinRequiredSamples);
|
||||
if (qp) {
|
||||
RTC_HISTOGRAM_COUNTS_200("WebRTC.Video.Decoded.Vp8.Qp", *qp);
|
||||
log_stream << "WebRTC.Video.Decoded.Vp8.Qp " << *qp << '\n';
|
||||
}
|
||||
rtc::Optional<int> decode_ms = decode_time_counter_.Avg(kMinRequiredSamples);
|
||||
absl::optional<int> decode_ms = decode_time_counter_.Avg(kMinRequiredSamples);
|
||||
if (decode_ms) {
|
||||
RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.DecodeTimeInMs", *decode_ms);
|
||||
log_stream << "WebRTC.Video.DecodeTimeInMs " << *decode_ms << '\n';
|
||||
}
|
||||
rtc::Optional<int> jb_delay_ms =
|
||||
absl::optional<int> jb_delay_ms =
|
||||
jitter_buffer_delay_counter_.Avg(kMinRequiredSamples);
|
||||
if (jb_delay_ms) {
|
||||
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.JitterBufferDelayInMs",
|
||||
@ -254,21 +254,21 @@ void ReceiveStatisticsProxy::UpdateHistograms() {
|
||||
log_stream << "WebRTC.Video.JitterBufferDelayInMs " << *jb_delay_ms << '\n';
|
||||
}
|
||||
|
||||
rtc::Optional<int> target_delay_ms =
|
||||
absl::optional<int> target_delay_ms =
|
||||
target_delay_counter_.Avg(kMinRequiredSamples);
|
||||
if (target_delay_ms) {
|
||||
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.TargetDelayInMs",
|
||||
*target_delay_ms);
|
||||
log_stream << "WebRTC.Video.TargetDelayInMs " << *target_delay_ms << '\n';
|
||||
}
|
||||
rtc::Optional<int> current_delay_ms =
|
||||
absl::optional<int> current_delay_ms =
|
||||
current_delay_counter_.Avg(kMinRequiredSamples);
|
||||
if (current_delay_ms) {
|
||||
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.CurrentDelayInMs",
|
||||
*current_delay_ms);
|
||||
log_stream << "WebRTC.Video.CurrentDelayInMs " << *current_delay_ms << '\n';
|
||||
}
|
||||
rtc::Optional<int> delay_ms = delay_counter_.Avg(kMinRequiredSamples);
|
||||
absl::optional<int> delay_ms = delay_counter_.Avg(kMinRequiredSamples);
|
||||
if (delay_ms)
|
||||
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.OnewayDelayInMs", *delay_ms);
|
||||
|
||||
@ -314,7 +314,7 @@ void ReceiveStatisticsProxy::UpdateHistograms() {
|
||||
RTC_DCHECK(videocontenttypehelpers::GetExperimentId(content_type) == 0 ||
|
||||
videocontenttypehelpers::GetSimulcastId(content_type) == 0);
|
||||
|
||||
rtc::Optional<int> e2e_delay_ms =
|
||||
absl::optional<int> e2e_delay_ms =
|
||||
stats.e2e_delay_counter.Avg(kMinRequiredSamples);
|
||||
if (e2e_delay_ms) {
|
||||
RTC_HISTOGRAM_COUNTS_SPARSE_10000(
|
||||
@ -322,14 +322,14 @@ void ReceiveStatisticsProxy::UpdateHistograms() {
|
||||
log_stream << uma_prefix << ".EndToEndDelayInMs" << uma_suffix << " "
|
||||
<< *e2e_delay_ms << '\n';
|
||||
}
|
||||
rtc::Optional<int> e2e_delay_max_ms = stats.e2e_delay_counter.Max();
|
||||
absl::optional<int> e2e_delay_max_ms = stats.e2e_delay_counter.Max();
|
||||
if (e2e_delay_max_ms && e2e_delay_ms) {
|
||||
RTC_HISTOGRAM_COUNTS_SPARSE_100000(
|
||||
uma_prefix + ".EndToEndDelayMaxInMs" + uma_suffix, *e2e_delay_max_ms);
|
||||
log_stream << uma_prefix << ".EndToEndDelayMaxInMs" << uma_suffix << " "
|
||||
<< *e2e_delay_max_ms << '\n';
|
||||
}
|
||||
rtc::Optional<int> interframe_delay_ms =
|
||||
absl::optional<int> interframe_delay_ms =
|
||||
stats.interframe_delay_counter.Avg(kMinRequiredSamples);
|
||||
if (interframe_delay_ms) {
|
||||
RTC_HISTOGRAM_COUNTS_SPARSE_10000(
|
||||
@ -338,7 +338,7 @@ void ReceiveStatisticsProxy::UpdateHistograms() {
|
||||
log_stream << uma_prefix << ".InterframeDelayInMs" << uma_suffix << " "
|
||||
<< *interframe_delay_ms << '\n';
|
||||
}
|
||||
rtc::Optional<int> interframe_delay_max_ms =
|
||||
absl::optional<int> interframe_delay_max_ms =
|
||||
stats.interframe_delay_counter.Max();
|
||||
if (interframe_delay_max_ms && interframe_delay_ms) {
|
||||
RTC_HISTOGRAM_COUNTS_SPARSE_10000(
|
||||
@ -348,7 +348,7 @@ void ReceiveStatisticsProxy::UpdateHistograms() {
|
||||
<< *interframe_delay_max_ms << '\n';
|
||||
}
|
||||
|
||||
rtc::Optional<uint32_t> interframe_delay_95p_ms =
|
||||
absl::optional<uint32_t> interframe_delay_95p_ms =
|
||||
stats.interframe_delay_percentiles.GetPercentile(0.95f);
|
||||
if (interframe_delay_95p_ms && interframe_delay_ms != -1) {
|
||||
RTC_HISTOGRAM_COUNTS_SPARSE_10000(
|
||||
@ -358,7 +358,7 @@ void ReceiveStatisticsProxy::UpdateHistograms() {
|
||||
<< uma_suffix << " " << *interframe_delay_95p_ms << '\n';
|
||||
}
|
||||
|
||||
rtc::Optional<int> width = stats.received_width.Avg(kMinRequiredSamples);
|
||||
absl::optional<int> width = stats.received_width.Avg(kMinRequiredSamples);
|
||||
if (width) {
|
||||
RTC_HISTOGRAM_COUNTS_SPARSE_10000(
|
||||
uma_prefix + ".ReceivedWidthInPixels" + uma_suffix, *width);
|
||||
@ -366,7 +366,7 @@ void ReceiveStatisticsProxy::UpdateHistograms() {
|
||||
<< *width << '\n';
|
||||
}
|
||||
|
||||
rtc::Optional<int> height = stats.received_height.Avg(kMinRequiredSamples);
|
||||
absl::optional<int> height = stats.received_height.Avg(kMinRequiredSamples);
|
||||
if (height) {
|
||||
RTC_HISTOGRAM_COUNTS_SPARSE_10000(
|
||||
uma_prefix + ".ReceivedHeightInPixels" + uma_suffix, *height);
|
||||
@ -401,7 +401,7 @@ void ReceiveStatisticsProxy::UpdateHistograms() {
|
||||
<< " " << key_frames_permille << '\n';
|
||||
}
|
||||
|
||||
rtc::Optional<int> qp = stats.qp_counter.Avg(kMinRequiredSamples);
|
||||
absl::optional<int> qp = stats.qp_counter.Avg(kMinRequiredSamples);
|
||||
if (qp) {
|
||||
RTC_HISTOGRAM_COUNTS_SPARSE_200(
|
||||
uma_prefix + ".Decoded.Vp8.Qp" + uma_suffix, *qp);
|
||||
@ -465,19 +465,19 @@ void ReceiveStatisticsProxy::UpdateHistograms() {
|
||||
RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.BadCall.Any",
|
||||
100 * num_bad_states_ / num_certain_states_);
|
||||
}
|
||||
rtc::Optional<double> fps_fraction =
|
||||
absl::optional<double> fps_fraction =
|
||||
fps_threshold_.FractionHigh(kBadCallMinRequiredSamples);
|
||||
if (fps_fraction) {
|
||||
RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.BadCall.FrameRate",
|
||||
static_cast<int>(100 * (1 - *fps_fraction)));
|
||||
}
|
||||
rtc::Optional<double> variance_fraction =
|
||||
absl::optional<double> variance_fraction =
|
||||
variance_threshold_.FractionHigh(kBadCallMinRequiredSamples);
|
||||
if (variance_fraction) {
|
||||
RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.BadCall.FrameRateVariance",
|
||||
static_cast<int>(100 * *variance_fraction));
|
||||
}
|
||||
rtc::Optional<double> qp_fraction =
|
||||
absl::optional<double> qp_fraction =
|
||||
qp_threshold_.FractionHigh(kBadCallMinRequiredSamples);
|
||||
if (qp_fraction) {
|
||||
RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.BadCall.Qp",
|
||||
@ -496,7 +496,7 @@ void ReceiveStatisticsProxy::QualitySample() {
|
||||
|
||||
double fps =
|
||||
render_fps_tracker_.ComputeRateForInterval(now - last_sample_time_);
|
||||
rtc::Optional<int> qp = qp_sample_.Avg(1);
|
||||
absl::optional<int> qp = qp_sample_.Avg(1);
|
||||
|
||||
bool prev_fps_bad = !fps_threshold_.IsHigh().value_or(true);
|
||||
bool prev_qp_bad = qp_threshold_.IsHigh().value_or(false);
|
||||
@ -506,7 +506,7 @@ void ReceiveStatisticsProxy::QualitySample() {
|
||||
fps_threshold_.AddMeasurement(static_cast<int>(fps));
|
||||
if (qp)
|
||||
qp_threshold_.AddMeasurement(*qp);
|
||||
rtc::Optional<double> fps_variance_opt = fps_threshold_.CalculateVariance();
|
||||
absl::optional<double> fps_variance_opt = fps_threshold_.CalculateVariance();
|
||||
double fps_variance = fps_variance_opt.value_or(0);
|
||||
if (fps_variance_opt) {
|
||||
variance_threshold_.AddMeasurement(static_cast<int>(fps_variance));
|
||||
@ -699,7 +699,7 @@ void ReceiveStatisticsProxy::DataCountersUpdated(
|
||||
total_byte_tracker_.AddSamples(total_bytes - last_total_bytes);
|
||||
}
|
||||
|
||||
void ReceiveStatisticsProxy::OnDecodedFrame(rtc::Optional<uint8_t> qp,
|
||||
void ReceiveStatisticsProxy::OnDecodedFrame(absl::optional<uint8_t> qp,
|
||||
int width,
|
||||
int height,
|
||||
VideoContentType content_type) {
|
||||
@ -734,7 +734,7 @@ void ReceiveStatisticsProxy::OnDecodedFrame(rtc::Optional<uint8_t> qp,
|
||||
} else if (stats_.qp_sum) {
|
||||
RTC_LOG(LS_WARNING)
|
||||
<< "QP sum was already set and no QP was given for a frame.";
|
||||
stats_.qp_sum = rtc::nullopt;
|
||||
stats_.qp_sum = absl::nullopt;
|
||||
}
|
||||
last_content_type_ = content_type;
|
||||
decode_fps_estimator_.Update(1, now);
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "call/video_receive_stream.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "common_video/include/frame_callback.h"
|
||||
@ -52,7 +52,7 @@ class ReceiveStatisticsProxy : public VCMReceiveStatisticsCallback,
|
||||
|
||||
VideoReceiveStream::Stats GetStats() const;
|
||||
|
||||
void OnDecodedFrame(rtc::Optional<uint8_t> qp,
|
||||
void OnDecodedFrame(absl::optional<uint8_t> qp,
|
||||
int width,
|
||||
int height,
|
||||
VideoContentType content_type);
|
||||
@ -183,15 +183,15 @@ class ReceiveStatisticsProxy : public VCMReceiveStatisticsCallback,
|
||||
mutable std::map<int64_t, size_t> frame_window_ RTC_GUARDED_BY(&crit_);
|
||||
VideoContentType last_content_type_ RTC_GUARDED_BY(&crit_);
|
||||
VideoCodecType last_codec_type_ RTC_GUARDED_BY(&crit_);
|
||||
rtc::Optional<int64_t> first_decoded_frame_time_ms_ RTC_GUARDED_BY(&crit_);
|
||||
rtc::Optional<int64_t> last_decoded_frame_time_ms_ RTC_GUARDED_BY(&crit_);
|
||||
absl::optional<int64_t> first_decoded_frame_time_ms_ RTC_GUARDED_BY(&crit_);
|
||||
absl::optional<int64_t> last_decoded_frame_time_ms_ RTC_GUARDED_BY(&crit_);
|
||||
size_t num_delayed_frames_rendered_ RTC_GUARDED_BY(&crit_);
|
||||
int64_t sum_missed_render_deadline_ms_ RTC_GUARDED_BY(&crit_);
|
||||
// Mutable because calling Max() on MovingMaxCounter is not const. Yet it is
|
||||
// called from const GetStats().
|
||||
mutable rtc::MovingMaxCounter<TimingFrameInfo> timing_frame_info_counter_
|
||||
RTC_GUARDED_BY(&crit_);
|
||||
rtc::Optional<int> num_unique_frames_ RTC_GUARDED_BY(crit_);
|
||||
absl::optional<int> num_unique_frames_ RTC_GUARDED_BY(crit_);
|
||||
rtc::ThreadChecker decode_thread_;
|
||||
rtc::ThreadChecker network_thread_;
|
||||
rtc::ThreadChecker main_thread_;
|
||||
|
||||
@ -82,7 +82,7 @@ class ReceiveStatisticsProxyTest
|
||||
TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameIncreasesFramesDecoded) {
|
||||
EXPECT_EQ(0u, statistics_proxy_->GetStats().frames_decoded);
|
||||
for (uint32_t i = 1; i <= 3; ++i) {
|
||||
statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
|
||||
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
|
||||
VideoContentType::UNSPECIFIED);
|
||||
EXPECT_EQ(i, statistics_proxy_->GetStats().frames_decoded);
|
||||
}
|
||||
@ -92,8 +92,8 @@ TEST_F(ReceiveStatisticsProxyTest, DecodedFpsIsReported) {
|
||||
const int kFps = 20;
|
||||
const int kRequiredSamples = metrics::kMinRunTimeInSeconds * kFps;
|
||||
for (int i = 0; i < kRequiredSamples; ++i) {
|
||||
statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), kWidth, kHeight,
|
||||
VideoContentType::UNSPECIFIED);
|
||||
statistics_proxy_->OnDecodedFrame(absl::optional<uint8_t>(), kWidth,
|
||||
kHeight, VideoContentType::UNSPECIFIED);
|
||||
fake_clock_.AdvanceTimeMilliseconds(1000 / kFps);
|
||||
}
|
||||
statistics_proxy_.reset();
|
||||
@ -105,8 +105,8 @@ TEST_F(ReceiveStatisticsProxyTest, DecodedFpsIsNotReportedForTooFewSamples) {
|
||||
const int kFps = 20;
|
||||
const int kRequiredSamples = metrics::kMinRunTimeInSeconds * kFps;
|
||||
for (int i = 0; i < kRequiredSamples - 1; ++i) {
|
||||
statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), kWidth, kHeight,
|
||||
VideoContentType::UNSPECIFIED);
|
||||
statistics_proxy_->OnDecodedFrame(absl::optional<uint8_t>(), kWidth,
|
||||
kHeight, VideoContentType::UNSPECIFIED);
|
||||
fake_clock_.AdvanceTimeMilliseconds(1000 / kFps);
|
||||
}
|
||||
statistics_proxy_.reset();
|
||||
@ -116,14 +116,14 @@ TEST_F(ReceiveStatisticsProxyTest, DecodedFpsIsNotReportedForTooFewSamples) {
|
||||
TEST_F(ReceiveStatisticsProxyTest, DecodedFpsIsReportedWithQpReset) {
|
||||
const int kFps1 = 10;
|
||||
for (int i = 0; i < metrics::kMinRunTimeInSeconds * kFps1; ++i) {
|
||||
statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), kWidth, kHeight,
|
||||
VideoContentType::UNSPECIFIED);
|
||||
statistics_proxy_->OnDecodedFrame(absl::optional<uint8_t>(), kWidth,
|
||||
kHeight, VideoContentType::UNSPECIFIED);
|
||||
fake_clock_.AdvanceTimeMilliseconds(1000 / kFps1);
|
||||
}
|
||||
// First QP value received, resets frames decoded.
|
||||
const int kFps2 = 20;
|
||||
for (int i = 0; i < metrics::kMinRunTimeInSeconds * kFps2; ++i) {
|
||||
statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(1u), kWidth,
|
||||
statistics_proxy_->OnDecodedFrame(absl::optional<uint8_t>(1u), kWidth,
|
||||
kHeight, VideoContentType::UNSPECIFIED);
|
||||
fake_clock_.AdvanceTimeMilliseconds(1000 / kFps2);
|
||||
}
|
||||
@ -136,7 +136,7 @@ TEST_F(ReceiveStatisticsProxyTest, DecodedFpsIsReportedWithQpReset) {
|
||||
TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameWithQpResetsFramesDecoded) {
|
||||
EXPECT_EQ(0u, statistics_proxy_->GetStats().frames_decoded);
|
||||
for (uint32_t i = 1; i <= 3; ++i) {
|
||||
statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
|
||||
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
|
||||
VideoContentType::UNSPECIFIED);
|
||||
EXPECT_EQ(i, statistics_proxy_->GetStats().frames_decoded);
|
||||
}
|
||||
@ -146,7 +146,7 @@ TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameWithQpResetsFramesDecoded) {
|
||||
}
|
||||
|
||||
TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameIncreasesQpSum) {
|
||||
EXPECT_EQ(rtc::nullopt, statistics_proxy_->GetStats().qp_sum);
|
||||
EXPECT_EQ(absl::nullopt, statistics_proxy_->GetStats().qp_sum);
|
||||
statistics_proxy_->OnDecodedFrame(3u, kWidth, kHeight,
|
||||
VideoContentType::UNSPECIFIED);
|
||||
EXPECT_EQ(3u, statistics_proxy_->GetStats().qp_sum);
|
||||
@ -230,20 +230,20 @@ TEST_F(ReceiveStatisticsProxyTest, ReportInterframeDelayInWindow) {
|
||||
}
|
||||
|
||||
TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameWithoutQpQpSumWontExist) {
|
||||
EXPECT_EQ(rtc::nullopt, statistics_proxy_->GetStats().qp_sum);
|
||||
statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
|
||||
EXPECT_EQ(absl::nullopt, statistics_proxy_->GetStats().qp_sum);
|
||||
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
|
||||
VideoContentType::UNSPECIFIED);
|
||||
EXPECT_EQ(rtc::nullopt, statistics_proxy_->GetStats().qp_sum);
|
||||
EXPECT_EQ(absl::nullopt, statistics_proxy_->GetStats().qp_sum);
|
||||
}
|
||||
|
||||
TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameWithoutQpResetsQpSum) {
|
||||
EXPECT_EQ(rtc::nullopt, statistics_proxy_->GetStats().qp_sum);
|
||||
EXPECT_EQ(absl::nullopt, statistics_proxy_->GetStats().qp_sum);
|
||||
statistics_proxy_->OnDecodedFrame(3u, kWidth, kHeight,
|
||||
VideoContentType::UNSPECIFIED);
|
||||
EXPECT_EQ(3u, statistics_proxy_->GetStats().qp_sum);
|
||||
statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
|
||||
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
|
||||
VideoContentType::UNSPECIFIED);
|
||||
EXPECT_EQ(rtc::nullopt, statistics_proxy_->GetStats().qp_sum);
|
||||
EXPECT_EQ(absl::nullopt, statistics_proxy_->GetStats().qp_sum);
|
||||
}
|
||||
|
||||
TEST_F(ReceiveStatisticsProxyTest, OnRenderedFrameIncreasesFramesRendered) {
|
||||
@ -387,7 +387,7 @@ TEST_F(ReceiveStatisticsProxyTest,
|
||||
const int64_t kLongEndToEndDelay = 100;
|
||||
const uint32_t kExpectedRtpTimestamp = 2;
|
||||
TimingFrameInfo info;
|
||||
rtc::Optional<TimingFrameInfo> result;
|
||||
absl::optional<TimingFrameInfo> result;
|
||||
info.rtp_timestamp = kExpectedRtpTimestamp - 1;
|
||||
info.capture_time_ms = 0;
|
||||
info.decode_finish_ms = kShortEndToEndDelay;
|
||||
@ -412,7 +412,7 @@ TEST_F(ReceiveStatisticsProxyTest, RespectsReportingIntervalForTimingFrames) {
|
||||
const uint32_t kExpectedRtpTimestamp = 2;
|
||||
const int64_t kShortDelayMs = 1000;
|
||||
const int64_t kLongDelayMs = 10000;
|
||||
rtc::Optional<TimingFrameInfo> result;
|
||||
absl::optional<TimingFrameInfo> result;
|
||||
info.rtp_timestamp = kExpectedRtpTimestamp;
|
||||
info.capture_time_ms = 0;
|
||||
info.decode_finish_ms = kShortEndToEndDelay;
|
||||
@ -741,7 +741,7 @@ TEST_F(ReceiveStatisticsProxyTest, DoesNotReportStaleFramerates) {
|
||||
// Since OnRenderedFrame is never called the fps in each sample will be 0,
|
||||
// i.e. bad
|
||||
frame.set_ntp_time_ms(fake_clock_.CurrentNtpInMilliseconds());
|
||||
statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
|
||||
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
|
||||
VideoContentType::UNSPECIFIED);
|
||||
statistics_proxy_->OnRenderedFrame(frame);
|
||||
fake_clock_.AdvanceTimeMilliseconds(1000 / kDefaultFps);
|
||||
@ -796,7 +796,7 @@ TEST_F(ReceiveStatisticsProxyTest, ReceivedFrameHistogramsAreUpdated) {
|
||||
}
|
||||
|
||||
TEST_F(ReceiveStatisticsProxyTest, ZeroDelayReportedIfFrameNotDelayed) {
|
||||
statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
|
||||
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
|
||||
VideoContentType::UNSPECIFIED);
|
||||
|
||||
// Frame not delayed, delayed frames to render: 0%.
|
||||
@ -814,7 +814,7 @@ TEST_F(ReceiveStatisticsProxyTest, ZeroDelayReportedIfFrameNotDelayed) {
|
||||
|
||||
TEST_F(ReceiveStatisticsProxyTest,
|
||||
DelayedFrameHistogramsAreNotUpdatedIfMinRuntimeHasNotPassed) {
|
||||
statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
|
||||
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
|
||||
VideoContentType::UNSPECIFIED);
|
||||
|
||||
// Frame not delayed, delayed frames to render: 0%.
|
||||
@ -832,7 +832,7 @@ TEST_F(ReceiveStatisticsProxyTest,
|
||||
|
||||
TEST_F(ReceiveStatisticsProxyTest,
|
||||
DelayedFramesHistogramsAreNotUpdatedIfNoRenderedFrames) {
|
||||
statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
|
||||
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
|
||||
VideoContentType::UNSPECIFIED);
|
||||
|
||||
// Min run time has passed. No rendered frames.
|
||||
@ -844,7 +844,7 @@ TEST_F(ReceiveStatisticsProxyTest,
|
||||
}
|
||||
|
||||
TEST_F(ReceiveStatisticsProxyTest, DelayReportedIfFrameIsDelayed) {
|
||||
statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
|
||||
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
|
||||
VideoContentType::UNSPECIFIED);
|
||||
|
||||
// Frame delayed 1 ms, delayed frames to render: 100%.
|
||||
@ -863,7 +863,7 @@ TEST_F(ReceiveStatisticsProxyTest, DelayReportedIfFrameIsDelayed) {
|
||||
}
|
||||
|
||||
TEST_F(ReceiveStatisticsProxyTest, AverageDelayOfDelayedFramesIsReported) {
|
||||
statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
|
||||
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
|
||||
VideoContentType::UNSPECIFIED);
|
||||
|
||||
// Two frames delayed (6 ms, 10 ms), delayed frames to render: 50%.
|
||||
@ -937,13 +937,13 @@ TEST_P(ReceiveStatisticsProxyTest, InterFrameDelaysAreReported) {
|
||||
const VideoContentType content_type = GetParam();
|
||||
const int kInterFrameDelayMs = 33;
|
||||
for (int i = 0; i < kMinRequiredSamples; ++i) {
|
||||
statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
|
||||
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
|
||||
content_type);
|
||||
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
|
||||
}
|
||||
// One extra with double the interval.
|
||||
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
|
||||
statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
|
||||
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
|
||||
content_type);
|
||||
|
||||
statistics_proxy_.reset();
|
||||
@ -972,18 +972,18 @@ TEST_P(ReceiveStatisticsProxyTest, InterFrameDelaysPercentilesAreReported) {
|
||||
const int kLastFivePercentsSamples = kMinRequiredSamples * 5 / 100;
|
||||
for (int i = 0; i <= kMinRequiredSamples - kLastFivePercentsSamples; ++i) {
|
||||
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
|
||||
statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
|
||||
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
|
||||
content_type);
|
||||
}
|
||||
// Last 5% of intervals are double in size.
|
||||
for (int i = 0; i < kLastFivePercentsSamples; ++i) {
|
||||
fake_clock_.AdvanceTimeMilliseconds(2 * kInterFrameDelayMs);
|
||||
statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
|
||||
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
|
||||
content_type);
|
||||
}
|
||||
// Final sample is outlier and 10 times as big.
|
||||
fake_clock_.AdvanceTimeMilliseconds(10 * kInterFrameDelayMs);
|
||||
statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
|
||||
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
|
||||
content_type);
|
||||
|
||||
statistics_proxy_.reset();
|
||||
@ -1003,7 +1003,7 @@ TEST_P(ReceiveStatisticsProxyTest, MaxInterFrameDelayOnlyWithValidAverage) {
|
||||
const VideoContentType content_type = GetParam();
|
||||
const int kInterFrameDelayMs = 33;
|
||||
for (int i = 0; i < kMinRequiredSamples; ++i) {
|
||||
statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
|
||||
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
|
||||
content_type);
|
||||
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
|
||||
}
|
||||
@ -1023,7 +1023,7 @@ TEST_P(ReceiveStatisticsProxyTest, MaxInterFrameDelayOnlyWithPause) {
|
||||
const VideoContentType content_type = GetParam();
|
||||
const int kInterFrameDelayMs = 33;
|
||||
for (int i = 0; i <= kMinRequiredSamples; ++i) {
|
||||
statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
|
||||
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
|
||||
content_type);
|
||||
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
|
||||
}
|
||||
@ -1035,10 +1035,10 @@ TEST_P(ReceiveStatisticsProxyTest, MaxInterFrameDelayOnlyWithPause) {
|
||||
|
||||
// Insert two more frames. The interval during the pause should be disregarded
|
||||
// in the stats.
|
||||
statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
|
||||
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
|
||||
content_type);
|
||||
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
|
||||
statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
|
||||
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
|
||||
content_type);
|
||||
|
||||
statistics_proxy_.reset();
|
||||
@ -1068,13 +1068,13 @@ TEST_P(ReceiveStatisticsProxyTest, FreezesAreReported) {
|
||||
const int kInterFrameDelayMs = 33;
|
||||
const int kFreezeDelayMs = 200;
|
||||
for (int i = 0; i < kMinRequiredSamples; ++i) {
|
||||
statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
|
||||
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
|
||||
content_type);
|
||||
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
|
||||
}
|
||||
// Add extra freeze.
|
||||
fake_clock_.AdvanceTimeMilliseconds(kFreezeDelayMs);
|
||||
statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
|
||||
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
|
||||
content_type);
|
||||
|
||||
statistics_proxy_.reset();
|
||||
@ -1100,7 +1100,7 @@ TEST_P(ReceiveStatisticsProxyTest, PausesAreIgnored) {
|
||||
const int kInterFrameDelayMs = 33;
|
||||
const int kPauseDurationMs = 10000;
|
||||
for (int i = 0; i <= kMinRequiredSamples; ++i) {
|
||||
statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
|
||||
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
|
||||
content_type);
|
||||
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
|
||||
}
|
||||
@ -1110,7 +1110,7 @@ TEST_P(ReceiveStatisticsProxyTest, PausesAreIgnored) {
|
||||
|
||||
// Second playback interval with triple the length.
|
||||
for (int i = 0; i <= kMinRequiredSamples * 3; ++i) {
|
||||
statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
|
||||
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
|
||||
content_type);
|
||||
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
|
||||
}
|
||||
@ -1137,15 +1137,15 @@ TEST_P(ReceiveStatisticsProxyTest, ManyPausesAtTheBeginning) {
|
||||
const int kInterFrameDelayMs = 33;
|
||||
const int kPauseDurationMs = 10000;
|
||||
for (int i = 0; i <= kMinRequiredSamples; ++i) {
|
||||
statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
|
||||
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
|
||||
content_type);
|
||||
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
|
||||
|
||||
statistics_proxy_->OnStreamInactive();
|
||||
fake_clock_.AdvanceTimeMilliseconds(kPauseDurationMs);
|
||||
|
||||
statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
|
||||
content_type);
|
||||
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
|
||||
content_type);
|
||||
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
|
||||
}
|
||||
|
||||
@ -1164,18 +1164,18 @@ TEST_P(ReceiveStatisticsProxyTest, TimeInHdReported) {
|
||||
const int kInterFrameDelayMs = 20;
|
||||
// HD frames.
|
||||
for (int i = 0; i < kMinRequiredSamples; ++i) {
|
||||
statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
|
||||
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
|
||||
content_type);
|
||||
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
|
||||
}
|
||||
// SD frames.
|
||||
for (int i = 0; i < 2 * kMinRequiredSamples; ++i) {
|
||||
statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth / 2, kHeight / 2,
|
||||
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth / 2, kHeight / 2,
|
||||
content_type);
|
||||
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
|
||||
}
|
||||
// Extra last frame.
|
||||
statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth / 2, kHeight / 2,
|
||||
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth / 2, kHeight / 2,
|
||||
content_type);
|
||||
statistics_proxy_.reset();
|
||||
const int kExpectedTimeInHdPercents = 33;
|
||||
@ -1268,14 +1268,14 @@ TEST_P(ReceiveStatisticsProxyTest, StatsAreSlicedOnSimulcastAndExperiment) {
|
||||
videocontenttypehelpers::SetSimulcastId(&content_type, 1);
|
||||
for (int i = 0; i <= kMinRequiredSamples; ++i) {
|
||||
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs1);
|
||||
statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
|
||||
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
|
||||
content_type);
|
||||
}
|
||||
|
||||
videocontenttypehelpers::SetSimulcastId(&content_type, 2);
|
||||
for (int i = 0; i <= kMinRequiredSamples; ++i) {
|
||||
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs2);
|
||||
statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
|
||||
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
|
||||
content_type);
|
||||
}
|
||||
statistics_proxy_.reset();
|
||||
|
||||
@ -76,13 +76,13 @@ void RtpStreamsSynchronizer::Process() {
|
||||
}
|
||||
RTC_DCHECK(sync_.get());
|
||||
|
||||
rtc::Optional<Syncable::Info> audio_info = syncable_audio_->GetInfo();
|
||||
absl::optional<Syncable::Info> audio_info = syncable_audio_->GetInfo();
|
||||
if (!audio_info || !UpdateMeasurements(&audio_measurement_, *audio_info)) {
|
||||
return;
|
||||
}
|
||||
|
||||
int64_t last_video_receive_ms = video_measurement_.latest_receive_time_ms;
|
||||
rtc::Optional<Syncable::Info> video_info = syncable_video_->GetInfo();
|
||||
absl::optional<Syncable::Info> video_info = syncable_video_->GetInfo();
|
||||
if (!video_info || !UpdateMeasurements(&video_measurement_, *video_info)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -354,11 +354,11 @@ void RtpVideoStreamReceiver::UpdateRtt(int64_t max_rtt_ms) {
|
||||
nack_module_->UpdateRtt(max_rtt_ms);
|
||||
}
|
||||
|
||||
rtc::Optional<int64_t> RtpVideoStreamReceiver::LastReceivedPacketMs() const {
|
||||
absl::optional<int64_t> RtpVideoStreamReceiver::LastReceivedPacketMs() const {
|
||||
return packet_buffer_->LastReceivedPacketMs();
|
||||
}
|
||||
|
||||
rtc::Optional<int64_t> RtpVideoStreamReceiver::LastReceivedKeyframePacketMs()
|
||||
absl::optional<int64_t> RtpVideoStreamReceiver::LastReceivedKeyframePacketMs()
|
||||
const {
|
||||
return packet_buffer_->LastReceivedKeyframePacketMs();
|
||||
}
|
||||
|
||||
@ -129,8 +129,8 @@ class RtpVideoStreamReceiver : public RtpData,
|
||||
// Called by VideoReceiveStream when stats are updated.
|
||||
void UpdateRtt(int64_t max_rtt_ms);
|
||||
|
||||
rtc::Optional<int64_t> LastReceivedPacketMs() const;
|
||||
rtc::Optional<int64_t> LastReceivedKeyframePacketMs() const;
|
||||
absl::optional<int64_t> LastReceivedPacketMs() const;
|
||||
absl::optional<int64_t> LastReceivedKeyframePacketMs() const;
|
||||
|
||||
// RtpDemuxer only forwards a given RTP packet to one sink. However, some
|
||||
// sinks, such as FlexFEC, might wish to be informed of all of the packets
|
||||
|
||||
@ -85,36 +85,36 @@ bool IsForcedFallbackPossible(const CodecSpecificInfo* codec_info) {
|
||||
codec_info->codecSpecific.VP8.temporalIdx == kNoTemporalIdx);
|
||||
}
|
||||
|
||||
rtc::Optional<int> GetFallbackMaxPixels(const std::string& group) {
|
||||
absl::optional<int> GetFallbackMaxPixels(const std::string& group) {
|
||||
if (group.empty())
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
|
||||
int min_pixels;
|
||||
int max_pixels;
|
||||
int min_bps;
|
||||
if (sscanf(group.c_str(), "-%d,%d,%d", &min_pixels, &max_pixels, &min_bps) !=
|
||||
3) {
|
||||
return rtc::Optional<int>();
|
||||
return absl::optional<int>();
|
||||
}
|
||||
|
||||
if (min_pixels <= 0 || max_pixels <= 0 || max_pixels < min_pixels)
|
||||
return rtc::Optional<int>();
|
||||
return absl::optional<int>();
|
||||
|
||||
return rtc::Optional<int>(max_pixels);
|
||||
return absl::optional<int>(max_pixels);
|
||||
}
|
||||
|
||||
rtc::Optional<int> GetFallbackMaxPixelsIfFieldTrialEnabled() {
|
||||
absl::optional<int> GetFallbackMaxPixelsIfFieldTrialEnabled() {
|
||||
std::string group =
|
||||
webrtc::field_trial::FindFullName(kVp8ForcedFallbackEncoderFieldTrial);
|
||||
return (group.find("Enabled") == 0) ? GetFallbackMaxPixels(group.substr(7))
|
||||
: rtc::Optional<int>();
|
||||
: absl::optional<int>();
|
||||
}
|
||||
|
||||
rtc::Optional<int> GetFallbackMaxPixelsIfFieldTrialDisabled() {
|
||||
absl::optional<int> GetFallbackMaxPixelsIfFieldTrialDisabled() {
|
||||
std::string group =
|
||||
webrtc::field_trial::FindFullName(kVp8ForcedFallbackEncoderFieldTrial);
|
||||
return (group.find("Disabled") == 0) ? GetFallbackMaxPixels(group.substr(8))
|
||||
: rtc::Optional<int>();
|
||||
: absl::optional<int>();
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
||||
@ -162,7 +162,7 @@ class SendStatisticsProxy : public CpuOveruseMetricsObserver,
|
||||
bool is_active = false;
|
||||
int on_off_events = 0;
|
||||
int64_t elapsed_ms = 0;
|
||||
rtc::Optional<int64_t> last_update_ms;
|
||||
absl::optional<int64_t> last_update_ms;
|
||||
const int max_frame_diff_ms = 2000;
|
||||
};
|
||||
struct FallbackEncoderInfoDisabled {
|
||||
@ -235,8 +235,8 @@ class SendStatisticsProxy : public CpuOveruseMetricsObserver,
|
||||
Clock* const clock_;
|
||||
const std::string payload_name_;
|
||||
const VideoSendStream::Config::Rtp rtp_config_;
|
||||
const rtc::Optional<int> fallback_max_pixels_;
|
||||
const rtc::Optional<int> fallback_max_pixels_disabled_;
|
||||
const absl::optional<int> fallback_max_pixels_;
|
||||
const absl::optional<int> fallback_max_pixels_disabled_;
|
||||
rtc::CriticalSection crit_;
|
||||
VideoEncoderConfig::ContentType content_type_ RTC_GUARDED_BY(crit_);
|
||||
const int64_t start_ms_;
|
||||
@ -248,7 +248,7 @@ class SendStatisticsProxy : public CpuOveruseMetricsObserver,
|
||||
rtc::RateTracker media_byte_rate_tracker_ RTC_GUARDED_BY(crit_);
|
||||
rtc::RateTracker encoded_frame_rate_tracker_ RTC_GUARDED_BY(crit_);
|
||||
|
||||
rtc::Optional<int64_t> last_outlier_timestamp_ RTC_GUARDED_BY(crit_);
|
||||
absl::optional<int64_t> last_outlier_timestamp_ RTC_GUARDED_BY(crit_);
|
||||
|
||||
// Contains stats used for UMA histograms. These stats will be reset if
|
||||
// content type changes between real-time video and screenshare, since these
|
||||
|
||||
@ -331,7 +331,7 @@ TEST_F(SendStatisticsProxyTest, OnSendEncodedImageIncreasesFramesEncoded) {
|
||||
TEST_F(SendStatisticsProxyTest, OnSendEncodedImageIncreasesQpSum) {
|
||||
EncodedImage encoded_image;
|
||||
CodecSpecificInfo codec_info;
|
||||
EXPECT_EQ(rtc::nullopt, statistics_proxy_->GetStats().qp_sum);
|
||||
EXPECT_EQ(absl::nullopt, statistics_proxy_->GetStats().qp_sum);
|
||||
encoded_image.qp_ = 3;
|
||||
statistics_proxy_->OnSendEncodedImage(encoded_image, &codec_info);
|
||||
EXPECT_EQ(3u, statistics_proxy_->GetStats().qp_sum);
|
||||
@ -344,9 +344,9 @@ TEST_F(SendStatisticsProxyTest, OnSendEncodedImageWithoutQpQpSumWontExist) {
|
||||
EncodedImage encoded_image;
|
||||
CodecSpecificInfo codec_info;
|
||||
encoded_image.qp_ = -1;
|
||||
EXPECT_EQ(rtc::nullopt, statistics_proxy_->GetStats().qp_sum);
|
||||
EXPECT_EQ(absl::nullopt, statistics_proxy_->GetStats().qp_sum);
|
||||
statistics_proxy_->OnSendEncodedImage(encoded_image, &codec_info);
|
||||
EXPECT_EQ(rtc::nullopt, statistics_proxy_->GetStats().qp_sum);
|
||||
EXPECT_EQ(absl::nullopt, statistics_proxy_->GetStats().qp_sum);
|
||||
}
|
||||
|
||||
TEST_F(SendStatisticsProxyTest, GetCpuAdaptationStats) {
|
||||
|
||||
@ -109,7 +109,7 @@ void VideoQualityObserver::UpdateHistograms() {
|
||||
RTC_LOG(LS_INFO) << log_stream.str();
|
||||
}
|
||||
|
||||
void VideoQualityObserver::OnDecodedFrame(rtc::Optional<uint8_t> qp,
|
||||
void VideoQualityObserver::OnDecodedFrame(absl::optional<uint8_t> qp,
|
||||
int width,
|
||||
int height,
|
||||
int64_t now_ms,
|
||||
@ -125,7 +125,7 @@ void VideoQualityObserver::OnDecodedFrame(rtc::Optional<uint8_t> qp,
|
||||
// Process inter-frame delay.
|
||||
int64_t interframe_delay_ms = now_ms - last_frame_decoded_ms_;
|
||||
interframe_delays_.Add(interframe_delay_ms);
|
||||
rtc::Optional<int> avg_interframe_delay =
|
||||
absl::optional<int> avg_interframe_delay =
|
||||
interframe_delays_.Avg(kMinFrameSamplesToDetectFreeze);
|
||||
// Check if it was a freeze.
|
||||
if (avg_interframe_delay &&
|
||||
@ -140,7 +140,7 @@ void VideoQualityObserver::OnDecodedFrame(rtc::Optional<uint8_t> qp,
|
||||
// Only count inter-frame delay as playback time if there
|
||||
// was no freeze.
|
||||
time_in_resolution_ms_[current_resolution_] += interframe_delay_ms;
|
||||
rtc::Optional<int> qp_blocky_threshold;
|
||||
absl::optional<int> qp_blocky_threshold;
|
||||
// TODO(ilnik): add other codec types when we have QP for them.
|
||||
switch (codec) {
|
||||
case kVideoCodecVP8:
|
||||
@ -150,7 +150,7 @@ void VideoQualityObserver::OnDecodedFrame(rtc::Optional<uint8_t> qp,
|
||||
qp_blocky_threshold = kBlockyQpThresholdVp9;
|
||||
break;
|
||||
default:
|
||||
qp_blocky_threshold = rtc::nullopt;
|
||||
qp_blocky_threshold = absl::nullopt;
|
||||
}
|
||||
if (qp_blocky_threshold && qp.value_or(0) > *qp_blocky_threshold) {
|
||||
time_in_blocky_video_ms_ += interframe_delay_ms;
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
#include <stdint.h>
|
||||
#include <vector>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/video/video_content_type.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "rtc_base/numerics/sample_counter.h"
|
||||
@ -30,7 +30,7 @@ class VideoQualityObserver {
|
||||
explicit VideoQualityObserver(VideoContentType content_type);
|
||||
~VideoQualityObserver();
|
||||
|
||||
void OnDecodedFrame(rtc::Optional<uint8_t> qp,
|
||||
void OnDecodedFrame(absl::optional<uint8_t> qp,
|
||||
int width,
|
||||
int height,
|
||||
int64_t now_ms,
|
||||
|
||||
@ -491,8 +491,8 @@ class VideoAnalyzer : public PacketReceiver,
|
||||
render_time_ms(render_time_ms),
|
||||
encoded_frame_size(encoded_frame_size) {}
|
||||
|
||||
rtc::Optional<VideoFrame> reference;
|
||||
rtc::Optional<VideoFrame> render;
|
||||
absl::optional<VideoFrame> reference;
|
||||
absl::optional<VideoFrame> render;
|
||||
bool dropped;
|
||||
int64_t input_time_ms;
|
||||
int64_t send_time_ms;
|
||||
@ -1028,7 +1028,7 @@ class VideoAnalyzer : public PacketReceiver,
|
||||
};
|
||||
|
||||
// Rendered frame with worst PSNR is saved for further analysis.
|
||||
rtc::Optional<FrameWithPsnr> worst_frame_ RTC_GUARDED_BY(comparison_lock_);
|
||||
absl::optional<FrameWithPsnr> worst_frame_ RTC_GUARDED_BY(comparison_lock_);
|
||||
|
||||
size_t last_fec_bytes_;
|
||||
|
||||
@ -1052,13 +1052,13 @@ class VideoAnalyzer : public PacketReceiver,
|
||||
|
||||
rtc::CriticalSection crit_;
|
||||
std::deque<VideoFrame> frames_ RTC_GUARDED_BY(crit_);
|
||||
rtc::Optional<VideoFrame> last_rendered_frame_ RTC_GUARDED_BY(crit_);
|
||||
absl::optional<VideoFrame> last_rendered_frame_ RTC_GUARDED_BY(crit_);
|
||||
rtc::TimestampWrapAroundHandler wrap_handler_ RTC_GUARDED_BY(crit_);
|
||||
std::map<int64_t, int64_t> send_times_ RTC_GUARDED_BY(crit_);
|
||||
std::map<int64_t, int64_t> recv_times_ RTC_GUARDED_BY(crit_);
|
||||
std::map<int64_t, size_t> encoded_frame_sizes_ RTC_GUARDED_BY(crit_);
|
||||
rtc::Optional<uint32_t> first_encoded_timestamp_ RTC_GUARDED_BY(crit_);
|
||||
rtc::Optional<uint32_t> first_sent_timestamp_ RTC_GUARDED_BY(crit_);
|
||||
absl::optional<uint32_t> first_encoded_timestamp_ RTC_GUARDED_BY(crit_);
|
||||
absl::optional<uint32_t> first_sent_timestamp_ RTC_GUARDED_BY(crit_);
|
||||
const double avg_psnr_threshold_;
|
||||
const double avg_ssim_threshold_;
|
||||
bool is_quick_test_enabled_;
|
||||
@ -1751,7 +1751,7 @@ void VideoQualityTest::SetupThumbnailCapturers(size_t num_thumbnail_streams) {
|
||||
for (size_t i = 0; i < num_thumbnail_streams; ++i) {
|
||||
thumbnail_capturers_.emplace_back(test::FrameGeneratorCapturer::Create(
|
||||
static_cast<int>(thumbnail.width), static_cast<int>(thumbnail.height),
|
||||
rtc::nullopt, rtc::nullopt, thumbnail.max_framerate, clock_));
|
||||
absl::nullopt, absl::nullopt, thumbnail.max_framerate, clock_));
|
||||
RTC_DCHECK(thumbnail_capturers_.back());
|
||||
}
|
||||
}
|
||||
@ -1817,13 +1817,13 @@ void VideoQualityTest::CreateCapturers() {
|
||||
if (params_.video[video_idx].clip_name == "Generator") {
|
||||
video_capturers_[video_idx].reset(test::FrameGeneratorCapturer::Create(
|
||||
static_cast<int>(params_.video[video_idx].width),
|
||||
static_cast<int>(params_.video[video_idx].height), rtc::nullopt,
|
||||
rtc::nullopt, params_.video[video_idx].fps, clock_));
|
||||
static_cast<int>(params_.video[video_idx].height), absl::nullopt,
|
||||
absl::nullopt, params_.video[video_idx].fps, clock_));
|
||||
} else if (params_.video[video_idx].clip_name == "GeneratorI420A") {
|
||||
video_capturers_[video_idx].reset(test::FrameGeneratorCapturer::Create(
|
||||
static_cast<int>(params_.video[video_idx].width),
|
||||
static_cast<int>(params_.video[video_idx].height),
|
||||
test::FrameGenerator::OutputType::I420A, rtc::nullopt,
|
||||
test::FrameGenerator::OutputType::I420A, absl::nullopt,
|
||||
params_.video[video_idx].fps, clock_));
|
||||
} else if (params_.video[video_idx].clip_name.empty()) {
|
||||
video_capturers_[video_idx].reset(test::VcmCapturer::Create(
|
||||
@ -1836,7 +1836,7 @@ void VideoQualityTest::CreateCapturers() {
|
||||
test::FrameGeneratorCapturer::Create(
|
||||
static_cast<int>(params_.video[video_idx].width),
|
||||
static_cast<int>(params_.video[video_idx].height),
|
||||
rtc::nullopt, rtc::nullopt, params_.video[video_idx].fps,
|
||||
absl::nullopt, absl::nullopt, params_.video[video_idx].fps,
|
||||
clock_));
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -16,13 +16,13 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "call/rtp_stream_receiver_controller_interface.h"
|
||||
#include "call/rtx_receive_stream.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "common_video/h264/profile_level_id.h"
|
||||
#include "common_video/libyuv/include/webrtc_libyuv.h"
|
||||
#include "common_video/include/incoming_video_stream.h"
|
||||
#include "common_video/libyuv/include/webrtc_libyuv.h"
|
||||
#include "modules/rtp_rtcp/include/rtp_receiver.h"
|
||||
#include "modules/rtp_rtcp/include/rtp_rtcp.h"
|
||||
#include "modules/utility/include/process_thread.h"
|
||||
@ -375,7 +375,7 @@ int VideoReceiveStream::id() const {
|
||||
return config_.rtp.remote_ssrc;
|
||||
}
|
||||
|
||||
rtc::Optional<Syncable::Info> VideoReceiveStream::GetInfo() const {
|
||||
absl::optional<Syncable::Info> VideoReceiveStream::GetInfo() const {
|
||||
RTC_DCHECK_CALLED_SEQUENTIALLY(&module_process_sequence_checker_);
|
||||
Syncable::Info info;
|
||||
|
||||
@ -384,7 +384,7 @@ rtc::Optional<Syncable::Info> VideoReceiveStream::GetInfo() const {
|
||||
if (!rtp_receiver->GetLatestTimestamps(
|
||||
&info.latest_received_capture_timestamp,
|
||||
&info.latest_receive_time_ms))
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
|
||||
RtpRtcp* rtp_rtcp = rtp_video_stream_receiver_.rtp_rtcp();
|
||||
RTC_DCHECK(rtp_rtcp);
|
||||
@ -393,7 +393,7 @@ rtc::Optional<Syncable::Info> VideoReceiveStream::GetInfo() const {
|
||||
nullptr,
|
||||
nullptr,
|
||||
&info.capture_time_source_clock) != 0) {
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
info.current_delay_ms = video_receiver_.Delay();
|
||||
@ -454,9 +454,9 @@ bool VideoReceiveStream::Decode() {
|
||||
} else {
|
||||
RTC_DCHECK_EQ(res, video_coding::FrameBuffer::ReturnReason::kTimeout);
|
||||
int64_t now_ms = clock_->TimeInMilliseconds();
|
||||
rtc::Optional<int64_t> last_packet_ms =
|
||||
absl::optional<int64_t> last_packet_ms =
|
||||
rtp_video_stream_receiver_.LastReceivedPacketMs();
|
||||
rtc::Optional<int64_t> last_keyframe_packet_ms =
|
||||
absl::optional<int64_t> last_keyframe_packet_ms =
|
||||
rtp_video_stream_receiver_.LastReceivedKeyframePacketMs();
|
||||
|
||||
// To avoid spamming keyframe requests for a stream that is not active we
|
||||
|
||||
@ -108,7 +108,7 @@ class VideoReceiveStream : public webrtc::VideoReceiveStream,
|
||||
|
||||
// Implements Syncable.
|
||||
int id() const override;
|
||||
rtc::Optional<Syncable::Info> GetInfo() const override;
|
||||
absl::optional<Syncable::Info> GetInfo() const override;
|
||||
uint32_t GetPlayoutTimestamp() const override;
|
||||
void SetMinimumPlayoutDelay(int delay_ms) override;
|
||||
|
||||
|
||||
@ -179,7 +179,7 @@ VideoSendStream::Stats VideoSendStream::GetStats() {
|
||||
return stats_proxy_.GetStats();
|
||||
}
|
||||
|
||||
rtc::Optional<float> VideoSendStream::GetPacingFactorOverride() const {
|
||||
absl::optional<float> VideoSendStream::GetPacingFactorOverride() const {
|
||||
return send_stream_->configured_pacing_factor_;
|
||||
}
|
||||
|
||||
|
||||
@ -106,7 +106,7 @@ class VideoSendStream : public webrtc::VideoSendStream {
|
||||
|
||||
class ConstructionTask;
|
||||
|
||||
rtc::Optional<float> GetPacingFactorOverride() const;
|
||||
absl::optional<float> GetPacingFactorOverride() const;
|
||||
|
||||
rtc::ThreadChecker thread_checker_;
|
||||
rtc::TaskQueue* const worker_queue_;
|
||||
|
||||
@ -151,25 +151,25 @@ bool TransportSeqNumExtensionConfigured(const VideoSendStream::Config& config) {
|
||||
const char kForcedFallbackFieldTrial[] =
|
||||
"WebRTC-VP8-Forced-Fallback-Encoder-v2";
|
||||
|
||||
rtc::Optional<int> GetFallbackMinBpsFromFieldTrial() {
|
||||
absl::optional<int> GetFallbackMinBpsFromFieldTrial() {
|
||||
if (!webrtc::field_trial::IsEnabled(kForcedFallbackFieldTrial))
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
|
||||
std::string group =
|
||||
webrtc::field_trial::FindFullName(kForcedFallbackFieldTrial);
|
||||
if (group.empty())
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
|
||||
int min_pixels;
|
||||
int max_pixels;
|
||||
int min_bps;
|
||||
if (sscanf(group.c_str(), "Enabled-%d,%d,%d", &min_pixels, &max_pixels,
|
||||
&min_bps) != 3) {
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
if (min_bps <= 0)
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
|
||||
return min_bps;
|
||||
}
|
||||
@ -370,7 +370,7 @@ VideoSendStreamImpl::VideoSendStreamImpl(
|
||||
if (TransportSeqNumExtensionConfigured(*config_)) {
|
||||
has_packet_feedback_ = true;
|
||||
|
||||
rtc::Optional<AlrExperimentSettings> alr_settings;
|
||||
absl::optional<AlrExperimentSettings> alr_settings;
|
||||
if (content_type == VideoEncoderConfig::ContentType::kScreen) {
|
||||
alr_settings = AlrExperimentSettings::CreateFromFieldTrial(
|
||||
AlrExperimentSettings::kScreenshareProbingBweExperimentName);
|
||||
|
||||
@ -88,7 +88,7 @@ class VideoSendStreamImpl : public webrtc::BitrateAllocatorObserver,
|
||||
|
||||
void SetTransportOverhead(size_t transport_overhead_per_packet);
|
||||
|
||||
rtc::Optional<float> configured_pacing_factor_;
|
||||
absl::optional<float> configured_pacing_factor_;
|
||||
|
||||
// From PacketFeedbackObserver.
|
||||
void OnPacketAdded(uint32_t ssrc, uint16_t seq_num) override;
|
||||
|
||||
@ -58,7 +58,7 @@ class VideoSendStreamPeer {
|
||||
explicit VideoSendStreamPeer(webrtc::VideoSendStream* base_class_stream)
|
||||
: internal_stream_(
|
||||
static_cast<internal::VideoSendStream*>(base_class_stream)) {}
|
||||
rtc::Optional<float> GetPacingFactorOverride() const {
|
||||
absl::optional<float> GetPacingFactorOverride() const {
|
||||
return internal_stream_->GetPacingFactorOverride();
|
||||
}
|
||||
|
||||
@ -2065,7 +2065,7 @@ class StartStopBitrateObserver : public test::FakeEncoder {
|
||||
|
||||
bool WaitBitrateChanged(bool non_zero) {
|
||||
do {
|
||||
rtc::Optional<int> bitrate_kbps;
|
||||
absl::optional<int> bitrate_kbps;
|
||||
{
|
||||
rtc::CritScope lock(&crit_);
|
||||
bitrate_kbps = bitrate_kbps_;
|
||||
@ -2085,7 +2085,7 @@ class StartStopBitrateObserver : public test::FakeEncoder {
|
||||
rtc::CriticalSection crit_;
|
||||
rtc::Event encoder_init_;
|
||||
rtc::Event bitrate_changed_;
|
||||
rtc::Optional<int> bitrate_kbps_ RTC_GUARDED_BY(crit_);
|
||||
absl::optional<int> bitrate_kbps_ RTC_GUARDED_BY(crit_);
|
||||
};
|
||||
|
||||
// This test that if the encoder use an internal source, VideoEncoder::SetRates
|
||||
@ -3773,7 +3773,7 @@ TEST_F(VideoSendStreamTest, SendsKeepAlive) {
|
||||
class PacingFactorObserver : public test::SendTest {
|
||||
public:
|
||||
PacingFactorObserver(bool configure_send_side,
|
||||
rtc::Optional<float> expected_pacing_factor)
|
||||
absl::optional<float> expected_pacing_factor)
|
||||
: test::SendTest(VideoSendStreamTest::kDefaultTimeoutMs),
|
||||
configure_send_side_(configure_send_side),
|
||||
expected_pacing_factor_(expected_pacing_factor) {}
|
||||
@ -3824,7 +3824,7 @@ class PacingFactorObserver : public test::SendTest {
|
||||
|
||||
private:
|
||||
const bool configure_send_side_;
|
||||
const rtc::Optional<float> expected_pacing_factor_;
|
||||
const absl::optional<float> expected_pacing_factor_;
|
||||
};
|
||||
|
||||
std::string GetAlrProbingExperimentString() {
|
||||
@ -3845,7 +3845,7 @@ TEST_F(VideoSendStreamTest, AlrConfiguredWhenSendSideOn) {
|
||||
TEST_F(VideoSendStreamTest, AlrNotConfiguredWhenSendSideOff) {
|
||||
test::ScopedFieldTrials alr_experiment(GetAlrProbingExperimentString());
|
||||
// Send-side bwe off, use configuration should not be overridden.
|
||||
PacingFactorObserver test_without_send_side(false, rtc::nullopt);
|
||||
PacingFactorObserver test_without_send_side(false, absl::nullopt);
|
||||
RunBaseTest(&test_without_send_side);
|
||||
}
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ VideoStreamDecoder::~VideoStreamDecoder() {
|
||||
// thread may have held the lock when calling VideoDecoder::Decode, Reset, or
|
||||
// Release. Acquiring the same lock in the path of decode callback can deadlock.
|
||||
int32_t VideoStreamDecoder::FrameToRender(VideoFrame& video_frame,
|
||||
rtc::Optional<uint8_t> qp,
|
||||
absl::optional<uint8_t> qp,
|
||||
VideoContentType content_type) {
|
||||
receive_stats_callback_->OnDecodedFrame(qp, video_frame.width(),
|
||||
video_frame.height(), content_type);
|
||||
|
||||
@ -52,7 +52,7 @@ class VideoStreamDecoder : public VCMReceiveCallback,
|
||||
|
||||
// Implements VCMReceiveCallback.
|
||||
int32_t FrameToRender(VideoFrame& video_frame,
|
||||
rtc::Optional<uint8_t> qp,
|
||||
absl::optional<uint8_t> qp,
|
||||
VideoContentType content_type) override;
|
||||
int32_t ReceivedDecodedReferenceFrame(const uint64_t picture_id) override;
|
||||
void OnIncomingPayloadType(int payload_type) override;
|
||||
|
||||
@ -232,21 +232,21 @@ VideoStreamDecoderImpl::GetFrameTimestamps(int64_t timestamp) {
|
||||
|
||||
// VideoDecoder::DecodedImageCallback
|
||||
int32_t VideoStreamDecoderImpl::Decoded(VideoFrame& decoded_image) {
|
||||
Decoded(decoded_image, rtc::nullopt, rtc::nullopt);
|
||||
Decoded(decoded_image, absl::nullopt, absl::nullopt);
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
}
|
||||
|
||||
// VideoDecoder::DecodedImageCallback
|
||||
int32_t VideoStreamDecoderImpl::Decoded(VideoFrame& decoded_image,
|
||||
int64_t decode_time_ms) {
|
||||
Decoded(decoded_image, decode_time_ms, rtc::nullopt);
|
||||
Decoded(decoded_image, decode_time_ms, absl::nullopt);
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
}
|
||||
|
||||
// VideoDecoder::DecodedImageCallback
|
||||
void VideoStreamDecoderImpl::Decoded(VideoFrame& decoded_image,
|
||||
rtc::Optional<int32_t> decode_time_ms,
|
||||
rtc::Optional<uint8_t> qp) {
|
||||
absl::optional<int32_t> decode_time_ms,
|
||||
absl::optional<uint8_t> qp) {
|
||||
int64_t decode_stop_time_ms = rtc::TimeMillis();
|
||||
|
||||
bookkeeping_queue_.PostTask([this, decode_stop_time_ms, decoded_image,
|
||||
@ -261,11 +261,11 @@ void VideoStreamDecoderImpl::Decoded(VideoFrame& decoded_image,
|
||||
return;
|
||||
}
|
||||
|
||||
rtc::Optional<int> casted_qp;
|
||||
absl::optional<int> casted_qp;
|
||||
if (qp)
|
||||
casted_qp.emplace(*qp);
|
||||
|
||||
rtc::Optional<int> casted_decode_time_ms(decode_time_ms.value_or(
|
||||
absl::optional<int> casted_decode_time_ms(decode_time_ms.value_or(
|
||||
decode_stop_time_ms - frame_timestamps->decode_start_time_ms));
|
||||
|
||||
timing_.StopDecodeTimer(0, *casted_decode_time_ms, decode_stop_time_ms,
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/video/video_stream_decoder.h"
|
||||
#include "modules/video_coding/frame_buffer2.h"
|
||||
#include "modules/video_coding/jitter_estimator.h"
|
||||
@ -64,8 +64,8 @@ class VideoStreamDecoderImpl : public VideoStreamDecoder,
|
||||
int32_t Decoded(VideoFrame& decodedImage) override;
|
||||
int32_t Decoded(VideoFrame& decodedImage, int64_t decode_time_ms) override;
|
||||
void Decoded(VideoFrame& decodedImage,
|
||||
rtc::Optional<int32_t> decode_time_ms,
|
||||
rtc::Optional<uint8_t> qp) override;
|
||||
absl::optional<int32_t> decode_time_ms,
|
||||
absl::optional<uint8_t> qp) override;
|
||||
|
||||
VideoStreamDecoder::Callbacks* const callbacks_
|
||||
RTC_PT_GUARDED_BY(bookkeeping_queue_);
|
||||
@ -83,7 +83,7 @@ class VideoStreamDecoderImpl : public VideoStreamDecoder,
|
||||
VCMTiming timing_;
|
||||
video_coding::FrameBuffer frame_buffer_;
|
||||
video_coding::VideoLayerFrameId last_continuous_id_;
|
||||
rtc::Optional<int> current_payload_type_;
|
||||
absl::optional<int> current_payload_type_;
|
||||
std::unique_ptr<VideoDecoder> decoder_;
|
||||
|
||||
// Some decoders are pipelined so it is not sufficient to save frame info
|
||||
|
||||
@ -183,7 +183,7 @@ class VideoStreamEncoder::VideoSourceProxy {
|
||||
RTC_LOG(LS_INFO) << "Scaling down resolution, max pixels: "
|
||||
<< pixels_wanted;
|
||||
sink_wants_.max_pixel_count = pixels_wanted;
|
||||
sink_wants_.target_pixel_count = rtc::nullopt;
|
||||
sink_wants_.target_pixel_count = absl::nullopt;
|
||||
source_->AddOrUpdateSink(video_stream_encoder_,
|
||||
GetActiveSinkWantsInternal());
|
||||
return true;
|
||||
@ -606,7 +606,7 @@ void VideoStreamEncoder::ConfigureQualityScaler() {
|
||||
// Drop frames and scale down until desired quality is achieved.
|
||||
|
||||
// Use experimental thresholds if available.
|
||||
rtc::Optional<VideoEncoder::QpThresholds> experimental_thresholds;
|
||||
absl::optional<VideoEncoder::QpThresholds> experimental_thresholds;
|
||||
if (quality_scaling_experiment_enabled_) {
|
||||
experimental_thresholds = QualityScalingExperiment::GetQpThresholds(
|
||||
encoder_config_.codec_type);
|
||||
@ -880,7 +880,7 @@ EncodedImageCallback::Result VideoStreamEncoder::OnEncodedImage(
|
||||
int64_t capture_time_us =
|
||||
encoded_image.capture_time_ms_ * rtc::kNumMicrosecsPerMillisec;
|
||||
|
||||
rtc::Optional<int> encode_duration_us;
|
||||
absl::optional<int> encode_duration_us;
|
||||
if (encoded_image.timing_.flags != VideoSendTiming::kInvalid) {
|
||||
encode_duration_us.emplace(
|
||||
// TODO(nisse): Maybe use capture_time_ms_ rather than encode_start_ms_?
|
||||
|
||||
@ -230,7 +230,7 @@ class VideoStreamEncoder : public VideoStreamEncoderInterface,
|
||||
// Set when configuration must create a new encoder object, e.g.,
|
||||
// because of a codec change.
|
||||
bool pending_encoder_creation_ RTC_GUARDED_BY(&encoder_queue_);
|
||||
rtc::Optional<VideoFrameInfo> last_frame_info_
|
||||
absl::optional<VideoFrameInfo> last_frame_info_
|
||||
RTC_GUARDED_BY(&encoder_queue_);
|
||||
int crop_width_ RTC_GUARDED_BY(&encoder_queue_);
|
||||
int crop_height_ RTC_GUARDED_BY(&encoder_queue_);
|
||||
@ -259,7 +259,7 @@ class VideoStreamEncoder : public VideoStreamEncoderInterface,
|
||||
};
|
||||
// Stores a snapshot of the last adaptation request triggered by an AdaptUp
|
||||
// or AdaptDown signal.
|
||||
rtc::Optional<AdaptationRequest> last_adaptation_request_
|
||||
absl::optional<AdaptationRequest> last_adaptation_request_
|
||||
RTC_GUARDED_BY(&encoder_queue_);
|
||||
|
||||
rtc::RaceChecker incoming_frame_race_checker_
|
||||
@ -274,12 +274,12 @@ class VideoStreamEncoder : public VideoStreamEncoderInterface,
|
||||
int64_t last_frame_log_ms_ RTC_GUARDED_BY(incoming_frame_race_checker_);
|
||||
int captured_frame_count_ RTC_GUARDED_BY(&encoder_queue_);
|
||||
int dropped_frame_count_ RTC_GUARDED_BY(&encoder_queue_);
|
||||
rtc::Optional<VideoFrame> pending_frame_ RTC_GUARDED_BY(&encoder_queue_);
|
||||
absl::optional<VideoFrame> pending_frame_ RTC_GUARDED_BY(&encoder_queue_);
|
||||
int64_t pending_frame_post_time_us_ RTC_GUARDED_BY(&encoder_queue_);
|
||||
|
||||
VideoBitrateAllocationObserver* bitrate_observer_
|
||||
RTC_GUARDED_BY(&encoder_queue_);
|
||||
rtc::Optional<int64_t> last_parameters_update_ms_
|
||||
absl::optional<int64_t> last_parameters_update_ms_
|
||||
RTC_GUARDED_BY(&encoder_queue_);
|
||||
|
||||
// All public methods are proxied to |encoder_queue_|. It must must be
|
||||
|
||||
@ -180,8 +180,8 @@ class AdaptingFrameForwarder : public test::FrameForwarder {
|
||||
return last_wants_;
|
||||
}
|
||||
|
||||
rtc::Optional<int> last_sent_width() const { return last_width_; }
|
||||
rtc::Optional<int> last_sent_height() const { return last_height_; }
|
||||
absl::optional<int> last_sent_width() const { return last_width_; }
|
||||
absl::optional<int> last_sent_height() const { return last_height_; }
|
||||
|
||||
void IncomingCapturedFrame(const VideoFrame& video_frame) override {
|
||||
int cropped_width = 0;
|
||||
@ -201,8 +201,8 @@ class AdaptingFrameForwarder : public test::FrameForwarder {
|
||||
last_width_.emplace(adapted_frame.width());
|
||||
last_height_.emplace(adapted_frame.height());
|
||||
} else {
|
||||
last_width_ = rtc::nullopt;
|
||||
last_height_ = rtc::nullopt;
|
||||
last_width_ = absl::nullopt;
|
||||
last_height_ = absl::nullopt;
|
||||
}
|
||||
} else {
|
||||
test::FrameForwarder::IncomingCapturedFrame(video_frame);
|
||||
@ -223,8 +223,8 @@ class AdaptingFrameForwarder : public test::FrameForwarder {
|
||||
cricket::VideoAdapter adapter_;
|
||||
bool adaptation_enabled_ RTC_GUARDED_BY(crit_);
|
||||
rtc::VideoSinkWants last_wants_ RTC_GUARDED_BY(crit_);
|
||||
rtc::Optional<int> last_width_;
|
||||
rtc::Optional<int> last_height_;
|
||||
absl::optional<int> last_width_;
|
||||
absl::optional<int> last_height_;
|
||||
};
|
||||
|
||||
class MockableSendStatisticsProxy : public SendStatisticsProxy {
|
||||
@ -253,7 +253,7 @@ class MockableSendStatisticsProxy : public SendStatisticsProxy {
|
||||
|
||||
private:
|
||||
rtc::CriticalSection lock_;
|
||||
rtc::Optional<VideoSendStream::Stats> mock_stats_ RTC_GUARDED_BY(lock_);
|
||||
absl::optional<VideoSendStream::Stats> mock_stats_ RTC_GUARDED_BY(lock_);
|
||||
};
|
||||
|
||||
class MockBitrateObserver : public VideoBitrateAllocationObserver {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user