diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-12 14:27:29 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-13 09:35:20 +0000 |
commit | c30a6232df03e1efbd9f3b226777b07e087a1122 (patch) | |
tree | e992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/media/cast | |
parent | 7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff) | |
download | qtwebengine-chromium-85-based.tar.gz |
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/media/cast')
22 files changed, 63 insertions, 63 deletions
diff --git a/chromium/media/cast/common/expanded_value_base.h b/chromium/media/cast/common/expanded_value_base.h index f890bc350a5..8021a4fb365 100644 --- a/chromium/media/cast/common/expanded_value_base.h +++ b/chromium/media/cast/common/expanded_value_base.h @@ -9,7 +9,7 @@ #include <limits> -#include "base/logging.h" +#include "base/check_op.h" namespace media { namespace cast { diff --git a/chromium/media/cast/common/mod_util.h b/chromium/media/cast/common/mod_util.h index 8ca42af0e6e..fc68c63f26f 100644 --- a/chromium/media/cast/common/mod_util.h +++ b/chromium/media/cast/common/mod_util.h @@ -6,7 +6,7 @@ #define MEDIA_CAST_COMMON_MOD_UTIL_H_ #include <map> -#include "base/logging.h" +#include "base/check.h" namespace media { namespace cast { diff --git a/chromium/media/cast/common/transport_encryption_handler.cc b/chromium/media/cast/common/transport_encryption_handler.cc index 3ee8cab1aba..d3b754e85f2 100644 --- a/chromium/media/cast/common/transport_encryption_handler.cc +++ b/chromium/media/cast/common/transport_encryption_handler.cc @@ -7,6 +7,7 @@ #include <stddef.h> #include "base/logging.h" +#include "base/notreached.h" #include "crypto/encryptor.h" #include "crypto/symmetric_key.h" diff --git a/chromium/media/cast/net/pacing/paced_sender.cc b/chromium/media/cast/net/pacing/paced_sender.cc index 3e1e8232b42..62317fc0267 100644 --- a/chromium/media/cast/net/pacing/paced_sender.cc +++ b/chromium/media/cast/net/pacing/paced_sender.cc @@ -6,6 +6,7 @@ #include "base/big_endian.h" #include "base/bind.h" +#include "base/logging.h" #include "base/numerics/safe_conversions.h" namespace media { diff --git a/chromium/media/cast/net/rtcp/receiver_rtcp_session.cc b/chromium/media/cast/net/rtcp/receiver_rtcp_session.cc index aec48b7841c..3544cbd8023 100644 --- a/chromium/media/cast/net/rtcp/receiver_rtcp_session.cc +++ b/chromium/media/cast/net/rtcp/receiver_rtcp_session.cc @@ -2,9 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "media/cast/net/rtcp/receiver_rtcp_session.h" + #include "base/big_endian.h" +#include "base/logging.h" #include "base/time/tick_clock.h" -#include "media/cast/net/rtcp/receiver_rtcp_session.h" #include "media/cast/net/rtcp/rtcp_builder.h" #include "media/cast/net/rtcp/rtcp_defines.h" #include "media/cast/net/rtcp/rtcp_utility.h" diff --git a/chromium/media/cast/net/rtcp/rtcp_builder.cc b/chromium/media/cast/net/rtcp/rtcp_builder.cc index aa296ba72ce..a7fb6509c23 100644 --- a/chromium/media/cast/net/rtcp/rtcp_builder.cc +++ b/chromium/media/cast/net/rtcp/rtcp_builder.cc @@ -114,7 +114,7 @@ class NackStringBuilder { } // namespace RtcpBuilder::RtcpBuilder(uint32_t sending_ssrc) - : writer_(NULL, 0), local_ssrc_(sending_ssrc), ptr_of_length_(NULL) {} + : writer_(nullptr, 0), local_ssrc_(sending_ssrc), ptr_of_length_(nullptr) {} RtcpBuilder::~RtcpBuilder() = default; @@ -127,7 +127,7 @@ void RtcpBuilder::PatchLengthField() { << "Packets must be a multiple of 32 bits long"; *ptr_of_length_ = this_packet_length >> 10; *(ptr_of_length_ + 1) = (this_packet_length >> 2) & 0xFF; - ptr_of_length_ = NULL; + ptr_of_length_ = nullptr; } } @@ -154,7 +154,7 @@ void RtcpBuilder::Start() { PacketRef RtcpBuilder::Finish() { PatchLengthField(); packet_->data.resize(kMaxIpPacketSize - writer_.remaining()); - writer_ = base::BigEndianWriter(NULL, 0); + writer_ = base::BigEndianWriter(nullptr, 0); PacketRef ret = packet_; packet_.reset(); return ret; diff --git a/chromium/media/cast/net/rtcp/sender_rtcp_session.cc b/chromium/media/cast/net/rtcp/sender_rtcp_session.cc index 2b2908142f6..dba167915ed 100644 --- a/chromium/media/cast/net/rtcp/sender_rtcp_session.cc +++ b/chromium/media/cast/net/rtcp/sender_rtcp_session.cc @@ -7,6 +7,7 @@ #include <utility> #include "base/big_endian.h" +#include "base/logging.h" #include "base/time/time.h" #include "media/cast/constants.h" #include "media/cast/net/pacing/paced_sender.h" diff --git a/chromium/media/cast/net/rtcp/test_rtcp_packet_builder.cc b/chromium/media/cast/net/rtcp/test_rtcp_packet_builder.cc index 8c00d8e9b15..626ed742888 100644 --- a/chromium/media/cast/net/rtcp/test_rtcp_packet_builder.cc +++ b/chromium/media/cast/net/rtcp/test_rtcp_packet_builder.cc @@ -11,9 +11,9 @@ namespace media { namespace cast { TestRtcpPacketBuilder::TestRtcpPacketBuilder() - : ptr_of_length_(NULL), + : ptr_of_length_(nullptr), big_endian_writer_(reinterpret_cast<char*>(buffer_), kMaxIpPacketSize), - big_endian_reader_(NULL, 0) {} + big_endian_reader_(nullptr, 0) {} void TestRtcpPacketBuilder::AddSr(uint32_t remote_ssrc, int number_of_report_blocks) { @@ -255,7 +255,7 @@ void TestRtcpPacketBuilder::PatchLengthField() { << "Packets must be a multiple of 32 bits long"; *ptr_of_length_ = this_packet_length >> 10; *(ptr_of_length_ + 1) = (this_packet_length >> 2) & 0xFF; - ptr_of_length_ = NULL; + ptr_of_length_ = nullptr; } } diff --git a/chromium/media/cast/net/rtp/cast_message_builder.cc b/chromium/media/cast/net/rtp/cast_message_builder.cc index 1376061153c..61a152b53a1 100644 --- a/chromium/media/cast/net/rtp/cast_message_builder.cc +++ b/chromium/media/cast/net/rtp/cast_message_builder.cc @@ -4,6 +4,7 @@ #include "media/cast/net/rtp/cast_message_builder.h" +#include "base/logging.h" #include "media/cast/constants.h" #include "media/cast/net/rtp/framer.h" diff --git a/chromium/media/cast/net/udp_packet_pipe_unittest.cc b/chromium/media/cast/net/udp_packet_pipe_unittest.cc index b5a209a4030..d02b4655ba7 100644 --- a/chromium/media/cast/net/udp_packet_pipe_unittest.cc +++ b/chromium/media/cast/net/udp_packet_pipe_unittest.cc @@ -4,6 +4,7 @@ #include "media/cast/net/udp_packet_pipe.h" +#include <cstring> #include <memory> #include <string> diff --git a/chromium/media/cast/sender/audio_encoder.cc b/chromium/media/cast/sender/audio_encoder.cc index 43797c6bf59..23110128b33 100644 --- a/chromium/media/cast/sender/audio_encoder.cc +++ b/chromium/media/cast/sender/audio_encoder.cc @@ -14,6 +14,7 @@ #include "base/bind.h" #include "base/bind_helpers.h" #include "base/location.h" +#include "base/logging.h" #include "base/macros.h" #include "base/stl_util.h" #include "base/sys_byteorder.h" diff --git a/chromium/media/cast/sender/audio_encoder_unittest.cc b/chromium/media/cast/sender/audio_encoder_unittest.cc index 557642b7456..9531c2c1590 100644 --- a/chromium/media/cast/sender/audio_encoder_unittest.cc +++ b/chromium/media/cast/sender/audio_encoder_unittest.cc @@ -13,6 +13,7 @@ #include "base/bind.h" #include "base/bind_helpers.h" +#include "base/logging.h" #include "base/stl_util.h" #include "build/build_config.h" #include "media/base/audio_bus.h" diff --git a/chromium/media/cast/sender/audio_sender_unittest.cc b/chromium/media/cast/sender/audio_sender_unittest.cc index 10551754218..54ca3921278 100644 --- a/chromium/media/cast/sender/audio_sender_unittest.cc +++ b/chromium/media/cast/sender/audio_sender_unittest.cc @@ -11,6 +11,7 @@ #include "base/bind.h" #include "base/bind_helpers.h" +#include "base/logging.h" #include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/test/simple_test_tick_clock.h" diff --git a/chromium/media/cast/sender/external_video_encoder.cc b/chromium/media/cast/sender/external_video_encoder.cc index fd8fe6443a1..23e02f0e302 100644 --- a/chromium/media/cast/sender/external_video_encoder.cc +++ b/chromium/media/cast/sender/external_video_encoder.cc @@ -325,10 +325,10 @@ class ExternalVideoEncoder::VEAClientImpl // If FRAME_DURATION metadata was provided in the source VideoFrame, // compute the utilization metrics. - base::TimeDelta frame_duration; - if (request.video_frame->metadata()->GetTimeDelta( - media::VideoFrameMetadata::FRAME_DURATION, &frame_duration) && - frame_duration > base::TimeDelta()) { + base::TimeDelta frame_duration = + request.video_frame->metadata()->frame_duration.value_or( + base::TimeDelta()); + if (frame_duration > base::TimeDelta()) { // Compute encoder utilization in terms of the number of frames in // backlog, including the current frame encode that is finishing // here. This "backlog" model works as follows: First, assume that all diff --git a/chromium/media/cast/sender/frame_sender.cc b/chromium/media/cast/sender/frame_sender.cc index b8328e80995..775688a85de 100644 --- a/chromium/media/cast/sender/frame_sender.cc +++ b/chromium/media/cast/sender/frame_sender.cc @@ -11,6 +11,7 @@ #include <vector> #include "base/bind.h" +#include "base/logging.h" #include "base/macros.h" #include "base/numerics/safe_conversions.h" #include "base/trace_event/trace_event.h" diff --git a/chromium/media/cast/sender/h264_vt_encoder.cc b/chromium/media/cast/sender/h264_vt_encoder.cc index 9e7a3698fd3..ff4852a20d0 100644 --- a/chromium/media/cast/sender/h264_vt_encoder.cc +++ b/chromium/media/cast/sender/h264_vt_encoder.cc @@ -181,22 +181,17 @@ H264VideoToolboxEncoder::H264VideoToolboxEncoder( weak_factory_.GetWeakPtr(), cast_environment_)); // Register for power state changes. - if (base::PowerMonitor::AddObserver(this)) { - VLOG(1) << "Registered for power state changes."; - } else { - DLOG(WARNING) << "No power monitor. Process suspension will invalidate " - "the encoder."; - } + base::PowerMonitor::AddObserver(this); + VLOG(1) << "Registered for power state changes."; } } H264VideoToolboxEncoder::~H264VideoToolboxEncoder() { DestroyCompressionSession(); - // If video_frame_factory_ is not null, the encoder registered for power state - // changes in the ctor and it must now unregister. - if (video_frame_factory_) - base::PowerMonitor::RemoveObserver(this); + // Unregister the power observer. It is valid to remove an observer that was + // not added. + base::PowerMonitor::RemoveObserver(this); } void H264VideoToolboxEncoder::ResetCompressionSession() { diff --git a/chromium/media/cast/sender/performance_metrics_overlay.cc b/chromium/media/cast/sender/performance_metrics_overlay.cc index d2ebaa1467c..49328234f9c 100644 --- a/chromium/media/cast/sender/performance_metrics_overlay.cc +++ b/chromium/media/cast/sender/performance_metrics_overlay.cc @@ -275,19 +275,16 @@ scoped_refptr<VideoFrame> MaybeRenderPerformanceMetricsOverlay( frame->AddDestructionObserver(base::BindOnce( [](const VideoFrameMetadata* sent_frame_metadata, scoped_refptr<VideoFrame> source_frame) { - source_frame->metadata()->Clear(); - source_frame->metadata()->MergeMetadataFrom(sent_frame_metadata); + source_frame->set_metadata(*sent_frame_metadata); }, frame->metadata(), std::move(source))); // Line 3: Frame duration, resolution, and timestamp. int frame_duration_ms = 0; int frame_duration_ms_frac = 0; - base::TimeDelta frame_duration; - if (frame->metadata()->GetTimeDelta(VideoFrameMetadata::FRAME_DURATION, - &frame_duration)) { + if (frame->metadata()->frame_duration.has_value()) { const int decimilliseconds = base::saturated_cast<int>( - frame_duration.InMicroseconds() / 100.0 + 0.5); + frame->metadata()->frame_duration->InMicroseconds() / 100.0 + 0.5); frame_duration_ms = decimilliseconds / 10; frame_duration_ms_frac = decimilliseconds % 10; } @@ -312,13 +309,13 @@ scoped_refptr<VideoFrame> MaybeRenderPerformanceMetricsOverlay( // Line 2: Capture duration, target playout delay, low-latency mode, and // target bitrate. int capture_duration_ms = 0; - base::TimeTicks capture_begin_time, capture_end_time; - if (frame->metadata()->GetTimeTicks(VideoFrameMetadata::CAPTURE_BEGIN_TIME, - &capture_begin_time) && - frame->metadata()->GetTimeTicks(VideoFrameMetadata::CAPTURE_END_TIME, - &capture_end_time)) { - capture_duration_ms = base::saturated_cast<int>( - (capture_end_time - capture_begin_time).InMillisecondsF() + 0.5); + if (frame->metadata()->capture_begin_time && + frame->metadata()->capture_end_time) { + capture_duration_ms = + base::saturated_cast<int>((*frame->metadata()->capture_end_time - + *frame->metadata()->capture_begin_time) + .InMillisecondsF() + + 0.5); } const int target_playout_delay_ms = static_cast<int>(target_playout_delay.InMillisecondsF() + 0.5); diff --git a/chromium/media/cast/sender/size_adaptable_video_encoder_base.cc b/chromium/media/cast/sender/size_adaptable_video_encoder_base.cc index 9a5fa1e0cb5..03b76b76ecd 100644 --- a/chromium/media/cast/sender/size_adaptable_video_encoder_base.cc +++ b/chromium/media/cast/sender/size_adaptable_video_encoder_base.cc @@ -8,6 +8,7 @@ #include "base/bind.h" #include "base/location.h" +#include "base/logging.h" #include "media/base/video_frame.h" namespace media { diff --git a/chromium/media/cast/sender/video_encoder_unittest.cc b/chromium/media/cast/sender/video_encoder_unittest.cc index a0ba87508f0..b729a8f9b92 100644 --- a/chromium/media/cast/sender/video_encoder_unittest.cc +++ b/chromium/media/cast/sender/video_encoder_unittest.cc @@ -12,6 +12,7 @@ #include "base/bind.h" #include "base/callback_helpers.h" +#include "base/logging.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" diff --git a/chromium/media/cast/sender/video_sender.cc b/chromium/media/cast/sender/video_sender.cc index dc3798be28a..18d28106c2c 100644 --- a/chromium/media/cast/sender/video_sender.cc +++ b/chromium/media/cast/sender/video_sender.cc @@ -63,12 +63,12 @@ void LogVideoCaptureTimestamps(CastEnvironment* cast_environment, capture_end_event->width = video_frame.visible_rect().width(); capture_end_event->height = video_frame.visible_rect().height(); - if (!video_frame.metadata()->GetTimeTicks( - media::VideoFrameMetadata::CAPTURE_BEGIN_TIME, - &capture_begin_event->timestamp) || - !video_frame.metadata()->GetTimeTicks( - media::VideoFrameMetadata::CAPTURE_END_TIME, - &capture_end_event->timestamp)) { + if (video_frame.metadata()->capture_begin_time.has_value() && + video_frame.metadata()->capture_end_time.has_value()) { + capture_begin_event->timestamp = + *video_frame.metadata()->capture_begin_time; + capture_end_event->timestamp = *video_frame.metadata()->capture_end_time; + } else { // The frame capture timestamps were not provided by the video capture // source. Simply log the events as happening right now. capture_begin_event->timestamp = capture_end_event->timestamp = @@ -147,14 +147,13 @@ void VideoSender::InsertRawVideoFrame( (reference_time - base::TimeTicks()).InMicroseconds(), "rtp_timestamp", rtp_timestamp.lower_32_bits()); - bool low_latency_mode; - if (video_frame->metadata()->GetBoolean( - VideoFrameMetadata::INTERACTIVE_CONTENT, &low_latency_mode)) { - if (low_latency_mode && !low_latency_mode_) { + { + bool new_low_latency_mode = video_frame->metadata()->interactive_content; + if (new_low_latency_mode && !low_latency_mode_) { VLOG(1) << "Interactive mode playout time " << min_playout_delay_; playout_delay_change_cb_.Run(min_playout_delay_); } - low_latency_mode_ = low_latency_mode; + low_latency_mode_ = new_low_latency_mode; } // Drop the frame if either its RTP or reference timestamp is not an increase @@ -327,10 +326,10 @@ void VideoSender::OnEncodedVideoFrame( // Key frames are artificially capped to 1.0 because their actual // utilization is atypical compared to the other frames in the stream, and // this can misguide the producer of the input video frames. - video_frame->metadata()->SetDouble( - media::VideoFrameMetadata::RESOURCE_UTILIZATION, - encoded_frame->dependency == EncodedFrame::KEY ? - std::min(1.0, attenuated_utilization) : attenuated_utilization); + video_frame->metadata()->resource_utilization = + encoded_frame->dependency == EncodedFrame::KEY + ? std::min(1.0, attenuated_utilization) + : attenuated_utilization; } SendEncodedFrame(encoder_bitrate, std::move(encoded_frame)); diff --git a/chromium/media/cast/sender/video_sender_unittest.cc b/chromium/media/cast/sender/video_sender_unittest.cc index e97396f68d0..b783fb03f33 100644 --- a/chromium/media/cast/sender/video_sender_unittest.cc +++ b/chromium/media/cast/sender/video_sender_unittest.cc @@ -11,6 +11,7 @@ #include <vector> #include "base/bind.h" +#include "base/logging.h" #include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/test/simple_test_tick_clock.h" @@ -572,23 +573,20 @@ TEST_F(VideoSenderTest, PopulatesResourceUtilizationInFrameMetadata) { for (int i = 0; i < 3; ++i) { scoped_refptr<media::VideoFrame> video_frame = GetNewVideoFrame(); - ASSERT_FALSE(video_frame->metadata()->HasKey( - media::VideoFrameMetadata::RESOURCE_UTILIZATION)); + ASSERT_FALSE(video_frame->metadata()->resource_utilization.has_value()); const base::TimeTicks reference_time = testing_clock_.NowTicks(); video_sender_->InsertRawVideoFrame(video_frame, reference_time); // Run encode tasks. VideoSender::OnEncodedVideoFrame() will be called once // encoding of the frame is complete, and this is when the - // RESOURCE_UTILIZATION metadata is populated. + // resource_utilization metadata is populated. RunTasks(33); - // Check that the RESOURCE_UTILIZATION value is set and non-negative. Don't + // Check that the resource_utilization value is set and non-negative. Don't // check for specific values because they are dependent on real-world CPU // encode time, which can vary across test runs. - double utilization = -1.0; - EXPECT_TRUE(video_frame->metadata()->GetDouble( - media::VideoFrameMetadata::RESOURCE_UTILIZATION, &utilization)); + double utilization = *video_frame->metadata()->resource_utilization; EXPECT_LE(0.0, utilization); if (i == 0) EXPECT_GE(1.0, utilization); // Key frames never exceed 1.0. diff --git a/chromium/media/cast/sender/vp8_encoder.cc b/chromium/media/cast/sender/vp8_encoder.cc index 8d7794ffa56..2ef3a9d9247 100644 --- a/chromium/media/cast/sender/vp8_encoder.cc +++ b/chromium/media/cast/sender/vp8_encoder.cc @@ -231,11 +231,9 @@ void Vp8Encoder::Encode(scoped_refptr<media::VideoFrame> video_frame, const base::TimeDelta maximum_frame_duration = base::TimeDelta::FromSecondsD(static_cast<double>(kRestartFramePeriods) / cast_config_.max_frame_rate); - base::TimeDelta predicted_frame_duration; - if (!video_frame->metadata()->GetTimeDelta( - media::VideoFrameMetadata::FRAME_DURATION, - &predicted_frame_duration) || - predicted_frame_duration <= base::TimeDelta()) { + base::TimeDelta predicted_frame_duration = + video_frame->metadata()->frame_duration.value_or(base::TimeDelta()); + if (predicted_frame_duration <= base::TimeDelta()) { // The source of the video frame did not provide the frame duration. Use // the actual amount of time between the current and previous frame as a // prediction for the next frame's duration. |