diff options
Diffstat (limited to 'chromium/media/formats')
70 files changed, 339 insertions, 240 deletions
diff --git a/chromium/media/formats/common/offset_byte_queue.h b/chromium/media/formats/common/offset_byte_queue.h index eb0bd2c58e7..ea5017b7230 100644 --- a/chromium/media/formats/common/offset_byte_queue.h +++ b/chromium/media/formats/common/offset_byte_queue.h @@ -20,6 +20,10 @@ namespace media { class MEDIA_EXPORT OffsetByteQueue { public: OffsetByteQueue(); + + OffsetByteQueue(const OffsetByteQueue&) = delete; + OffsetByteQueue& operator=(const OffsetByteQueue&) = delete; + ~OffsetByteQueue(); // These work like their underlying ByteQueue counterparts. @@ -59,8 +63,6 @@ class MEDIA_EXPORT OffsetByteQueue { const uint8_t* buf_; int size_; int64_t head_; - - DISALLOW_COPY_AND_ASSIGN(OffsetByteQueue); }; } // namespace media diff --git a/chromium/media/formats/common/stream_parser_test_base.h b/chromium/media/formats/common/stream_parser_test_base.h index fc47ccc5343..43feeb847cb 100644 --- a/chromium/media/formats/common/stream_parser_test_base.h +++ b/chromium/media/formats/common/stream_parser_test_base.h @@ -24,6 +24,10 @@ namespace media { class StreamParserTestBase { public: explicit StreamParserTestBase(std::unique_ptr<StreamParser> stream_parser); + + StreamParserTestBase(const StreamParserTestBase&) = delete; + StreamParserTestBase& operator=(const StreamParserTestBase&) = delete; + virtual ~StreamParserTestBase(); protected: @@ -71,8 +75,6 @@ class StreamParserTestBase { std::stringstream results_stream_; AudioDecoderConfig last_audio_config_; StreamParser::TrackId audio_track_id_; - - DISALLOW_COPY_AND_ASSIGN(StreamParserTestBase); }; } // namespace media diff --git a/chromium/media/formats/mp2t/es_adapter_video.cc b/chromium/media/formats/mp2t/es_adapter_video.cc index 88bdecc667f..eb181aa342b 100644 --- a/chromium/media/formats/mp2t/es_adapter_video.cc +++ b/chromium/media/formats/mp2t/es_adapter_video.cc @@ -32,8 +32,7 @@ EsAdapterVideo::EsAdapterVideo(NewVideoConfigCB new_video_config_cb, emit_buffer_cb_(std::move(emit_buffer_cb)), has_valid_config_(false), has_valid_frame_(false), - last_frame_duration_( - base::TimeDelta::FromMilliseconds(kDefaultFrameDurationMs)), + last_frame_duration_(base::Milliseconds(kDefaultFrameDurationMs)), buffer_index_(0), has_valid_initial_timestamp_(false), discarded_frame_count_(0) {} @@ -49,8 +48,7 @@ void EsAdapterVideo::Reset() { has_valid_config_ = false; has_valid_frame_ = false; - last_frame_duration_ = - base::TimeDelta::FromMilliseconds(kDefaultFrameDurationMs); + last_frame_duration_ = base::Milliseconds(kDefaultFrameDurationMs); config_list_.clear(); buffer_index_ = 0; diff --git a/chromium/media/formats/mp2t/es_adapter_video.h b/chromium/media/formats/mp2t/es_adapter_video.h index 60193351864..eca870c7975 100644 --- a/chromium/media/formats/mp2t/es_adapter_video.h +++ b/chromium/media/formats/mp2t/es_adapter_video.h @@ -40,6 +40,10 @@ class MEDIA_EXPORT EsAdapterVideo { EsAdapterVideo(NewVideoConfigCB new_video_config_cb, EmitBufferCB emit_buffer_cb); + + EsAdapterVideo(const EsAdapterVideo&) = delete; + EsAdapterVideo& operator=(const EsAdapterVideo&) = delete; + ~EsAdapterVideo(); // Force the emission of the pending video buffers. @@ -95,8 +99,6 @@ class MEDIA_EXPORT EsAdapterVideo { // Number of frames to replace with the first valid key frame. int discarded_frame_count_; - - DISALLOW_COPY_AND_ASSIGN(EsAdapterVideo); }; } // namespace mp2t diff --git a/chromium/media/formats/mp2t/es_adapter_video_unittest.cc b/chromium/media/formats/mp2t/es_adapter_video_unittest.cc index 8043605d4d0..30fe18c3e9e 100644 --- a/chromium/media/formats/mp2t/es_adapter_video_unittest.cc +++ b/chromium/media/formats/mp2t/es_adapter_video_unittest.cc @@ -31,10 +31,11 @@ VideoDecoderConfig CreateFakeVideoConfig() { gfx::Size coded_size(320, 240); gfx::Rect visible_rect(0, 0, 320, 240); gfx::Size natural_size(320, 240); - return VideoDecoderConfig( - kCodecH264, H264PROFILE_MAIN, VideoDecoderConfig::AlphaMode::kIsOpaque, - VideoColorSpace(), kNoTransformation, coded_size, visible_rect, - natural_size, EmptyExtraData(), EncryptionScheme::kUnencrypted); + return VideoDecoderConfig(VideoCodec::kH264, H264PROFILE_MAIN, + VideoDecoderConfig::AlphaMode::kIsOpaque, + VideoColorSpace(), kNoTransformation, coded_size, + visible_rect, natural_size, EmptyExtraData(), + EncryptionScheme::kUnencrypted); } BufferQueue GenerateFakeBuffers(const int* frame_pts_ms, @@ -50,8 +51,7 @@ BufferQueue GenerateFakeBuffers(const int* frame_pts_ms, if (frame_pts_ms[k] < 0) { buffers[k]->set_timestamp(kNoTimestamp); } else { - buffers[k]->set_timestamp( - base::TimeDelta::FromMilliseconds(frame_pts_ms[k])); + buffers[k]->set_timestamp(base::Milliseconds(frame_pts_ms[k])); } } return buffers; diff --git a/chromium/media/formats/mp2t/es_parser.h b/chromium/media/formats/mp2t/es_parser.h index 2cca8db0f4a..75f7060c97e 100644 --- a/chromium/media/formats/mp2t/es_parser.h +++ b/chromium/media/formats/mp2t/es_parser.h @@ -33,6 +33,10 @@ class MEDIA_EXPORT EsParser { using GetDecryptConfigCB = base::RepeatingCallback<const DecryptConfig*()>; EsParser(); + + EsParser(const EsParser&) = delete; + EsParser& operator=(const EsParser&) = delete; + virtual ~EsParser(); // ES parsing. @@ -87,8 +91,6 @@ class MEDIA_EXPORT EsParser { // present in the PES packet header, it shall refer to the first AVC access // unit that commences in this PES packet. std::list<std::pair<int64_t, TimingDesc>> timing_desc_list_; - - DISALLOW_COPY_AND_ASSIGN(EsParser); }; } // namespace mp2t diff --git a/chromium/media/formats/mp2t/es_parser_adts.cc b/chromium/media/formats/mp2t/es_parser_adts.cc index 91470b75d25..a484ee338c0 100644 --- a/chromium/media/formats/mp2t/es_parser_adts.cc +++ b/chromium/media/formats/mp2t/es_parser_adts.cc @@ -263,8 +263,8 @@ bool EsParserAdts::UpdateAudioConfiguration(const uint8_t* adts_header, scheme = init_encryption_scheme_; #endif AudioDecoderConfig audio_decoder_config( - kCodecAAC, kSampleFormatS16, channel_layout, extended_samples_per_second, - extra_data, scheme); + AudioCodec::kAAC, kSampleFormatS16, channel_layout, + extended_samples_per_second, extra_data, scheme); if (!audio_decoder_config.IsValidConfig()) { DVLOG(1) << "Invalid config: " diff --git a/chromium/media/formats/mp2t/es_parser_adts.h b/chromium/media/formats/mp2t/es_parser_adts.h index 665ec3f7794..2521f277cdc 100644 --- a/chromium/media/formats/mp2t/es_parser_adts.h +++ b/chromium/media/formats/mp2t/es_parser_adts.h @@ -44,6 +44,9 @@ class MEDIA_EXPORT EsParserAdts : public EsParser { bool sbr_in_mimetype); #endif + EsParserAdts(const EsParserAdts&) = delete; + EsParserAdts& operator=(const EsParserAdts&) = delete; + ~EsParserAdts() override; // EsParser implementation. @@ -98,8 +101,6 @@ class MEDIA_EXPORT EsParserAdts : public EsParser { AudioDecoderConfig last_audio_decoder_config_; ADTSStreamParser adts_parser_; - - DISALLOW_COPY_AND_ASSIGN(EsParserAdts); }; } // namespace mp2t diff --git a/chromium/media/formats/mp2t/es_parser_adts_unittest.cc b/chromium/media/formats/mp2t/es_parser_adts_unittest.cc index 5dbc26428c8..b542b255825 100644 --- a/chromium/media/formats/mp2t/es_parser_adts_unittest.cc +++ b/chromium/media/formats/mp2t/es_parser_adts_unittest.cc @@ -60,7 +60,7 @@ TEST_F(EsParserAdtsTest, SinglePts) { LoadStream("bear.adts"); std::vector<Packet> pes_packets = GenerateFixedSizePesPacket(512); - pes_packets.front().pts = base::TimeDelta::FromSeconds(10); + pes_packets.front().pts = base::Seconds(10); EXPECT_TRUE(Process(pes_packets, false /* sbr_in_mimetype */)); EXPECT_EQ(1u, config_count_); @@ -70,7 +70,7 @@ TEST_F(EsParserAdtsTest, SinglePts) { TEST_F(EsParserAdtsTest, AacLcAdts) { LoadStream("sfx.adts"); std::vector<Packet> pes_packets = GenerateFixedSizePesPacket(512); - pes_packets.front().pts = base::TimeDelta::FromSeconds(1); + pes_packets.front().pts = base::Seconds(1); EXPECT_TRUE(Process(pes_packets, false /* sbr_in_mimetype */)); EXPECT_EQ(1u, config_count_); EXPECT_EQ(14u, buffer_count_); @@ -80,7 +80,7 @@ TEST_F(EsParserAdtsTest, AacSampleRate) { std::vector<Packet> pes_packets = LoadPacketsFromFiles("aac-44100-packet-%d", 4); - pes_packets.front().pts = base::TimeDelta::FromSeconds(0); + pes_packets.front().pts = base::Seconds(0); EXPECT_TRUE(Process(pes_packets, true /* sbr_in_mimetype */)); EXPECT_EQ(4u, buffer_count_); EXPECT_EQ(kAac44100PacketTimestamp, buffer_timestamps_); diff --git a/chromium/media/formats/mp2t/es_parser_h264.cc b/chromium/media/formats/mp2t/es_parser_h264.cc index a00a90cad5f..eeae824558d 100644 --- a/chromium/media/formats/mp2t/es_parser_h264.cc +++ b/chromium/media/formats/mp2t/es_parser_h264.cc @@ -517,7 +517,7 @@ bool EsParserH264::UpdateVideoDecoderConfig(const H264SPS* sps, } VideoDecoderConfig video_decoder_config( - kCodecH264, profile, VideoDecoderConfig::AlphaMode::kIsOpaque, + VideoCodec::kH264, profile, VideoDecoderConfig::AlphaMode::kIsOpaque, VideoColorSpace::REC709(), kNoTransformation, coded_size.value(), visible_rect.value(), natural_size, EmptyExtraData(), scheme); diff --git a/chromium/media/formats/mp2t/es_parser_h264.h b/chromium/media/formats/mp2t/es_parser_h264.h index 4a771af3bd2..4c599c8a886 100644 --- a/chromium/media/formats/mp2t/es_parser_h264.h +++ b/chromium/media/formats/mp2t/es_parser_h264.h @@ -50,6 +50,10 @@ class MEDIA_EXPORT EsParserH264 : public EsParser { EncryptionScheme init_encryption_scheme, const GetDecryptConfigCB& get_decrypt_config_cb); #endif + + EsParserH264(const EsParserH264&) = delete; + EsParserH264& operator=(const EsParserH264&) = delete; + ~EsParserH264() override; // EsParser implementation. @@ -95,8 +99,6 @@ class MEDIA_EXPORT EsParserH264 : public EsParser { // Last video decoder config. VideoDecoderConfig last_video_decoder_config_; - - DISALLOW_COPY_AND_ASSIGN(EsParserH264); }; } // namespace mp2t diff --git a/chromium/media/formats/mp2t/es_parser_h264_unittest.cc b/chromium/media/formats/mp2t/es_parser_h264_unittest.cc index 05f57751b88..b84ac5d42cc 100644 --- a/chromium/media/formats/mp2t/es_parser_h264_unittest.cc +++ b/chromium/media/formats/mp2t/es_parser_h264_unittest.cc @@ -64,7 +64,7 @@ void EsParserH264Test::LoadH264Stream(const char* filename) { // Generate some timestamps based on a 25fps stream. for (size_t k = 0; k < access_units_.size(); k++) - access_units_[k].pts = base::TimeDelta::FromMilliseconds(k * 40u); + access_units_[k].pts = base::Milliseconds(k * 40u); } void EsParserH264Test::GetAccessUnits() { @@ -143,7 +143,7 @@ void EsParserH264Test::GetPesTimestamps(std::vector<Packet>* pes_packets_ptr) { // a special meaning in EsParserH264. The negative timestamps should be // ultimately discarded by the H264 parser since not relevant. for (size_t k = 0; k < pes_packets.size(); k++) { - (*pes_packets_ptr)[k].pts = base::TimeDelta::FromMilliseconds(-1); + (*pes_packets_ptr)[k].pts = base::Milliseconds(-1); } // Set a valid timestamp for PES packets which include the start diff --git a/chromium/media/formats/mp2t/es_parser_mpeg1audio.cc b/chromium/media/formats/mp2t/es_parser_mpeg1audio.cc index 4cc67f92956..a48a4ba6062 100644 --- a/chromium/media/formats/mp2t/es_parser_mpeg1audio.cc +++ b/chromium/media/formats/mp2t/es_parser_mpeg1audio.cc @@ -170,8 +170,8 @@ bool EsParserMpeg1Audio::UpdateAudioConfiguration( // TODO(damienv): Verify whether Android playback requires the extra data // field for Mpeg1 audio. If yes, we should generate this field. AudioDecoderConfig audio_decoder_config( - kCodecMP3, kSampleFormatS16, header.channel_layout, header.sample_rate, - EmptyExtraData(), EncryptionScheme::kUnencrypted); + AudioCodec::kMP3, kSampleFormatS16, header.channel_layout, + header.sample_rate, EmptyExtraData(), EncryptionScheme::kUnencrypted); if (!audio_decoder_config.IsValidConfig()) { DVLOG(1) << "Invalid config: " diff --git a/chromium/media/formats/mp2t/es_parser_mpeg1audio.h b/chromium/media/formats/mp2t/es_parser_mpeg1audio.h index c367a21ddf6..eda747a2c6f 100644 --- a/chromium/media/formats/mp2t/es_parser_mpeg1audio.h +++ b/chromium/media/formats/mp2t/es_parser_mpeg1audio.h @@ -35,6 +35,10 @@ class MEDIA_EXPORT EsParserMpeg1Audio : public EsParser { EsParserMpeg1Audio(const NewAudioConfigCB& new_audio_config_cb, EmitBufferCB emit_buffer_cb, MediaLog* media_log); + + EsParserMpeg1Audio(const EsParserMpeg1Audio&) = delete; + EsParserMpeg1Audio& operator=(const EsParserMpeg1Audio&) = delete; + ~EsParserMpeg1Audio() override; // EsParser implementation. @@ -81,8 +85,6 @@ class MEDIA_EXPORT EsParserMpeg1Audio : public EsParser { // Last audio config. AudioDecoderConfig last_audio_decoder_config_; - - DISALLOW_COPY_AND_ASSIGN(EsParserMpeg1Audio); }; } // namespace mp2t diff --git a/chromium/media/formats/mp2t/es_parser_mpeg1audio_unittest.cc b/chromium/media/formats/mp2t/es_parser_mpeg1audio_unittest.cc index 46477bf9487..9965396ab8d 100644 --- a/chromium/media/formats/mp2t/es_parser_mpeg1audio_unittest.cc +++ b/chromium/media/formats/mp2t/es_parser_mpeg1audio_unittest.cc @@ -50,7 +50,7 @@ TEST_F(EsParserMpeg1AudioTest, SinglePts) { LoadStream("sfx.mp3"); std::vector<Packet> pes_packets = GenerateFixedSizePesPacket(512); - pes_packets.front().pts = base::TimeDelta::FromSeconds(10); + pes_packets.front().pts = base::Seconds(10); // Note: there is no parsing of metadata as part of Mpeg2 TS, // so the tag starting at 0x80d with 0x54 0x41 0x47 (ascii for "TAG") diff --git a/chromium/media/formats/mp2t/es_parser_test_base.h b/chromium/media/formats/mp2t/es_parser_test_base.h index 233da6b0346..ef0d5f1669b 100644 --- a/chromium/media/formats/mp2t/es_parser_test_base.h +++ b/chromium/media/formats/mp2t/es_parser_test_base.h @@ -40,6 +40,10 @@ class EsParserTestBase { }; EsParserTestBase(); + + EsParserTestBase(const EsParserTestBase&) = delete; + EsParserTestBase& operator=(const EsParserTestBase&) = delete; + virtual ~EsParserTestBase(); protected: @@ -82,8 +86,6 @@ class EsParserTestBase { private: // Timestamps of buffers generated while parsing the ES stream. std::stringstream buffer_timestamps_stream_; - - DISALLOW_COPY_AND_ASSIGN(EsParserTestBase); }; } // namespace mp2t diff --git a/chromium/media/formats/mp2t/mp2t_stream_parser.cc b/chromium/media/formats/mp2t/mp2t_stream_parser.cc index 3cbc4269f46..a15bef6bb7d 100644 --- a/chromium/media/formats/mp2t/mp2t_stream_parser.cc +++ b/chromium/media/formats/mp2t/mp2t_stream_parser.cc @@ -201,13 +201,13 @@ Mp2tStreamParser::Mp2tStreamParser(base::span<const std::string> allowed_codecs, segment_started_(false) { for (const std::string& codec_name : allowed_codecs) { switch (StringToVideoCodec(codec_name)) { - case VideoCodec::kCodecH264: + case VideoCodec::kH264: allowed_stream_types_.insert(kStreamTypeAVC); #if BUILDFLAG(ENABLE_HLS_SAMPLE_AES) allowed_stream_types_.insert(kStreamTypeAVCWithSampleAES); #endif continue; - case VideoCodec::kUnknownVideoCodec: + case VideoCodec::kUnknown: // Probably audio. break; default: @@ -216,17 +216,17 @@ Mp2tStreamParser::Mp2tStreamParser(base::span<const std::string> allowed_codecs, } switch (StringToAudioCodec(codec_name)) { - case AudioCodec::kCodecAAC: + case AudioCodec::kAAC: allowed_stream_types_.insert(kStreamTypeAAC); #if BUILDFLAG(ENABLE_HLS_SAMPLE_AES) allowed_stream_types_.insert(kStreamTypeAACWithSampleAES); #endif continue; - case AudioCodec::kCodecMP3: + case AudioCodec::kMP3: allowed_stream_types_.insert(kStreamTypeMpeg1Audio); allowed_stream_types_.insert(kStreamTypeMpeg2Audio); continue; - case AudioCodec::kUnknownAudioCodec: + case AudioCodec::kUnknown: // Neither audio, nor video. break; default: diff --git a/chromium/media/formats/mp2t/mp2t_stream_parser.h b/chromium/media/formats/mp2t/mp2t_stream_parser.h index 5fc3fa70cf9..84a8cb00d44 100644 --- a/chromium/media/formats/mp2t/mp2t_stream_parser.h +++ b/chromium/media/formats/mp2t/mp2t_stream_parser.h @@ -38,6 +38,10 @@ class MEDIA_EXPORT Mp2tStreamParser : public StreamParser { public: explicit Mp2tStreamParser(base::span<const std::string> allowed_codecs, bool sbr_in_mimetype); + + Mp2tStreamParser(const Mp2tStreamParser&) = delete; + Mp2tStreamParser& operator=(const Mp2tStreamParser&) = delete; + ~Mp2tStreamParser() override; // StreamParser implementation. @@ -185,8 +189,6 @@ class MEDIA_EXPORT Mp2tStreamParser : public StreamParser { // provide a better way to access the last values seen in a ECM packet. std::unique_ptr<DecryptConfig> decrypt_config_; #endif - - DISALLOW_COPY_AND_ASSIGN(Mp2tStreamParser); }; } // namespace mp2t diff --git a/chromium/media/formats/mp2t/mp2t_stream_parser_unittest.cc b/chromium/media/formats/mp2t/mp2t_stream_parser_unittest.cc index 89ae1025d15..368b86edce7 100644 --- a/chromium/media/formats/mp2t/mp2t_stream_parser_unittest.cc +++ b/chromium/media/formats/mp2t/mp2t_stream_parser_unittest.cc @@ -55,7 +55,7 @@ bool IsMonotonic(const StreamParser::BufferQueue& buffers) { } bool IsAlmostEqual(DecodeTimestamp t0, DecodeTimestamp t1) { - base::TimeDelta kMaxDeviation = base::TimeDelta::FromMilliseconds(5); + base::TimeDelta kMaxDeviation = base::Milliseconds(5); base::TimeDelta diff = t1 - t0; return (diff >= -kMaxDeviation && diff <= kMaxDeviation); } diff --git a/chromium/media/formats/mp2t/timestamp_unroller.h b/chromium/media/formats/mp2t/timestamp_unroller.h index afebde5629f..062ecd66d9d 100644 --- a/chromium/media/formats/mp2t/timestamp_unroller.h +++ b/chromium/media/formats/mp2t/timestamp_unroller.h @@ -16,6 +16,10 @@ namespace mp2t { class MEDIA_EXPORT TimestampUnroller { public: TimestampUnroller(); + + TimestampUnroller(const TimestampUnroller&) = delete; + TimestampUnroller& operator=(const TimestampUnroller&) = delete; + ~TimestampUnroller(); // Given that |timestamp| is coded using 33 bits (accuracy of MPEG-2 TS @@ -38,8 +42,6 @@ class MEDIA_EXPORT TimestampUnroller { // This is the last output of GetUnrolledTimestamp. int64_t previous_unrolled_timestamp_; - - DISALLOW_COPY_AND_ASSIGN(TimestampUnroller); }; } // namespace mp2t diff --git a/chromium/media/formats/mp2t/ts_packet.h b/chromium/media/formats/mp2t/ts_packet.h index 3918cc1c856..963e2b6cdda 100644 --- a/chromium/media/formats/mp2t/ts_packet.h +++ b/chromium/media/formats/mp2t/ts_packet.h @@ -28,6 +28,9 @@ class TsPacket { // Return NULL otherwise. static TsPacket* Parse(const uint8_t* buf, int size); + TsPacket(const TsPacket&) = delete; + TsPacket& operator=(const TsPacket&) = delete; + ~TsPacket(); // TS header accessors. @@ -64,8 +67,6 @@ class TsPacket { // Params from the adaptation field. bool discontinuity_indicator_; bool random_access_indicator_; - - DISALLOW_COPY_AND_ASSIGN(TsPacket); }; } // namespace mp2t diff --git a/chromium/media/formats/mp2t/ts_section_cat.h b/chromium/media/formats/mp2t/ts_section_cat.h index 69ef68714e9..9c737b04d61 100644 --- a/chromium/media/formats/mp2t/ts_section_cat.h +++ b/chromium/media/formats/mp2t/ts_section_cat.h @@ -22,6 +22,10 @@ class TsSectionCat : public TsSectionPsi { base::RepeatingCallback<void(EncryptionScheme)>; TsSectionCat(const RegisterCencPidsCB& register_cenc_ids_cb, const RegisterEncryptionSchemeCB& register_encryption_scheme_cb); + + TsSectionCat(const TsSectionCat&) = delete; + TsSectionCat& operator=(const TsSectionCat&) = delete; + ~TsSectionCat() override; // TsSectionPsi implementation. @@ -34,8 +38,6 @@ class TsSectionCat : public TsSectionPsi { // Parameters from the CAT. int version_number_; - - DISALLOW_COPY_AND_ASSIGN(TsSectionCat); }; } // namespace mp2t diff --git a/chromium/media/formats/mp2t/ts_section_cets_ecm.h b/chromium/media/formats/mp2t/ts_section_cets_ecm.h index d2fb53414cf..ad9a0b34630 100644 --- a/chromium/media/formats/mp2t/ts_section_cets_ecm.h +++ b/chromium/media/formats/mp2t/ts_section_cets_ecm.h @@ -29,6 +29,10 @@ class TsSectionCetsEcm : public TsSection { explicit TsSectionCetsEcm( const RegisterNewKeyIdAndIvCB& register_new_key_id_and_iv_cb); + + TsSectionCetsEcm(const TsSectionCetsEcm&) = delete; + TsSectionCetsEcm& operator=(const TsSectionCetsEcm&) = delete; + ~TsSectionCetsEcm() override; // TsSection implementation. @@ -40,8 +44,6 @@ class TsSectionCetsEcm : public TsSection { private: RegisterNewKeyIdAndIvCB register_new_key_id_and_iv_cb_; - - DISALLOW_COPY_AND_ASSIGN(TsSectionCetsEcm); }; } // namespace mp2t diff --git a/chromium/media/formats/mp2t/ts_section_cets_pssh.h b/chromium/media/formats/mp2t/ts_section_cets_pssh.h index b4803068891..43c1a26580d 100644 --- a/chromium/media/formats/mp2t/ts_section_cets_pssh.h +++ b/chromium/media/formats/mp2t/ts_section_cets_pssh.h @@ -22,6 +22,10 @@ class TsSectionCetsPssh : public TsSection { base::RepeatingCallback<void(const std::vector<uint8_t>&)>; explicit TsSectionCetsPssh(RegisterPsshBoxesCB register_pssh_boxes_cb); + + TsSectionCetsPssh(const TsSectionCetsPssh&) = delete; + TsSectionCetsPssh& operator=(const TsSectionCetsPssh&) = delete; + ~TsSectionCetsPssh() override; // TsSection implementation. @@ -33,8 +37,6 @@ class TsSectionCetsPssh : public TsSection { private: const RegisterPsshBoxesCB register_pssh_boxes_cb_; - - DISALLOW_COPY_AND_ASSIGN(TsSectionCetsPssh); }; } // namespace mp2t diff --git a/chromium/media/formats/mp2t/ts_section_pat.h b/chromium/media/formats/mp2t/ts_section_pat.h index f5ad9e87848..d834d5e9312 100644 --- a/chromium/media/formats/mp2t/ts_section_pat.h +++ b/chromium/media/formats/mp2t/ts_section_pat.h @@ -19,6 +19,10 @@ class TsSectionPat : public TsSectionPsi { using RegisterPmtCB = base::RepeatingCallback<void(int, int)>; explicit TsSectionPat(RegisterPmtCB register_pmt_cb); + + TsSectionPat(const TsSectionPat&) = delete; + TsSectionPat& operator=(const TsSectionPat&) = delete; + ~TsSectionPat() override; // TsSectionPsi implementation. @@ -30,8 +34,6 @@ class TsSectionPat : public TsSectionPsi { // Parameters from the PAT. int version_number_; - - DISALLOW_COPY_AND_ASSIGN(TsSectionPat); }; } // namespace mp2t diff --git a/chromium/media/formats/mp2t/ts_section_pes.cc b/chromium/media/formats/mp2t/ts_section_pes.cc index 9cd704e71a3..e2012daa06a 100644 --- a/chromium/media/formats/mp2t/ts_section_pes.cc +++ b/chromium/media/formats/mp2t/ts_section_pes.cc @@ -227,7 +227,7 @@ bool TsSectionPes::ParseInternal(const uint8_t* raw_pes, int raw_pes_size) { if (is_pts_valid) { int64_t pts = timestamp_unroller_->GetUnrolledTimestamp( ConvertTimestampSectionToTimestamp(pts_section)); - media_pts = base::TimeDelta::FromMicroseconds((1000 * pts) / 90); + media_pts = base::Microseconds((1000 * pts) / 90); } if (is_dts_valid) { int64_t dts = timestamp_unroller_->GetUnrolledTimestamp( diff --git a/chromium/media/formats/mp2t/ts_section_pes.h b/chromium/media/formats/mp2t/ts_section_pes.h index 405fd3b74de..08ae1afa3d6 100644 --- a/chromium/media/formats/mp2t/ts_section_pes.h +++ b/chromium/media/formats/mp2t/ts_section_pes.h @@ -24,6 +24,10 @@ class TsSectionPes : public TsSection { public: TsSectionPes(std::unique_ptr<EsParser> es_parser, TimestampUnroller* timestamp_unroller); + + TsSectionPes(const TsSectionPes&) = delete; + TsSectionPes& operator=(const TsSectionPes&) = delete; + ~TsSectionPes() override; // TsSection implementation. @@ -56,8 +60,6 @@ class TsSectionPes : public TsSection { // Used to unroll PTS and DTS. TimestampUnroller* const timestamp_unroller_; - - DISALLOW_COPY_AND_ASSIGN(TsSectionPes); }; } // namespace mp2t diff --git a/chromium/media/formats/mp2t/ts_section_pmt.h b/chromium/media/formats/mp2t/ts_section_pmt.h index e36930781fe..10235867a53 100644 --- a/chromium/media/formats/mp2t/ts_section_pmt.h +++ b/chromium/media/formats/mp2t/ts_section_pmt.h @@ -22,6 +22,10 @@ class TsSectionPmt : public TsSectionPsi { void(int pes_pid, int stream_type, const Descriptors& descriptors)>; explicit TsSectionPmt(RegisterPesCB register_pes_cb); + + TsSectionPmt(const TsSectionPmt&) = delete; + TsSectionPmt& operator=(const TsSectionPmt&) = delete; + ~TsSectionPmt() override; // Mpeg2TsPsiParser implementation. @@ -30,8 +34,6 @@ class TsSectionPmt : public TsSectionPsi { private: const RegisterPesCB register_pes_cb_; - - DISALLOW_COPY_AND_ASSIGN(TsSectionPmt); }; } // namespace mp2t diff --git a/chromium/media/formats/mp2t/ts_section_psi.h b/chromium/media/formats/mp2t/ts_section_psi.h index 7da1cca977e..25c2110e73b 100644 --- a/chromium/media/formats/mp2t/ts_section_psi.h +++ b/chromium/media/formats/mp2t/ts_section_psi.h @@ -21,6 +21,10 @@ namespace mp2t { class TsSectionPsi : public TsSection { public: TsSectionPsi(); + + TsSectionPsi(const TsSectionPsi&) = delete; + TsSectionPsi& operator=(const TsSectionPsi&) = delete; + ~TsSectionPsi() override; // TsSection implementation. @@ -47,8 +51,6 @@ class TsSectionPsi : public TsSection { // Number of leading bytes to discard (pointer field). int leading_bytes_to_discard_; - - DISALLOW_COPY_AND_ASSIGN(TsSectionPsi); }; } // namespace mp2t diff --git a/chromium/media/formats/mp4/aac.cc b/chromium/media/formats/mp4/aac.cc index ca92ff81a8c..7742a469567 100644 --- a/chromium/media/formats/mp4/aac.cc +++ b/chromium/media/formats/mp4/aac.cc @@ -9,7 +9,6 @@ #include <algorithm> #include "base/logging.h" -#include "build/build_config.h" #include "media/base/bit_reader.h" #include "media/formats/mp4/rcheck.h" #include "media/formats/mpeg/adts_constants.h" @@ -29,9 +28,8 @@ AAC::AAC(const AAC& other) = default; AAC::~AAC() = default; bool AAC::Parse(const std::vector<uint8_t>& data, MediaLog* media_log) { -#if defined(OS_ANDROID) codec_specific_data_ = data; -#endif + if (data.empty()) return false; diff --git a/chromium/media/formats/mp4/aac.h b/chromium/media/formats/mp4/aac.h index 3fa403b76c2..301b239f95c 100644 --- a/chromium/media/formats/mp4/aac.h +++ b/chromium/media/formats/mp4/aac.h @@ -9,7 +9,6 @@ #include <vector> -#include "build/build_config.h" #include "media/base/audio_codecs.h" #include "media/base/channel_layout.h" #include "media/base/media_export.h" @@ -60,12 +59,10 @@ class MEDIA_EXPORT AAC { // If known, returns the AudioCodecProfile. AudioCodecProfile GetProfile() const; -#if defined(OS_ANDROID) // Returns the codec specific data needed by android MediaCodec. std::vector<uint8_t> codec_specific_data() const { return codec_specific_data_; } -#endif private: bool SkipDecoderGASpecificConfig(BitReader* bit_reader) const; @@ -78,10 +75,8 @@ class MEDIA_EXPORT AAC { uint8_t frequency_index_; uint8_t channel_config_; -#if defined(OS_ANDROID) // The codec specific data needed by the android MediaCodec. std::vector<uint8_t> codec_specific_data_; -#endif // The following variables store audio configuration information that // can be used by Chromium. They are based on the AAC specific diff --git a/chromium/media/formats/mp4/box_definitions.cc b/chromium/media/formats/mp4/box_definitions.cc index 263e913404b..069f22bcd82 100644 --- a/chromium/media/formats/mp4/box_definitions.cc +++ b/chromium/media/formats/mp4/box_definitions.cc @@ -950,10 +950,16 @@ FourCC ColorParameterInformation::BoxType() const { } bool ColorParameterInformation::Parse(BoxReader* reader) { + fully_parsed = false; + FourCC type; RCHECK(reader->ReadFourCC(&type)); - // TODO: Support 'nclc', 'rICC', and 'prof'. - RCHECK(type == FOURCC_NCLX); + + if (type != FOURCC_NCLX) { + // Ignore currently unsupported color information metadata parsing. + // TODO: Support 'nclc', 'rICC', and 'prof'. + return true; + } uint8_t full_range_byte; RCHECK(reader->Read2(&colour_primaries) && @@ -961,6 +967,7 @@ bool ColorParameterInformation::Parse(BoxReader* reader) { reader->Read2(&matrix_coefficients) && reader->Read1(&full_range_byte)); full_range = full_range_byte & 0x80; + fully_parsed = true; return true; } @@ -1049,7 +1056,7 @@ VideoSampleEntry::VideoSampleEntry() data_reference_index(0), width(0), height(0), - video_codec(kUnknownVideoCodec), + video_codec(VideoCodec::kUnknown), video_codec_profile(VIDEO_CODEC_PROFILE_UNKNOWN), video_codec_level(kNoVideoCodecLevel) {} @@ -1095,7 +1102,7 @@ bool VideoSampleEntry::Parse(BoxReader* reader) { std::unique_ptr<AVCDecoderConfigurationRecord> avcConfig( new AVCDecoderConfigurationRecord()); RCHECK(reader->ReadChild(avcConfig.get())); - video_codec = kCodecH264; + video_codec = VideoCodec::kH264; video_codec_profile = H264Parser::ProfileIDCToVideoCodecProfile( avcConfig->profile_indication); @@ -1106,7 +1113,7 @@ bool VideoSampleEntry::Parse(BoxReader* reader) { auto dv_config = ParseDOVIConfig(reader); if (dv_config.has_value()) { DVLOG(2) << __func__ << " reading DolbyVisionConfiguration (dvcC/dvvC)"; - video_codec = kCodecDolbyVision; + video_codec = VideoCodec::kDolbyVision; video_codec_profile = dv_config->codec_profile; video_codec_level = dv_config->dv_level; } @@ -1120,7 +1127,7 @@ bool VideoSampleEntry::Parse(BoxReader* reader) { std::unique_ptr<HEVCDecoderConfigurationRecord> hevcConfig( new HEVCDecoderConfigurationRecord()); RCHECK(reader->ReadChild(hevcConfig.get())); - video_codec = kCodecHEVC; + video_codec = VideoCodec::kHEVC; video_codec_profile = hevcConfig->GetVideoProfile(); frame_bitstream_converter = base::MakeRefCounted<HEVCBitstreamConverter>(std::move(hevcConfig)); @@ -1129,7 +1136,7 @@ bool VideoSampleEntry::Parse(BoxReader* reader) { auto dv_config = ParseDOVIConfig(reader); if (dv_config.has_value()) { DVLOG(2) << __func__ << " reading DolbyVisionConfiguration (dvcC/dvvC)"; - video_codec = kCodecDolbyVision; + video_codec = VideoCodec::kDolbyVision; video_codec_profile = dv_config->codec_profile; video_codec_level = dv_config->dv_level; } @@ -1150,7 +1157,7 @@ bool VideoSampleEntry::Parse(BoxReader* reader) { DVLOG(2) << __func__ << " reading DolbyVisionConfiguration (dvcC/dvvC)"; auto dv_config = ParseDOVIConfig(reader); RCHECK(dv_config.has_value()); - video_codec = kCodecDolbyVision; + video_codec = VideoCodec::kDolbyVision; video_codec_profile = dv_config->codec_profile; video_codec_level = dv_config->dv_level; break; @@ -1167,7 +1174,7 @@ bool VideoSampleEntry::Parse(BoxReader* reader) { DVLOG(2) << __func__ << " reading DolbyVisionConfiguration (dvcC/dvvC)"; auto dv_config = ParseDOVIConfig(reader); RCHECK(dv_config.has_value()); - video_codec = kCodecDolbyVision; + video_codec = VideoCodec::kDolbyVision; video_codec_profile = dv_config->codec_profile; video_codec_level = dv_config->dv_level; break; @@ -1181,21 +1188,21 @@ bool VideoSampleEntry::Parse(BoxReader* reader) { new VPCodecConfigurationRecord()); RCHECK(reader->ReadChild(vp_config.get())); frame_bitstream_converter = nullptr; - video_codec = kCodecVP9; + video_codec = VideoCodec::kVP9; video_codec_profile = vp_config->profile; video_color_space = vp_config->color_space; video_codec_level = vp_config->level; - SMPTE2086MasteringDisplayMetadataBox mastering_display_color_volume; - if (reader->HasChild(&mastering_display_color_volume)) { - RCHECK(reader->ReadChild(&mastering_display_color_volume)); - this->mastering_display_color_volume = mastering_display_color_volume; + SMPTE2086MasteringDisplayMetadataBox color_volume; + if (reader->HasChild(&color_volume)) { + RCHECK(reader->ReadChild(&color_volume)); + mastering_display_color_volume = color_volume; } - ContentLightLevel content_light_level_information; - if (reader->HasChild(&content_light_level_information)) { - RCHECK(reader->ReadChild(&content_light_level_information)); - this->content_light_level_information = content_light_level_information; + ContentLightLevel level_information; + if (reader->HasChild(&level_information)) { + RCHECK(reader->ReadChild(&level_information)); + content_light_level_information = level_information; } break; } @@ -1205,7 +1212,7 @@ bool VideoSampleEntry::Parse(BoxReader* reader) { AV1CodecConfigurationRecord av1_config; RCHECK(reader->ReadChild(&av1_config)); frame_bitstream_converter = nullptr; - video_codec = kCodecAV1; + video_codec = VideoCodec::kAV1; video_codec_profile = av1_config.profile; break; } @@ -1221,20 +1228,22 @@ bool VideoSampleEntry::Parse(BoxReader* reader) { ColorParameterInformation color_parameter_information; if (reader->HasChild(&color_parameter_information)) { RCHECK(reader->ReadChild(&color_parameter_information)); - video_color_space = ConvertColorParameterInformationToColorSpace( - color_parameter_information); + if (color_parameter_information.fully_parsed) { + video_color_space = ConvertColorParameterInformationToColorSpace( + color_parameter_information); + } } - MasteringDisplayColorVolume mastering_display_color_volume; - if (reader->HasChild(&mastering_display_color_volume)) { - RCHECK(reader->ReadChild(&mastering_display_color_volume)); - this->mastering_display_color_volume = mastering_display_color_volume; + MasteringDisplayColorVolume color_volume; + if (reader->HasChild(&color_volume)) { + RCHECK(reader->ReadChild(&color_volume)); + mastering_display_color_volume = color_volume; } - ContentLightLevelInformation content_light_level_information; - if (reader->HasChild(&content_light_level_information)) { - RCHECK(reader->ReadChild(&content_light_level_information)); - this->content_light_level_information = content_light_level_information; + ContentLightLevelInformation level_information; + if (reader->HasChild(&level_information)) { + RCHECK(reader->ReadChild(&level_information)); + content_light_level_information = level_information; } if (video_codec_profile == VIDEO_CODEC_PROFILE_UNKNOWN) { @@ -1377,8 +1386,7 @@ bool FlacSpecificBox::Parse(BoxReader* reader) { } OpusSpecificBox::OpusSpecificBox() - : seek_preroll(base::TimeDelta::FromMilliseconds(80)), - codec_delay_in_frames(0) {} + : seek_preroll(base::Milliseconds(80)), codec_delay_in_frames(0) {} OpusSpecificBox::OpusSpecificBox(const OpusSpecificBox& other) = default; diff --git a/chromium/media/formats/mp4/box_definitions.h b/chromium/media/formats/mp4/box_definitions.h index 450f3fc43c1..5a307f0476b 100644 --- a/chromium/media/formats/mp4/box_definitions.h +++ b/chromium/media/formats/mp4/box_definitions.h @@ -276,6 +276,7 @@ struct MEDIA_EXPORT ColorParameterInformation : Box { uint16_t transfer_characteristics; uint16_t matrix_coefficients; bool full_range; + bool fully_parsed; }; struct MEDIA_EXPORT MasteringDisplayColorVolume : Box { diff --git a/chromium/media/formats/mp4/h264_annex_b_to_avc_bitstream_converter.h b/chromium/media/formats/mp4/h264_annex_b_to_avc_bitstream_converter.h index f89ac8c4f01..a45b81c42b9 100644 --- a/chromium/media/formats/mp4/h264_annex_b_to_avc_bitstream_converter.h +++ b/chromium/media/formats/mp4/h264_annex_b_to_avc_bitstream_converter.h @@ -24,6 +24,12 @@ namespace media { class MEDIA_EXPORT H264AnnexBToAvcBitstreamConverter { public: H264AnnexBToAvcBitstreamConverter(); + + H264AnnexBToAvcBitstreamConverter(const H264AnnexBToAvcBitstreamConverter&) = + delete; + H264AnnexBToAvcBitstreamConverter& operator=( + const H264AnnexBToAvcBitstreamConverter&) = delete; + ~H264AnnexBToAvcBitstreamConverter(); // Converts a video chunk from a format with in-place decoder configuration @@ -59,8 +65,6 @@ class MEDIA_EXPORT H264AnnexBToAvcBitstreamConverter { int active_sps_id_ = -1; int active_pps_id_ = -1; - - DISALLOW_COPY_AND_ASSIGN(H264AnnexBToAvcBitstreamConverter); }; } // namespace media diff --git a/chromium/media/formats/mp4/mp4_stream_parser.cc b/chromium/media/formats/mp4/mp4_stream_parser.cc index fb83b2ebe59..b5f7b3d6651 100644 --- a/chromium/media/formats/mp4/mp4_stream_parser.cc +++ b/chromium/media/formats/mp4/mp4_stream_parser.cc @@ -345,15 +345,20 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) { return false; } - AudioCodec codec = kUnknownAudioCodec; - AudioCodecProfile profile = AudioCodecProfile::kUnknown; + AudioCodec codec = AudioCodec::kUnknown; ChannelLayout channel_layout = CHANNEL_LAYOUT_NONE; int sample_per_second = 0; int codec_delay_in_frames = 0; base::TimeDelta seek_preroll; std::vector<uint8_t> extra_data; + +#if BUILDFLAG(USE_PROPRIETARY_CODECS) + AudioCodecProfile profile = AudioCodecProfile::kUnknown; + std::vector<uint8_t> aac_extra_data; +#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) + if (audio_format == FOURCC_OPUS) { - codec = kCodecOpus; + codec = AudioCodec::kOpus; channel_layout = GuessChannelLayout(entry.dops.channel_count); sample_per_second = entry.dops.sample_rate; codec_delay_in_frames = entry.dops.codec_delay_in_frames; @@ -369,14 +374,14 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) { return false; } - codec = kCodecFLAC; + codec = AudioCodec::kFLAC; channel_layout = GuessChannelLayout(entry.channelcount); sample_per_second = entry.samplerate; extra_data = entry.dfla.stream_info; #if BUILDFLAG(USE_PROPRIETARY_CODECS) #if BUILDFLAG(ENABLE_PLATFORM_MPEG_H_AUDIO) } else if (audio_format == FOURCC_MHM1 || audio_format == FOURCC_MHA1) { - codec = kCodecMpegHAudio; + codec = AudioCodec::kMpegHAudio; channel_layout = CHANNEL_LAYOUT_BITSTREAM; sample_per_second = entry.samplerate; extra_data = entry.dfla.stream_info; @@ -404,20 +409,24 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) { // supported MPEG2 AAC varients. if (ESDescriptor::IsAAC(audio_type)) { const AAC& aac = entry.esds.aac; - codec = kCodecAAC; + codec = AudioCodec::kAAC; profile = aac.GetProfile(); channel_layout = aac.GetChannelLayout(has_sbr_); sample_per_second = aac.GetOutputSamplesPerSecond(has_sbr_); + // Set `aac_extra_data` on all platforms but only set `extra_data` on + // Android. This is for backward compatibility until we have a better + // solution. See crbug.com/1245123 for details. + aac_extra_data = aac.codec_specific_data(); #if defined(OS_ANDROID) extra_data = aac.codec_specific_data(); -#endif +#endif // defined(OS_ANDROID) #if BUILDFLAG(ENABLE_PLATFORM_AC3_EAC3_AUDIO) } else if (audio_type == kAC3) { - codec = kCodecAC3; + codec = AudioCodec::kAC3; channel_layout = GuessChannelLayout(entry.channelcount); sample_per_second = entry.samplerate; } else if (audio_type == kEAC3) { - codec = kCodecEAC3; + codec = AudioCodec::kEAC3; channel_layout = GuessChannelLayout(entry.channelcount); sample_per_second = entry.samplerate; #endif @@ -458,13 +467,18 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) { if (scheme == EncryptionScheme::kUnencrypted) return false; } + audio_config.Initialize(codec, sample_format, channel_layout, sample_per_second, extra_data, scheme, seek_preroll, codec_delay_in_frames); - if (codec == kCodecAAC) { + +#if BUILDFLAG(USE_PROPRIETARY_CODECS) + if (codec == AudioCodec::kAAC) { audio_config.disable_discard_decoder_delay(); audio_config.set_profile(profile); + audio_config.set_aac_extra_data(std::move(aac_extra_data)); } +#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) DVLOG(1) << "audio_track_id=" << audio_track_id << " config=" << audio_config.AsHumanReadableString(); @@ -806,9 +820,9 @@ ParseResult MP4StreamParser::EnqueueSample(BufferQueueMap* buffers) { std::vector<uint8_t> frame_buf(buf, buf + sample_size); if (video) { - if (runs_->video_description().video_codec == kCodecH264 || - runs_->video_description().video_codec == kCodecHEVC || - runs_->video_description().video_codec == kCodecDolbyVision) { + if (runs_->video_description().video_codec == VideoCodec::kH264 || + runs_->video_description().video_codec == VideoCodec::kHEVC || + runs_->video_description().video_codec == VideoCodec::kDolbyVision) { DCHECK(runs_->video_description().frame_bitstream_converter); BitstreamConverter::AnalysisResult analysis; if (!runs_->video_description() diff --git a/chromium/media/formats/mp4/mp4_stream_parser.h b/chromium/media/formats/mp4/mp4_stream_parser.h index 86ef7467c52..c04afcb7795 100644 --- a/chromium/media/formats/mp4/mp4_stream_parser.h +++ b/chromium/media/formats/mp4/mp4_stream_parser.h @@ -37,6 +37,10 @@ class MEDIA_EXPORT MP4StreamParser : public StreamParser { MP4StreamParser(const std::set<int>& audio_object_types, bool has_sbr, bool has_flac); + + MP4StreamParser(const MP4StreamParser&) = delete; + MP4StreamParser& operator=(const MP4StreamParser&) = delete; + ~MP4StreamParser() override; void Init(InitCB init_cb, @@ -150,8 +154,6 @@ class MEDIA_EXPORT MP4StreamParser : public StreamParser { // Tracks the number of MEDIA_LOGS for video keyframe MP4<->frame mismatch. int num_video_keyframe_mismatches_; - - DISALLOW_COPY_AND_ASSIGN(MP4StreamParser); }; } // namespace mp4 diff --git a/chromium/media/formats/mp4/mp4_stream_parser_unittest.cc b/chromium/media/formats/mp4/mp4_stream_parser_unittest.cc index e5f745cad5b..2c973ffa1ef 100644 --- a/chromium/media/formats/mp4/mp4_stream_parser_unittest.cc +++ b/chromium/media/formats/mp4/mp4_stream_parser_unittest.cc @@ -40,7 +40,6 @@ using ::testing::InSequence; using ::testing::StrictMock; -using base::TimeDelta; namespace media { namespace mp4 { @@ -274,7 +273,7 @@ constexpr char kShakaPackagerUMA[] = "Media.MSE.DetectedShakaPackagerInMp4"; TEST_F(MP4StreamParserTest, DidNotUseShakaPackager) { // Encrypted files have non-zero duration and are treated as recorded streams. auto params = GetDefaultInitParametersExpectations(); - params.duration = base::TimeDelta::FromMicroseconds(2736066); + params.duration = base::Microseconds(2736066); params.liveness = DemuxerStream::LIVENESS_RECORDED; params.detected_audio_track_count = 0; InitializeParserWithInitParametersExpectations(params); @@ -288,7 +287,7 @@ TEST_F(MP4StreamParserTest, DidNotUseShakaPackager) { TEST_F(MP4StreamParserTest, UsedShakaPackager) { auto params = GetDefaultInitParametersExpectations(); - params.duration = base::TimeDelta::FromMicroseconds(2736000); + params.duration = base::Microseconds(2736000); params.liveness = DemuxerStream::LIVENESS_RECORDED; params.detected_audio_track_count = 0; InitializeParserWithInitParametersExpectations(params); @@ -462,7 +461,7 @@ TEST_F(MP4StreamParserTest, MissingSampleEncryptionInfo) { // Encrypted test mp4 files have non-zero duration and are treated as // recorded streams. auto params = GetDefaultInitParametersExpectations(); - params.duration = base::TimeDelta::FromMicroseconds(23219); + params.duration = base::Microseconds(23219); params.liveness = DemuxerStream::LIVENESS_RECORDED; params.detected_video_track_count = 0; InitializeParserWithInitParametersExpectations(params); @@ -490,7 +489,7 @@ TEST_F(MP4StreamParserTest, HEVC_in_MP4_container) { EXPECT_MEDIA_LOG(ErrorLog("Unsupported VisualSampleEntry type hev1")); #endif auto params = GetDefaultInitParametersExpectations(); - params.duration = base::TimeDelta::FromMicroseconds(1002000); + params.duration = base::Microseconds(1002000); params.liveness = DemuxerStream::LIVENESS_RECORDED; params.detected_audio_track_count = 0; InitializeParserWithInitParametersExpectations(params); @@ -499,7 +498,7 @@ TEST_F(MP4StreamParserTest, HEVC_in_MP4_container) { EXPECT_EQ(expect_success, AppendDataInPieces(buffer->data(), buffer->data_size(), 512)); #if BUILDFLAG(ENABLE_PLATFORM_HEVC) - EXPECT_EQ(kCodecHEVC, video_decoder_config_.codec()); + EXPECT_EQ(VideoCodec::kHEVC, video_decoder_config_.codec()); EXPECT_EQ(HEVCPROFILE_MAIN, video_decoder_config_.profile()); #endif } @@ -569,7 +568,7 @@ TEST_F(MP4StreamParserTest, CencWithEncryptionInfoStoredAsAuxDataInMdat) { // Encrypted test mp4 files have non-zero duration and are treated as // recorded streams. auto params = GetDefaultInitParametersExpectations(); - params.duration = base::TimeDelta::FromMicroseconds(2736066); + params.duration = base::Microseconds(2736066); params.liveness = DemuxerStream::LIVENESS_RECORDED; params.detected_audio_track_count = 0; InitializeParserWithInitParametersExpectations(params); @@ -583,7 +582,7 @@ TEST_F(MP4StreamParserTest, CencWithSampleEncryptionBox) { // Encrypted test mp4 files have non-zero duration and are treated as // recorded streams. auto params = GetDefaultInitParametersExpectations(); - params.duration = base::TimeDelta::FromMicroseconds(2736066); + params.duration = base::Microseconds(2736066); params.liveness = DemuxerStream::LIVENESS_RECORDED; params.detected_audio_track_count = 0; InitializeParserWithInitParametersExpectations(params); @@ -595,7 +594,7 @@ TEST_F(MP4StreamParserTest, CencWithSampleEncryptionBox) { TEST_F(MP4StreamParserTest, NaturalSizeWithoutPASP) { auto params = GetDefaultInitParametersExpectations(); - params.duration = base::TimeDelta::FromMicroseconds(1000966); + params.duration = base::Microseconds(1000966); params.liveness = DemuxerStream::LIVENESS_RECORDED; params.detected_audio_track_count = 0; InitializeParserWithInitParametersExpectations(params); @@ -609,7 +608,7 @@ TEST_F(MP4StreamParserTest, NaturalSizeWithoutPASP) { TEST_F(MP4StreamParserTest, NaturalSizeWithPASP) { auto params = GetDefaultInitParametersExpectations(); - params.duration = base::TimeDelta::FromMicroseconds(1000966); + params.duration = base::Microseconds(1000966); params.liveness = DemuxerStream::LIVENESS_RECORDED; params.detected_audio_track_count = 0; InitializeParserWithInitParametersExpectations(params); @@ -634,7 +633,7 @@ TEST_F(MP4StreamParserTest, DemuxingAC3) { #endif auto params = GetDefaultInitParametersExpectations(); - params.duration = base::TimeDelta::FromMicroseconds(1045000); + params.duration = base::Microseconds(1045000); params.liveness = DemuxerStream::LIVENESS_RECORDED; params.detected_video_track_count = 0; InitializeParserWithInitParametersExpectations(params); @@ -658,7 +657,7 @@ TEST_F(MP4StreamParserTest, DemuxingEAC3) { #endif auto params = GetDefaultInitParametersExpectations(); - params.duration = base::TimeDelta::FromMicroseconds(1045000); + params.duration = base::Microseconds(1045000); params.liveness = DemuxerStream::LIVENESS_RECORDED; params.detected_video_track_count = 0; InitializeParserWithInitParametersExpectations(params); @@ -787,7 +786,7 @@ TEST_F(MP4StreamParserTest, TextTrackDetection) { TEST_F(MP4StreamParserTest, MultiTrackFile) { auto params = GetDefaultInitParametersExpectations(); - params.duration = base::TimeDelta::FromMilliseconds(4248); + params.duration = base::Milliseconds(4248); params.liveness = DemuxerStream::LIVENESS_RECORDED; params.detected_audio_track_count = 2; params.detected_video_track_count = 2; diff --git a/chromium/media/formats/mp4/sample_to_group_iterator.h b/chromium/media/formats/mp4/sample_to_group_iterator.h index 4c062007e3c..2675ee5033a 100644 --- a/chromium/media/formats/mp4/sample_to_group_iterator.h +++ b/chromium/media/formats/mp4/sample_to_group_iterator.h @@ -23,6 +23,10 @@ namespace mp4 { class MEDIA_EXPORT SampleToGroupIterator { public: explicit SampleToGroupIterator(const SampleToGroup& sample_to_group); + + SampleToGroupIterator(const SampleToGroupIterator&) = delete; + SampleToGroupIterator& operator=(const SampleToGroupIterator&) = delete; + ~SampleToGroupIterator(); // Advances the iterator to refer to the next sample. Return status @@ -42,8 +46,6 @@ class MEDIA_EXPORT SampleToGroupIterator { uint32_t remaining_samples_; const std::vector<SampleToGroupEntry>& sample_to_group_table_; std::vector<SampleToGroupEntry>::const_iterator iterator_; - - DISALLOW_COPY_AND_ASSIGN(SampleToGroupIterator); }; } // namespace mp4 diff --git a/chromium/media/formats/mp4/track_run_iterator.cc b/chromium/media/formats/mp4/track_run_iterator.cc index 2c8cdc176e7..18ebdae847e 100644 --- a/chromium/media/formats/mp4/track_run_iterator.cc +++ b/chromium/media/formats/mp4/track_run_iterator.cc @@ -115,7 +115,7 @@ base::TimeDelta TimeDeltaFromRational(int64_t numer, int64_t denom) { const int64_t total_microseconds = base::Time::kMicrosecondsPerSecond * result_seconds + result_microseconds; - return base::TimeDelta::FromMicroseconds(total_microseconds); + return base::Microseconds(total_microseconds); } DecodeTimestamp DecodeTimestampFromRational(int64_t numer, int64_t denom) { diff --git a/chromium/media/formats/mp4/track_run_iterator.h b/chromium/media/formats/mp4/track_run_iterator.h index 7ed9f7daca6..d3503ee0288 100644 --- a/chromium/media/formats/mp4/track_run_iterator.h +++ b/chromium/media/formats/mp4/track_run_iterator.h @@ -38,6 +38,10 @@ class MEDIA_EXPORT TrackRunIterator { // Create a new TrackRunIterator. A reference to |moov| will be retained for // the lifetime of this object. TrackRunIterator(const Movie* moov, MediaLog* media_log); + + TrackRunIterator(const TrackRunIterator&) = delete; + TrackRunIterator& operator=(const TrackRunIterator&) = delete; + ~TrackRunIterator(); // Sets up the iterator to handle all the runs from the current fragment. @@ -116,8 +120,6 @@ class MEDIA_EXPORT TrackRunIterator { int64_t sample_dts_; int64_t sample_cts_; int64_t sample_offset_; - - DISALLOW_COPY_AND_ASSIGN(TrackRunIterator); }; } // namespace mp4 diff --git a/chromium/media/formats/mp4/track_run_iterator_unittest.cc b/chromium/media/formats/mp4/track_run_iterator_unittest.cc index f22f865b1fc..a2e80800256 100644 --- a/chromium/media/formats/mp4/track_run_iterator_unittest.cc +++ b/chromium/media/formats/mp4/track_run_iterator_unittest.cc @@ -148,7 +148,7 @@ MATCHER(ReservedValueInSampleDependencyInfo, "") { TEST(TimeDeltaFromRationalTest, RoundsTowardZero) { // In each case, 1.5us should round to 1us. - base::TimeDelta expected = base::TimeDelta::FromMicroseconds(1); + base::TimeDelta expected = base::Microseconds(1); EXPECT_EQ(TimeDeltaFromRational(3, 2000000), expected); EXPECT_EQ(TimeDeltaFromRational(-3, 2000000), -expected); } @@ -160,7 +160,7 @@ TEST(TimeDeltaFromRationalTest, HandlesLargeValues) { // Note: kNoTimestamp is printed as "9.22337e+12 s", which is visually // indistinguishable from |expected|. int64_t seconds = max_seconds - 1; - base::TimeDelta expected = base::TimeDelta::FromSeconds(seconds); + base::TimeDelta expected = base::Seconds(seconds); EXPECT_EQ(TimeDeltaFromRational(seconds, 1), expected); EXPECT_EQ(TimeDeltaFromRational(-seconds, 1), -expected); } diff --git a/chromium/media/formats/mpeg/adts_stream_parser.cc b/chromium/media/formats/mpeg/adts_stream_parser.cc index a47d2242dde..116f536a64d 100644 --- a/chromium/media/formats/mpeg/adts_stream_parser.cc +++ b/chromium/media/formats/mpeg/adts_stream_parser.cc @@ -16,7 +16,7 @@ namespace media { constexpr uint32_t kADTSStartCodeMask = 0xfff00000; ADTSStreamParser::ADTSStreamParser() - : MPEGAudioStreamParserBase(kADTSStartCodeMask, kCodecAAC, 0) {} + : MPEGAudioStreamParserBase(kADTSStartCodeMask, AudioCodec::kAAC, 0) {} ADTSStreamParser::~ADTSStreamParser() = default; diff --git a/chromium/media/formats/mpeg/adts_stream_parser.h b/chromium/media/formats/mpeg/adts_stream_parser.h index 5015c79626b..7284846f2a3 100644 --- a/chromium/media/formats/mpeg/adts_stream_parser.h +++ b/chromium/media/formats/mpeg/adts_stream_parser.h @@ -16,6 +16,10 @@ namespace media { class MEDIA_EXPORT ADTSStreamParser : public MPEGAudioStreamParserBase { public: ADTSStreamParser(); + + ADTSStreamParser(const ADTSStreamParser&) = delete; + ADTSStreamParser& operator=(const ADTSStreamParser&) = delete; + ~ADTSStreamParser() override; // MPEGAudioStreamParserBase overrides. @@ -30,8 +34,6 @@ class MEDIA_EXPORT ADTSStreamParser : public MPEGAudioStreamParserBase { private: size_t adts_parse_error_limit_ = 0; - - DISALLOW_COPY_AND_ASSIGN(ADTSStreamParser); }; } // namespace media diff --git a/chromium/media/formats/mpeg/mpeg1_audio_stream_parser.cc b/chromium/media/formats/mpeg/mpeg1_audio_stream_parser.cc index d12f7cacee4..5b996764f4f 100644 --- a/chromium/media/formats/mpeg/mpeg1_audio_stream_parser.cc +++ b/chromium/media/formats/mpeg/mpeg1_audio_stream_parser.cc @@ -187,7 +187,9 @@ bool MPEG1AudioStreamParser::ParseHeader(MediaLog* media_log, } MPEG1AudioStreamParser::MPEG1AudioStreamParser() - : MPEGAudioStreamParserBase(kMPEG1StartCodeMask, kCodecMP3, kCodecDelay) {} + : MPEGAudioStreamParserBase(kMPEG1StartCodeMask, + AudioCodec::kMP3, + kCodecDelay) {} MPEG1AudioStreamParser::~MPEG1AudioStreamParser() = default; diff --git a/chromium/media/formats/mpeg/mpeg1_audio_stream_parser.h b/chromium/media/formats/mpeg/mpeg1_audio_stream_parser.h index de86e69661a..707e3408ee8 100644 --- a/chromium/media/formats/mpeg/mpeg1_audio_stream_parser.h +++ b/chromium/media/formats/mpeg/mpeg1_audio_stream_parser.h @@ -68,6 +68,10 @@ class MEDIA_EXPORT MPEG1AudioStreamParser : public MPEGAudioStreamParserBase { Header* header); MPEG1AudioStreamParser(); + + MPEG1AudioStreamParser(const MPEG1AudioStreamParser&) = delete; + MPEG1AudioStreamParser& operator=(const MPEG1AudioStreamParser&) = delete; + ~MPEG1AudioStreamParser() override; private: @@ -82,8 +86,6 @@ class MEDIA_EXPORT MPEG1AudioStreamParser : public MPEGAudioStreamParserBase { std::vector<uint8_t>* extra_data) override; size_t mp3_parse_error_limit_ = 0; - - DISALLOW_COPY_AND_ASSIGN(MPEG1AudioStreamParser); }; } // namespace media diff --git a/chromium/media/formats/mpeg/mpeg_audio_stream_parser_base.cc b/chromium/media/formats/mpeg/mpeg_audio_stream_parser_base.cc index 0ea60b26b41..aea794e3dfe 100644 --- a/chromium/media/formats/mpeg/mpeg_audio_stream_parser_base.cc +++ b/chromium/media/formats/mpeg/mpeg_audio_stream_parser_base.cc @@ -213,7 +213,7 @@ int MPEGAudioStreamParserBase::ParseFrame(const uint8_t* data, config_.Initialize(audio_codec_, kSampleFormatF32, channel_layout, sample_rate, extra_data, EncryptionScheme::kUnencrypted, base::TimeDelta(), codec_delay_); - if (audio_codec_ == kCodecAAC) + if (audio_codec_ == AudioCodec::kAAC) config_.disable_discard_decoder_delay(); base::TimeDelta base_timestamp; diff --git a/chromium/media/formats/mpeg/mpeg_audio_stream_parser_base.h b/chromium/media/formats/mpeg/mpeg_audio_stream_parser_base.h index 425d7079aa3..5687e5235f7 100644 --- a/chromium/media/formats/mpeg/mpeg_audio_stream_parser_base.h +++ b/chromium/media/formats/mpeg/mpeg_audio_stream_parser_base.h @@ -31,6 +31,11 @@ class MEDIA_EXPORT MPEGAudioStreamParserBase : public StreamParser { MPEGAudioStreamParserBase(uint32_t start_code_mask, AudioCodec audio_codec, int codec_delay); + + MPEGAudioStreamParserBase(const MPEGAudioStreamParserBase&) = delete; + MPEGAudioStreamParserBase& operator=(const MPEGAudioStreamParserBase&) = + delete; + ~MPEGAudioStreamParserBase() override; // StreamParser implementation. @@ -152,8 +157,6 @@ class MEDIA_EXPORT MPEGAudioStreamParserBase : public StreamParser { const uint32_t start_code_mask_; const AudioCodec audio_codec_; const int codec_delay_; - - DISALLOW_COPY_AND_ASSIGN(MPEGAudioStreamParserBase); }; } // namespace media diff --git a/chromium/media/formats/webcodecs/webcodecs_encoded_chunk_stream_parser.h b/chromium/media/formats/webcodecs/webcodecs_encoded_chunk_stream_parser.h index 85480ab1793..b1f39847108 100644 --- a/chromium/media/formats/webcodecs/webcodecs_encoded_chunk_stream_parser.h +++ b/chromium/media/formats/webcodecs/webcodecs_encoded_chunk_stream_parser.h @@ -24,6 +24,12 @@ class MEDIA_EXPORT WebCodecsEncodedChunkStreamParser : public StreamParser { std::unique_ptr<AudioDecoderConfig> audio_config); explicit WebCodecsEncodedChunkStreamParser( std::unique_ptr<VideoDecoderConfig> video_config); + + WebCodecsEncodedChunkStreamParser(const WebCodecsEncodedChunkStreamParser&) = + delete; + WebCodecsEncodedChunkStreamParser& operator=( + const WebCodecsEncodedChunkStreamParser&) = delete; + ~WebCodecsEncodedChunkStreamParser() override; // StreamParser implementation. @@ -69,8 +75,6 @@ class MEDIA_EXPORT WebCodecsEncodedChunkStreamParser : public StreamParser { NewMediaSegmentCB new_segment_cb_; EndMediaSegmentCB end_of_segment_cb_; MediaLog* media_log_; - - DISALLOW_COPY_AND_ASSIGN(WebCodecsEncodedChunkStreamParser); }; } // namespace media diff --git a/chromium/media/formats/webm/cluster_builder.h b/chromium/media/formats/webm/cluster_builder.h index a708cde6fe6..685700be26e 100644 --- a/chromium/media/formats/webm/cluster_builder.h +++ b/chromium/media/formats/webm/cluster_builder.h @@ -31,6 +31,10 @@ class Cluster { class ClusterBuilder { public: ClusterBuilder(); + + ClusterBuilder(const ClusterBuilder&) = delete; + ClusterBuilder& operator=(const ClusterBuilder&) = delete; + ~ClusterBuilder(); void SetClusterTimecode(int64_t cluster_timecode); @@ -79,8 +83,6 @@ class ClusterBuilder { int buffer_size_; int bytes_used_; int64_t cluster_timecode_; - - DISALLOW_COPY_AND_ASSIGN(ClusterBuilder); }; } // namespace media diff --git a/chromium/media/formats/webm/opus_packet_builder.h b/chromium/media/formats/webm/opus_packet_builder.h index 77e5f2a9597..5b03ce816f2 100644 --- a/chromium/media/formats/webm/opus_packet_builder.h +++ b/chromium/media/formats/webm/opus_packet_builder.h @@ -24,6 +24,10 @@ enum OpusConstants { class OpusPacket { public: OpusPacket(uint8_t config, uint8_t frame_count, bool is_VBR); + + OpusPacket(const OpusPacket&) = delete; + OpusPacket& operator=(const OpusPacket&) = delete; + ~OpusPacket(); const uint8_t* data() const; @@ -33,8 +37,6 @@ class OpusPacket { private: std::vector<uint8_t> data_; double duration_ms_; - - DISALLOW_COPY_AND_ASSIGN(OpusPacket); }; // Builds an exhaustive collection of Opus packet configurations. diff --git a/chromium/media/formats/webm/tracks_builder.h b/chromium/media/formats/webm/tracks_builder.h index 41d0938f5ef..9acf4ad4bea 100644 --- a/chromium/media/formats/webm/tracks_builder.h +++ b/chromium/media/formats/webm/tracks_builder.h @@ -22,6 +22,10 @@ class TracksBuilder { // |name|, |language| and any device-specific constraints are not checked. explicit TracksBuilder(bool allow_invalid_values); TracksBuilder(); // Sets |allow_invalid_values| to false. + + TracksBuilder(const TracksBuilder&) = delete; + TracksBuilder& operator=(const TracksBuilder&) = delete; + ~TracksBuilder(); // Only a non-negative |default_duration| will result in a serialized @@ -109,8 +113,6 @@ class TracksBuilder { typedef std::list<Track> TrackList; TrackList tracks_; bool allow_invalid_values_; - - DISALLOW_COPY_AND_ASSIGN(TracksBuilder); }; } // namespace media diff --git a/chromium/media/formats/webm/webm_audio_client.cc b/chromium/media/formats/webm/webm_audio_client.cc index 5ac98e8eb02..6c49c6dc3b1 100644 --- a/chromium/media/formats/webm/webm_audio_client.cc +++ b/chromium/media/formats/webm/webm_audio_client.cc @@ -32,11 +32,11 @@ bool WebMAudioClient::InitializeConfig( DCHECK(config); SampleFormat sample_format = kSampleFormatPlanarF32; - AudioCodec audio_codec = kUnknownAudioCodec; + AudioCodec audio_codec = AudioCodec::kUnknown; if (codec_id == "A_VORBIS") { - audio_codec = kCodecVorbis; + audio_codec = AudioCodec::kVorbis; } else if (codec_id == "A_OPUS") { - audio_codec = kCodecOpus; + audio_codec = AudioCodec::kOpus; } else { MEDIA_LOG(ERROR, media_log_) << "Unsupported audio codec_id " << codec_id; return false; @@ -63,7 +63,7 @@ bool WebMAudioClient::InitializeConfig( // Always use 48kHz for OPUS. See the "Input Sample Rate" section of the // spec: http://tools.ietf.org/html/draft-terriberry-oggopus-01#page-11 - if (audio_codec == kCodecOpus) { + if (audio_codec == AudioCodec::kOpus) { samples_per_second = 48000; sample_format = kSampleFormatF32; } @@ -77,11 +77,11 @@ bool WebMAudioClient::InitializeConfig( base::Time::kNanosecondsPerSecond); } - config->Initialize(audio_codec, sample_format, channel_layout, - samples_per_second, codec_private, encryption_scheme, - base::TimeDelta::FromMicroseconds( - (seek_preroll != -1 ? seek_preroll : 0) / 1000), - codec_delay_in_frames); + config->Initialize( + audio_codec, sample_format, channel_layout, samples_per_second, + codec_private, encryption_scheme, + base::Microseconds((seek_preroll != -1 ? seek_preroll : 0) / 1000), + codec_delay_in_frames); config->SetChannelsForDiscrete(channels_); return config->IsValidConfig(); } diff --git a/chromium/media/formats/webm/webm_audio_client.h b/chromium/media/formats/webm/webm_audio_client.h index ab658677b94..6d734255df8 100644 --- a/chromium/media/formats/webm/webm_audio_client.h +++ b/chromium/media/formats/webm/webm_audio_client.h @@ -22,6 +22,10 @@ class AudioDecoderConfig; class WebMAudioClient : public WebMParserClient { public: explicit WebMAudioClient(MediaLog* media_log); + + WebMAudioClient(const WebMAudioClient&) = delete; + WebMAudioClient& operator=(const WebMAudioClient&) = delete; + ~WebMAudioClient() override; // Reset this object's state so it can process a new audio track element. @@ -49,8 +53,6 @@ class WebMAudioClient : public WebMParserClient { int channels_; double samples_per_second_; double output_samples_per_second_; - - DISALLOW_COPY_AND_ASSIGN(WebMAudioClient); }; } // namespace media diff --git a/chromium/media/formats/webm/webm_cluster_parser.cc b/chromium/media/formats/webm/webm_cluster_parser.cc index 9d192f81134..932763273e0 100644 --- a/chromium/media/formats/webm/webm_cluster_parser.cc +++ b/chromium/media/formats/webm/webm_cluster_parser.cc @@ -108,8 +108,8 @@ int WebMClusterParser::Parse(const uint8_t* buf, int size) { if (cluster_timecode_ < 0) return -1; - cluster_start_time_ = base::TimeDelta::FromMicroseconds( - cluster_timecode_ * timecode_multiplier_); + cluster_start_time_ = + base::Microseconds(cluster_timecode_ * timecode_multiplier_); } // Reset the parser if we're done parsing so that @@ -172,7 +172,7 @@ base::TimeDelta WebMClusterParser::TryGetEncodedAudioDuration( // TODO(chcunningham): Consider parsing "Signal Byte" for encrypted streams // to return duration for any unencrypted blocks. - if (audio_codec_ == kCodecOpus) { + if (audio_codec_ == AudioCodec::kOpus) { return ReadOpusDuration(data, size); } @@ -189,8 +189,7 @@ base::TimeDelta WebMClusterParser::ReadOpusDuration(const uint8_t* data, static const uint8_t kTocConfigMask = 0xf8; static const uint8_t kTocFrameCountCodeMask = 0x03; static const uint8_t kFrameCountMask = 0x3f; - static const base::TimeDelta kPacketDurationMax = - base::TimeDelta::FromMilliseconds(120); + static const base::TimeDelta kPacketDurationMax = base::Milliseconds(120); if (size < 1) { LIMITED_MEDIA_LOG(DEBUG, media_log_, num_duration_errors_, @@ -246,8 +245,8 @@ base::TimeDelta WebMClusterParser::ReadOpusDuration(const uint8_t* data, CHECK_LT(opusConfig, static_cast<int>(base::size(kOpusFrameDurationsMu))); DCHECK_GT(frame_count, 0); - base::TimeDelta duration = base::TimeDelta::FromMicroseconds( - kOpusFrameDurationsMu[opusConfig] * frame_count); + base::TimeDelta duration = + base::Microseconds(kOpusFrameDurationsMu[opusConfig] * frame_count); if (duration > kPacketDurationMax) { // Intentionally allowing packet to pass through for now. Decoder should @@ -503,7 +502,7 @@ bool WebMClusterParser::OnBlock(bool is_simple_block, return false; } - base::TimeDelta timestamp = base::TimeDelta::FromMicroseconds(microseconds); + base::TimeDelta timestamp = base::Microseconds(microseconds); if (timestamp == kNoTimestamp || timestamp == kInfiniteDuration) { MEDIA_LOG(ERROR, media_log_) << "Invalid block timestamp."; @@ -562,8 +561,8 @@ bool WebMClusterParser::OnBlock(bool is_simple_block, base::TimeDelta block_duration_time_delta = kNoTimestamp; if (block_duration >= 0) { - block_duration_time_delta = base::TimeDelta::FromMicroseconds( - block_duration * timecode_multiplier_); + block_duration_time_delta = + base::Microseconds(block_duration * timecode_multiplier_); } // Prefer encoded duration over BlockGroup->BlockDuration or @@ -590,7 +589,7 @@ bool WebMClusterParser::OnBlock(bool is_simple_block, block_duration_time_delta - encoded_duration; const auto kWarnDurationDiff = - base::TimeDelta::FromMicroseconds(timecode_multiplier_ * 2); + base::Microseconds(timecode_multiplier_ * 2); if (duration_difference.magnitude() > kWarnDurationDiff) { LIMITED_MEDIA_LOG(DEBUG, media_log_, num_duration_errors_, kMaxDurationErrorLogs) @@ -610,8 +609,7 @@ bool WebMClusterParser::OnBlock(bool is_simple_block, // https://crbug.com/969195. if (discard_padding != 0) { buffer->set_discard_padding(std::make_pair( - base::TimeDelta(), - base::TimeDelta::FromMicroseconds(discard_padding / 1000))); + base::TimeDelta(), base::Microseconds(discard_padding / 1000))); } return track->AddBuffer(std::move(buffer)); @@ -790,12 +788,10 @@ base::TimeDelta WebMClusterParser::Track::GetDurationEstimate() { if (max_frame_duration_ == kNoTimestamp) { DVLOG(3) << __func__ << " : using hardcoded default duration"; if (track_type_ == TrackType::AUDIO) { - duration = - base::TimeDelta::FromMilliseconds(kDefaultAudioBufferDurationInMs); + duration = base::Milliseconds(kDefaultAudioBufferDurationInMs); } else { // Text and video tracks can both use the larger video default duration. - duration = - base::TimeDelta::FromMilliseconds(kDefaultVideoBufferDurationInMs); + duration = base::Milliseconds(kDefaultVideoBufferDurationInMs); } } else { // Use max duration to minimize the risk of introducing gaps in the buffered diff --git a/chromium/media/formats/webm/webm_cluster_parser_unittest.cc b/chromium/media/formats/webm/webm_cluster_parser_unittest.cc index 987dc710839..9edb409f96f 100644 --- a/chromium/media/formats/webm/webm_cluster_parser_unittest.cc +++ b/chromium/media/formats/webm/webm_cluster_parser_unittest.cc @@ -293,9 +293,9 @@ class WebMClusterParserTest : public testing::Test { protected: void ResetParserToHaveDefaultDurations() { base::TimeDelta default_audio_duration = - base::TimeDelta::FromMillisecondsD(kTestAudioFrameDefaultDurationInMs); + base::Milliseconds(kTestAudioFrameDefaultDurationInMs); base::TimeDelta default_video_duration = - base::TimeDelta::FromMillisecondsD(kTestVideoFrameDefaultDurationInMs); + base::Milliseconds(kTestVideoFrameDefaultDurationInMs); ASSERT_GE(default_audio_duration, base::TimeDelta()); ASSERT_GE(default_video_duration, base::TimeDelta()); ASSERT_NE(kNoTimestamp, default_audio_duration); @@ -325,7 +325,7 @@ class WebMClusterParserTest : public testing::Test { WebMClusterParser* CreateDefaultParser() { return CreateParserHelper(kNoTimestamp, kNoTimestamp, TextTracks(), std::set<int64_t>(), std::string(), std::string(), - kUnknownAudioCodec); + AudioCodec::kUnknown); } // Create a parser for test with custom audio and video default durations, and @@ -336,7 +336,7 @@ class WebMClusterParserTest : public testing::Test { const WebMTracksParser::TextTracks& text_tracks = TextTracks()) { return CreateParserHelper(audio_default_duration, video_default_duration, text_tracks, std::set<int64_t>(), std::string(), - std::string(), kUnknownAudioCodec); + std::string(), AudioCodec::kUnknown); } // Create a parser for test with custom ignored tracks. @@ -344,7 +344,7 @@ class WebMClusterParserTest : public testing::Test { std::set<int64_t>& ignored_tracks) { return CreateParserHelper(kNoTimestamp, kNoTimestamp, TextTracks(), ignored_tracks, std::string(), std::string(), - kUnknownAudioCodec); + AudioCodec::kUnknown); } // Create a parser for test with custom encryption key ids and audio codec. @@ -378,7 +378,7 @@ TEST_F(WebMClusterParserTest, HeldBackBufferHoldsBackAllTracks) { TextTrackConfig(kTextSubtitles, "", "", ""))); base::TimeDelta default_audio_duration = - base::TimeDelta::FromMillisecondsD(kTestAudioFrameDefaultDurationInMs); + base::Milliseconds(kTestAudioFrameDefaultDurationInMs); ASSERT_GE(default_audio_duration, base::TimeDelta()); ASSERT_NE(kNoTimestamp, default_audio_duration); parser_.reset(CreateParserWithDefaultDurationsAndOptionalTextTracks( @@ -716,7 +716,7 @@ TEST_F(WebMClusterParserTest, ParseEncryptedBlock) { CreateEncryptedCluster(sizeof(kEncryptedFrame))); parser_.reset(CreateParserWithKeyIdsAndAudioCodec( - std::string(), "video_key_id", kUnknownAudioCodec)); + std::string(), "video_key_id", AudioCodec::kUnknown)); // The encrypted cluster contains just one block, video. EXPECT_MEDIA_LOG(WebMSimpleBlockDurationEstimated( @@ -736,7 +736,7 @@ TEST_F(WebMClusterParserTest, ParseBadEncryptedBlock) { CreateEncryptedCluster(sizeof(kEncryptedFrame) - 1)); parser_.reset(CreateParserWithKeyIdsAndAudioCodec( - std::string(), "video_key_id", kUnknownAudioCodec)); + std::string(), "video_key_id", AudioCodec::kUnknown)); EXPECT_MEDIA_LOG(HasSubstr("Failed to extract decrypt config")); int result = parser_->Parse(cluster->data(), cluster->size()); @@ -1149,7 +1149,7 @@ TEST_F(WebMClusterParserTest, ReadOpusDurationsSimpleBlockAtEndOfCluster) { // Get a new parser each iteration to prevent exceeding the media log cap. parser_.reset(CreateParserWithKeyIdsAndAudioCodec( - std::string(), std::string(), kCodecOpus)); + std::string(), std::string(), AudioCodec::kOpus)); const BlockInfo kBlockInfo[] = {{kAudioTrackNum, 0, @@ -1186,7 +1186,7 @@ TEST_F(WebMClusterParserTest, PreferOpusDurationsOverBlockDurations) { // Get a new parser each iteration to prevent exceeding the media log cap. parser_.reset(CreateParserWithKeyIdsAndAudioCodec( - std::string(), std::string(), kCodecOpus)); + std::string(), std::string(), AudioCodec::kOpus)); // Setting BlockDuration != Opus duration to see which one the parser uses. double block_duration_ms = packet_ptr->duration_ms() + 10; @@ -1234,8 +1234,8 @@ TEST_F(WebMClusterParserTest, DontReadEncodedDurationWhenEncrypted) { std::string audio_encryption_id("audio_key_id"); // Reset parser to expect Opus codec audio and use audio encryption key id. - parser_.reset(CreateParserWithKeyIdsAndAudioCodec(audio_encryption_id, - std::string(), kCodecOpus)); + parser_.reset(CreateParserWithKeyIdsAndAudioCodec( + audio_encryption_id, std::string(), AudioCodec::kOpus)); // Single Block with BlockDuration and encrypted data. const BlockInfo kBlockInfo[] = {{kAudioTrackNum, 0, diff --git a/chromium/media/formats/webm/webm_colour_parser.h b/chromium/media/formats/webm/webm_colour_parser.h index 90b86f1c9b9..fe93df2d349 100644 --- a/chromium/media/formats/webm/webm_colour_parser.h +++ b/chromium/media/formats/webm/webm_colour_parser.h @@ -37,6 +37,11 @@ struct MEDIA_EXPORT WebMColorMetadata { class WebMColorVolumeMetadataParser : public WebMParserClient { public: WebMColorVolumeMetadataParser(); + + WebMColorVolumeMetadataParser(const WebMColorVolumeMetadataParser&) = delete; + WebMColorVolumeMetadataParser& operator=( + const WebMColorVolumeMetadataParser&) = delete; + ~WebMColorVolumeMetadataParser() override; gfx::ColorVolumeMetadata GetColorVolumeMetadata() const { @@ -48,7 +53,6 @@ class WebMColorVolumeMetadataParser : public WebMParserClient { bool OnFloat(int id, double val) override; gfx::ColorVolumeMetadata color_volume_metadata_; - DISALLOW_COPY_AND_ASSIGN(WebMColorVolumeMetadataParser); }; // Parser for WebM Colour element: @@ -56,6 +60,10 @@ class WebMColorVolumeMetadataParser : public WebMParserClient { class WebMColourParser : public WebMParserClient { public: WebMColourParser(); + + WebMColourParser(const WebMColourParser&) = delete; + WebMColourParser& operator=(const WebMColourParser&) = delete; + ~WebMColourParser() override; void Reset(); @@ -84,8 +92,6 @@ class WebMColourParser : public WebMParserClient { WebMColorVolumeMetadataParser color_volume_metadata_parser_; bool color_volume_metadata_parsed_ = false; - - DISALLOW_COPY_AND_ASSIGN(WebMColourParser); }; } // namespace media diff --git a/chromium/media/formats/webm/webm_content_encodings.h b/chromium/media/formats/webm/webm_content_encodings.h index 1a1fa8d721e..3f699d5597f 100644 --- a/chromium/media/formats/webm/webm_content_encodings.h +++ b/chromium/media/formats/webm/webm_content_encodings.h @@ -52,6 +52,10 @@ class MEDIA_EXPORT ContentEncoding { }; ContentEncoding(); + + ContentEncoding(const ContentEncoding&) = delete; + ContentEncoding& operator=(const ContentEncoding&) = delete; + ~ContentEncoding(); int64_t order() const { return order_; } @@ -81,8 +85,6 @@ class MEDIA_EXPORT ContentEncoding { EncryptionAlgo encryption_algo_; std::string encryption_key_id_; CipherMode cipher_mode_; - - DISALLOW_COPY_AND_ASSIGN(ContentEncoding); }; } // namespace media diff --git a/chromium/media/formats/webm/webm_content_encodings_client.h b/chromium/media/formats/webm/webm_content_encodings_client.h index 23820c5234c..c43a84da6db 100644 --- a/chromium/media/formats/webm/webm_content_encodings_client.h +++ b/chromium/media/formats/webm/webm_content_encodings_client.h @@ -26,6 +26,11 @@ typedef std::vector<std::unique_ptr<ContentEncoding>> ContentEncodings; class MEDIA_EXPORT WebMContentEncodingsClient : public WebMParserClient { public: explicit WebMContentEncodingsClient(MediaLog* media_log); + + WebMContentEncodingsClient(const WebMContentEncodingsClient&) = delete; + WebMContentEncodingsClient& operator=(const WebMContentEncodingsClient&) = + delete; + ~WebMContentEncodingsClient() override; const ContentEncodings& content_encodings() const; @@ -44,8 +49,6 @@ class MEDIA_EXPORT WebMContentEncodingsClient : public WebMParserClient { // |content_encodings_| is ready. For debugging purpose. bool content_encodings_ready_; - - DISALLOW_COPY_AND_ASSIGN(WebMContentEncodingsClient); }; } // namespace media diff --git a/chromium/media/formats/webm/webm_info_parser.cc b/chromium/media/formats/webm/webm_info_parser.cc index 3e5eede925a..831a5850191 100644 --- a/chromium/media/formats/webm/webm_info_parser.cc +++ b/chromium/media/formats/webm/webm_info_parser.cc @@ -96,8 +96,7 @@ bool WebMInfoParser::OnBinary(int id, const uint8_t* data, int size) { base::Time out_time; if (!base::Time::FromUTCExploded(exploded_epoch, &out_time)) return false; - date_utc_ = out_time + - base::TimeDelta::FromMicroseconds(date_in_nanoseconds / 1000); + date_utc_ = out_time + base::Microseconds(date_in_nanoseconds / 1000); } return true; } diff --git a/chromium/media/formats/webm/webm_info_parser.h b/chromium/media/formats/webm/webm_info_parser.h index 1c6a518bd71..92c5d671d81 100644 --- a/chromium/media/formats/webm/webm_info_parser.h +++ b/chromium/media/formats/webm/webm_info_parser.h @@ -19,6 +19,10 @@ namespace media { class MEDIA_EXPORT WebMInfoParser : public WebMParserClient { public: WebMInfoParser(); + + WebMInfoParser(const WebMInfoParser&) = delete; + WebMInfoParser& operator=(const WebMInfoParser&) = delete; + ~WebMInfoParser() override; // Parses a WebM Info element in |buf|. @@ -44,8 +48,6 @@ class MEDIA_EXPORT WebMInfoParser : public WebMParserClient { int64_t timecode_scale_ns_; double duration_; base::Time date_utc_; - - DISALLOW_COPY_AND_ASSIGN(WebMInfoParser); }; } // namespace media diff --git a/chromium/media/formats/webm/webm_parser.h b/chromium/media/formats/webm/webm_parser.h index 90a853b0313..c8b8da15d1c 100644 --- a/chromium/media/formats/webm/webm_parser.h +++ b/chromium/media/formats/webm/webm_parser.h @@ -29,6 +29,9 @@ namespace media { // error is reported by the parser. class MEDIA_EXPORT WebMParserClient { public: + WebMParserClient(const WebMParserClient&) = delete; + WebMParserClient& operator=(const WebMParserClient&) = delete; + virtual ~WebMParserClient(); virtual WebMParserClient* OnListStart(int id); @@ -45,8 +48,6 @@ class MEDIA_EXPORT WebMParserClient { protected: WebMParserClient(); - - DISALLOW_COPY_AND_ASSIGN(WebMParserClient); }; struct ListElementInfo; @@ -61,6 +62,10 @@ class MEDIA_EXPORT WebMListParser { // |id| - Element ID of the list we intend to parse. // |client| - Called as different elements in the list are parsed. WebMListParser(int id, WebMParserClient* client); + + WebMListParser(const WebMListParser&) = delete; + WebMListParser& operator=(const WebMListParser&) = delete; + ~WebMListParser(); // Resets the state of the parser so it can start parsing a new list. @@ -151,8 +156,6 @@ class MEDIA_EXPORT WebMListParser { // Stack of state for all the lists currently being parsed. Lists are // added and removed from this stack as they are parsed. std::vector<ListState> list_state_stack_; - - DISALLOW_COPY_AND_ASSIGN(WebMListParser); }; // Parses an element header & returns the ID and element size. diff --git a/chromium/media/formats/webm/webm_projection_parser.h b/chromium/media/formats/webm/webm_projection_parser.h index 8766f8fb7a1..a6e89752f03 100644 --- a/chromium/media/formats/webm/webm_projection_parser.h +++ b/chromium/media/formats/webm/webm_projection_parser.h @@ -15,6 +15,10 @@ namespace media { class MEDIA_EXPORT WebMProjectionParser : public WebMParserClient { public: explicit WebMProjectionParser(MediaLog* media_log); + + WebMProjectionParser(const WebMProjectionParser&) = delete; + WebMProjectionParser& operator=(const WebMProjectionParser&) = delete; + ~WebMProjectionParser() override; void Reset(); @@ -33,8 +37,6 @@ class MEDIA_EXPORT WebMProjectionParser : public WebMParserClient { double pose_yaw_; // value must be [-180, 180] double pose_pitch_; // value must be [-90, 90] double pose_roll_; // value must be [-180, 180] - - DISALLOW_COPY_AND_ASSIGN(WebMProjectionParser); }; } // namespace media diff --git a/chromium/media/formats/webm/webm_stream_parser.cc b/chromium/media/formats/webm/webm_stream_parser.cc index bc632221646..951cba094c9 100644 --- a/chromium/media/formats/webm/webm_stream_parser.cc +++ b/chromium/media/formats/webm/webm_stream_parser.cc @@ -205,7 +205,7 @@ int WebMStreamParser::ParseInfoAndTracks(const uint8_t* data, int size) { if (info_parser.duration() > 0) { int64_t duration_in_us = info_parser.duration() * timecode_scale_in_us; - params.duration = base::TimeDelta::FromMicroseconds(duration_in_us); + params.duration = base::Microseconds(duration_in_us); } params.timeline_offset = info_parser.date_utc(); diff --git a/chromium/media/formats/webm/webm_stream_parser.h b/chromium/media/formats/webm/webm_stream_parser.h index bab74de0a80..407c23d0cc9 100644 --- a/chromium/media/formats/webm/webm_stream_parser.h +++ b/chromium/media/formats/webm/webm_stream_parser.h @@ -24,6 +24,10 @@ class WebMClusterParser; class MEDIA_EXPORT WebMStreamParser : public StreamParser { public: WebMStreamParser(); + + WebMStreamParser(const WebMStreamParser&) = delete; + WebMStreamParser& operator=(const WebMStreamParser&) = delete; + ~WebMStreamParser() override; // StreamParser implementation. @@ -86,8 +90,6 @@ class MEDIA_EXPORT WebMStreamParser : public StreamParser { std::unique_ptr<WebMClusterParser> cluster_parser_; ByteQueue byte_queue_; - - DISALLOW_COPY_AND_ASSIGN(WebMStreamParser); }; } // namespace media diff --git a/chromium/media/formats/webm/webm_tracks_parser.cc b/chromium/media/formats/webm/webm_tracks_parser.cc index 99ee1acc628..b8d448042eb 100644 --- a/chromium/media/formats/webm/webm_tracks_parser.cc +++ b/chromium/media/formats/webm/webm_tracks_parser.cc @@ -57,7 +57,7 @@ base::TimeDelta WebMTracksParser::PrecisionCappedDefaultDuration( if (result_us == 0) return kNoTimestamp; - return base::TimeDelta::FromMicroseconds(result_us); + return base::Microseconds(result_us); } void WebMTracksParser::Reset() { diff --git a/chromium/media/formats/webm/webm_tracks_parser.h b/chromium/media/formats/webm/webm_tracks_parser.h index 72996688a81..65da011d475 100644 --- a/chromium/media/formats/webm/webm_tracks_parser.h +++ b/chromium/media/formats/webm/webm_tracks_parser.h @@ -14,6 +14,7 @@ #include <vector> #include "base/compiler_specific.h" +#include "base/gtest_prod_util.h" #include "base/macros.h" #include "base/time/time.h" #include "media/base/audio_decoder_config.h" @@ -32,6 +33,10 @@ namespace media { class MEDIA_EXPORT WebMTracksParser : public WebMParserClient { public: WebMTracksParser(MediaLog* media_log, bool ignore_text_tracks); + + WebMTracksParser(const WebMTracksParser&) = delete; + WebMTracksParser& operator=(const WebMTracksParser&) = delete; + ~WebMTracksParser() override; // Parses a WebM Tracks element in |buf|. @@ -150,8 +155,6 @@ class MEDIA_EXPORT WebMTracksParser : public WebMParserClient { int detected_video_track_count_; int detected_text_track_count_; std::unique_ptr<MediaTracks> media_tracks_; - - DISALLOW_COPY_AND_ASSIGN(WebMTracksParser); }; } // namespace media diff --git a/chromium/media/formats/webm/webm_tracks_parser_unittest.cc b/chromium/media/formats/webm/webm_tracks_parser_unittest.cc index 66d2a6a377d..ed6c2fc77d3 100644 --- a/chromium/media/formats/webm/webm_tracks_parser_unittest.cc +++ b/chromium/media/formats/webm/webm_tracks_parser_unittest.cc @@ -181,14 +181,14 @@ TEST_F(WebMTracksParserTest, AudioVideoDefaultDurationSet) { EXPECT_LE(0, result); EXPECT_EQ(static_cast<int>(buf.size()), result); - EXPECT_EQ(base::TimeDelta::FromMicroseconds(12000), + EXPECT_EQ(base::Microseconds(12000), parser->GetAudioDefaultDuration(kOneMsInNs)); - EXPECT_EQ(base::TimeDelta::FromMicroseconds(985000), + EXPECT_EQ(base::Microseconds(985000), parser->GetVideoDefaultDuration(5000000)); // 5 ms resolution EXPECT_EQ(kNoTimestamp, parser->GetAudioDefaultDuration(12346000)); - EXPECT_EQ(base::TimeDelta::FromMicroseconds(12345), + EXPECT_EQ(base::Microseconds(12345), parser->GetAudioDefaultDuration(12345000)); - EXPECT_EQ(base::TimeDelta::FromMicroseconds(12003), + EXPECT_EQ(base::Microseconds(12003), parser->GetAudioDefaultDuration(1000300)); // 1.0003 ms resolution } @@ -262,10 +262,10 @@ TEST_F(WebMTracksParserTest, PrecisionCapping) { {kOneMsInNs, 0, kNoTimestamp}, {kOneMsInNs, 1, kNoTimestamp}, {kOneMsInNs, 999999, kNoTimestamp}, - {kOneMsInNs, 1000000, base::TimeDelta::FromMilliseconds(1)}, - {kOneMsInNs, 1000001, base::TimeDelta::FromMilliseconds(1)}, - {kOneMsInNs, 1999999, base::TimeDelta::FromMilliseconds(1)}, - {kOneMsInNs, 2000000, base::TimeDelta::FromMilliseconds(2)}, + {kOneMsInNs, 1000000, base::Milliseconds(1)}, + {kOneMsInNs, 1000001, base::Milliseconds(1)}, + {kOneMsInNs, 1999999, base::Milliseconds(1)}, + {kOneMsInNs, 2000000, base::Milliseconds(2)}, {1, -1, kNoTimestamp}, {1, 0, kNoTimestamp}, @@ -273,11 +273,11 @@ TEST_F(WebMTracksParserTest, PrecisionCapping) { {1, 1, kNoTimestamp}, {1, 999, kNoTimestamp}, - {1, 1000, base::TimeDelta::FromMicroseconds(1)}, - {1, 1999, base::TimeDelta::FromMicroseconds(1)}, - {1, 2000, base::TimeDelta::FromMicroseconds(2)}, + {1, 1000, base::Microseconds(1)}, + {1, 1999, base::Microseconds(1)}, + {1, 2000, base::Microseconds(2)}, - {64, 1792, base::TimeDelta::FromMicroseconds(1)}, + {64, 1792, base::Microseconds(1)}, }; std::unique_ptr<WebMTracksParser> parser( diff --git a/chromium/media/formats/webm/webm_video_client.cc b/chromium/media/formats/webm/webm_video_client.cc index 407c11b3c79..8e4add7a4cf 100644 --- a/chromium/media/formats/webm/webm_video_client.cc +++ b/chromium/media/formats/webm/webm_video_client.cc @@ -80,13 +80,13 @@ bool WebMVideoClient::InitializeConfig( is_8bit = color_metadata.BitsPerChannel <= 8; } - VideoCodec video_codec = kUnknownVideoCodec; + VideoCodec video_codec = VideoCodec::kUnknown; VideoCodecProfile profile = VIDEO_CODEC_PROFILE_UNKNOWN; if (codec_id == "V_VP8") { - video_codec = kCodecVP8; + video_codec = VideoCodec::kVP8; profile = VP8PROFILE_ANY; } else if (codec_id == "V_VP9") { - video_codec = kCodecVP9; + video_codec = VideoCodec::kVP9; profile = GetVP9CodecProfile( codec_private, color_space.ToGfxColorSpace().IsHDR() || config->hdr_metadata().has_value() || !is_8bit); @@ -95,7 +95,7 @@ bool WebMVideoClient::InitializeConfig( // TODO(dalecurtis): AV1 profiles in WebM are not finalized, this needs // updating to read the actual profile and configuration before enabling for // release. http://crbug.com/784993 - video_codec = kCodecAV1; + video_codec = VideoCodec::kAV1; profile = AV1PROFILE_PROFILE_MAIN; #endif } else { @@ -129,7 +129,8 @@ bool WebMVideoClient::InitializeConfig( // TODO(dalecurtis): This is not correct, but it's what's muxed in webm // containers with AV1 right now. So accept it. We won't get here unless the // build and runtime flags are enabled for AV1. - if (display_unit_ == 0 || (video_codec == kCodecAV1 && display_unit_ == 4)) { + if (display_unit_ == 0 || + (video_codec == VideoCodec::kAV1 && display_unit_ == 4)) { if (display_width_ <= 0) display_width_ = visible_rect.width(); if (display_height_ <= 0) diff --git a/chromium/media/formats/webm/webm_video_client.h b/chromium/media/formats/webm/webm_video_client.h index 558831dc58f..cfd93b626fa 100644 --- a/chromium/media/formats/webm/webm_video_client.h +++ b/chromium/media/formats/webm/webm_video_client.h @@ -25,6 +25,10 @@ class VideoDecoderConfig; class MEDIA_EXPORT WebMVideoClient : public WebMParserClient { public: explicit WebMVideoClient(MediaLog* media_log); + + WebMVideoClient(const WebMVideoClient&) = delete; + WebMVideoClient& operator=(const WebMVideoClient&) = delete; + ~WebMVideoClient() override; // Reset this object's state so it can process a new video track element. @@ -71,8 +75,6 @@ class MEDIA_EXPORT WebMVideoClient : public WebMParserClient { WebMProjectionParser projection_parser_; bool projection_parsed_ = false; - - DISALLOW_COPY_AND_ASSIGN(WebMVideoClient); }; } // namespace media diff --git a/chromium/media/formats/webm/webm_video_client_unittest.cc b/chromium/media/formats/webm/webm_video_client_unittest.cc index eb422b20bd9..5786ed1d723 100644 --- a/chromium/media/formats/webm/webm_video_client_unittest.cc +++ b/chromium/media/formats/webm/webm_video_client_unittest.cc @@ -150,7 +150,7 @@ TEST_P(WebMVideoClientTest, InitializeConfigVP9Profiles) { EncryptionScheme(), &config)); VideoDecoderConfig expected_config( - kCodecVP9, profile, VideoDecoderConfig::AlphaMode::kIsOpaque, + VideoCodec::kVP9, profile, VideoDecoderConfig::AlphaMode::kIsOpaque, VideoColorSpace::REC709(), kNoTransformation, kCodedSize, gfx::Rect(kCodedSize), kCodedSize, codec_private, EncryptionScheme::kUnencrypted); |