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/formats | |
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/formats')
-rw-r--r-- | chromium/media/formats/common/offset_byte_queue.cc | 9 | ||||
-rw-r--r-- | chromium/media/formats/mp2t/es_adapter_video.cc | 1 | ||||
-rw-r--r-- | chromium/media/formats/mp2t/mp2t_common.h | 2 | ||||
-rw-r--r-- | chromium/media/formats/mp2t/ts_packet.cc | 1 | ||||
-rw-r--r-- | chromium/media/formats/mp4/box_reader.cc | 6 | ||||
-rw-r--r-- | chromium/media/formats/mp4/box_reader_unittest.cc | 5 | ||||
-rw-r--r-- | chromium/media/formats/mp4/mp4_stream_parser.cc | 3 | ||||
-rw-r--r-- | chromium/media/formats/mp4/mp4_stream_parser_unittest.cc | 64 | ||||
-rw-r--r-- | chromium/media/formats/webm/webm_parser.cc | 2 |
9 files changed, 59 insertions, 34 deletions
diff --git a/chromium/media/formats/common/offset_byte_queue.cc b/chromium/media/formats/common/offset_byte_queue.cc index b355e1adf26..831c4d0ffe9 100644 --- a/chromium/media/formats/common/offset_byte_queue.cc +++ b/chromium/media/formats/common/offset_byte_queue.cc @@ -4,16 +4,17 @@ #include "media/formats/common/offset_byte_queue.h" +#include "base/check.h" #include "base/logging.h" namespace media { -OffsetByteQueue::OffsetByteQueue() : buf_(NULL), size_(0), head_(0) {} +OffsetByteQueue::OffsetByteQueue() : buf_(nullptr), size_(0), head_(0) {} OffsetByteQueue::~OffsetByteQueue() = default; void OffsetByteQueue::Reset() { queue_.Reset(); - buf_ = NULL; + buf_ = nullptr; size_ = 0; head_ = 0; } @@ -25,7 +26,7 @@ void OffsetByteQueue::Push(const uint8_t* buf, int size) { } void OffsetByteQueue::Peek(const uint8_t** buf, int* size) { - *buf = size_ > 0 ? buf_ : NULL; + *buf = size_ > 0 ? buf_ : nullptr; *size = size_; } @@ -38,7 +39,7 @@ void OffsetByteQueue::Pop(int count) { void OffsetByteQueue::PeekAt(int64_t offset, const uint8_t** buf, int* size) { DCHECK(offset >= head()); if (offset < head() || offset >= tail()) { - *buf = NULL; + *buf = nullptr; *size = 0; return; } diff --git a/chromium/media/formats/mp2t/es_adapter_video.cc b/chromium/media/formats/mp2t/es_adapter_video.cc index 15a3dd398d9..88bdecc667f 100644 --- a/chromium/media/formats/mp2t/es_adapter_video.cc +++ b/chromium/media/formats/mp2t/es_adapter_video.cc @@ -6,6 +6,7 @@ #include <stddef.h> +#include "base/logging.h" #include "media/base/timestamp_constants.h" #include "media/base/video_decoder_config.h" #include "media/formats/mp2t/mp2t_common.h" diff --git a/chromium/media/formats/mp2t/mp2t_common.h b/chromium/media/formats/mp2t/mp2t_common.h index 37e5891bb15..ebced862cbe 100644 --- a/chromium/media/formats/mp2t/mp2t_common.h +++ b/chromium/media/formats/mp2t/mp2t_common.h @@ -5,6 +5,8 @@ #ifndef MEDIA_FORMATS_MP2T_MP2T_COMMON_H_ #define MEDIA_FORMATS_MP2T_MP2T_COMMON_H_ +#include "base/logging.h" + #define LOG_LEVEL_TS 5 #define LOG_LEVEL_PES 4 #define LOG_LEVEL_ES 3 diff --git a/chromium/media/formats/mp2t/ts_packet.cc b/chromium/media/formats/mp2t/ts_packet.cc index 9d19b2290af..ea9e9072cdb 100644 --- a/chromium/media/formats/mp2t/ts_packet.cc +++ b/chromium/media/formats/mp2t/ts_packet.cc @@ -6,6 +6,7 @@ #include <memory> +#include "base/logging.h" #include "media/base/bit_reader.h" #include "media/formats/mp2t/mp2t_common.h" diff --git a/chromium/media/formats/mp4/box_reader.cc b/chromium/media/formats/mp4/box_reader.cc index 131ae34e0df..d41f2f91494 100644 --- a/chromium/media/formats/mp4/box_reader.cc +++ b/chromium/media/formats/mp4/box_reader.cc @@ -177,9 +177,9 @@ bool BoxReader::IsValidTopLevelBox(const FourCC& type, MediaLog* media_log) { case FOURCC_EMSG: return true; default: - // Hex is used to show nonprintable characters and aid in debugging - MEDIA_LOG(DEBUG, media_log) << "Unrecognized top-level box type " - << FourCCToString(type); + // Hex is used to show nonprintable characters and aid in debugging. + MEDIA_LOG(ERROR, media_log) + << "Invalid top-level ISO BMFF box type " << FourCCToString(type); return false; } } diff --git a/chromium/media/formats/mp4/box_reader_unittest.cc b/chromium/media/formats/mp4/box_reader_unittest.cc index cc496d9eaa9..33ebe37b8f5 100644 --- a/chromium/media/formats/mp4/box_reader_unittest.cc +++ b/chromium/media/formats/mp4/box_reader_unittest.cc @@ -213,7 +213,10 @@ TEST_F(BoxReaderTest, WrongFourCCTest) { buf[6] = 0x4c; buf[7] = 0x45; - EXPECT_MEDIA_LOG(HasSubstr("Unrecognized top-level box type DALE")); + // Also, tests that the offending FourCC is emitted only in a debug media log. + EXPECT_MEDIA_LOG( + AllOf(HasSubstr("error"), + HasSubstr("Invalid top-level ISO BMFF box type DALE"))); std::unique_ptr<BoxReader> reader; ParseResult result = diff --git a/chromium/media/formats/mp4/mp4_stream_parser.cc b/chromium/media/formats/mp4/mp4_stream_parser.cc index 6fa01d734b6..6a1db373af6 100644 --- a/chromium/media/formats/mp4/mp4_stream_parser.cc +++ b/chromium/media/formats/mp4/mp4_stream_parser.cc @@ -257,8 +257,7 @@ ParseResult MP4StreamParser::ParseBox() { } else { // TODO(wolenetz,chcunningham): Enforce more strict adherence to MSE byte // stream spec for ftyp and styp. See http://crbug.com/504514. - DVLOG(2) << "Skipping unrecognized top-level box: " - << FourCCToString(reader->type()); + DVLOG(2) << "Skipping top-level box: " << FourCCToString(reader->type()); } queue_.Pop(reader->box_size()); diff --git a/chromium/media/formats/mp4/mp4_stream_parser_unittest.cc b/chromium/media/formats/mp4/mp4_stream_parser_unittest.cc index c04a2c82c3c..1955d5610d3 100644 --- a/chromium/media/formats/mp4/mp4_stream_parser_unittest.cc +++ b/chromium/media/formats/mp4/mp4_stream_parser_unittest.cc @@ -17,6 +17,7 @@ #include "base/logging.h" #include "base/memory/ref_counted.h" #include "base/test/metrics/histogram_tester.h" +#include "base/test/mock_callback.h" #include "base/time/time.h" #include "media/base/audio_decoder_config.h" #include "media/base/decoder_buffer.h" @@ -43,6 +44,21 @@ using base::TimeDelta; namespace media { namespace mp4 { +namespace { + +// Useful in single-track test media cases that need to verify +// keyframe/non-keyframe sequence in output of parse. +enum class Keyframeness { + kKeyframe = 0, + kNonKeyframe, +}; + +// Tells gtest how to print our Keyframeness enum values. +std::ostream& operator<<(std::ostream& os, Keyframeness k) { + return os << (k == Keyframeness::kKeyframe ? "kKeyframe" : "kNonKeyframe"); +} + +} // namespace // Matchers for verifying common media log entry strings. MATCHER(SampleEncryptionInfoUnavailableLog, "") { @@ -80,6 +96,7 @@ class MP4StreamParserTest : public testing::Test { StreamParser::TrackId audio_track_id_; StreamParser::TrackId video_track_id_; bool verifying_keyframeness_sequence_; + StrictMock<base::MockRepeatingCallback<void(Keyframeness)>> keyframeness_cb_; bool AppendData(const uint8_t* data, size_t length) { return parser_->Parse(data, length); @@ -141,11 +158,6 @@ class MP4StreamParserTest : public testing::Test { return true; } - // Useful in single-track test media cases that need to verify - // keyframe/non-keyframe sequence in output of parse. - MOCK_METHOD0(ParsedKeyframe, void()); - MOCK_METHOD0(ParsedNonKeyframe, void()); - bool NewBuffersF(const StreamParser::BufferQueueMap& buffer_queue_map) { DecodeTimestamp lowest_end_dts = kNoDecodeTimestamp(); for (const auto& it : buffer_queue_map) { @@ -167,10 +179,9 @@ class MP4StreamParserTest : public testing::Test { // Let single-track tests verify the sequence of keyframes/nonkeyframes. if (verifying_keyframeness_sequence_) { - if (buf->is_key_frame()) - ParsedKeyframe(); - else - ParsedNonKeyframe(); + keyframeness_cb_.Run(buf->is_key_frame() + ? Keyframeness::kKeyframe + : Keyframeness::kNonKeyframe); } } } @@ -347,8 +358,8 @@ TEST_F(MP4StreamParserTest, AVC_KeyAndNonKeyframeness_Match_Container) { params.detected_audio_track_count = 0; InitializeParserWithInitParametersExpectations(params); verifying_keyframeness_sequence_ = true; - EXPECT_CALL(*this, ParsedKeyframe()); - EXPECT_CALL(*this, ParsedNonKeyframe()); + EXPECT_CALL(keyframeness_cb_, Run(Keyframeness::kKeyframe)); + EXPECT_CALL(keyframeness_cb_, Run(Keyframeness::kNonKeyframe)); ParseMP4File("bear-640x360-v-2frames_frag.mp4", 512); } @@ -366,8 +377,8 @@ TEST_F(MP4StreamParserTest, AVC_Keyframeness_Mismatches_Container) { EXPECT_MEDIA_LOG(DebugLog( "ISO-BMFF container metadata for video frame indicates that the frame is " "not a keyframe, but the video frame contents indicate the opposite.")); - EXPECT_CALL(*this, ParsedKeyframe()); - EXPECT_CALL(*this, ParsedNonKeyframe()); + EXPECT_CALL(keyframeness_cb_, Run(Keyframeness::kKeyframe)); + EXPECT_CALL(keyframeness_cb_, Run(Keyframeness::kNonKeyframe)); ParseMP4File("bear-640x360-v-2frames-keyframe-is-non-sync-sample_frag.mp4", 512); } @@ -383,11 +394,11 @@ TEST_F(MP4StreamParserTest, AVC_NonKeyframeness_Mismatches_Container) { params.detected_audio_track_count = 0; InitializeParserWithInitParametersExpectations(params); verifying_keyframeness_sequence_ = true; - EXPECT_CALL(*this, ParsedKeyframe()); + EXPECT_CALL(keyframeness_cb_, Run(Keyframeness::kKeyframe)); EXPECT_MEDIA_LOG(DebugLog( "ISO-BMFF container metadata for video frame indicates that the frame is " "a keyframe, but the video frame contents indicate the opposite.")); - EXPECT_CALL(*this, ParsedNonKeyframe()); + EXPECT_CALL(keyframeness_cb_, Run(Keyframeness::kNonKeyframe)); ParseMP4File("bear-640x360-v-2frames-nonkeyframe-is-sync-sample_frag.mp4", 512); } @@ -405,16 +416,21 @@ TEST_F(MP4StreamParserTest, MPEG2_AAC_LC) { } TEST_F(MP4StreamParserTest, MPEG4_XHE_AAC) { - InSequence s; + InSequence s; // The keyframeness sequence matters for this test. std::set<int> audio_object_types; audio_object_types.insert(kISO_14496_3); parser_.reset(new MP4StreamParser(audio_object_types, false, false)); auto params = GetDefaultInitParametersExpectations(); - params.duration = base::TimeDelta::FromMicroseconds(1024000); - params.liveness = DemuxerStream::LIVENESS_RECORDED; params.detected_video_track_count = 0; InitializeParserWithInitParametersExpectations(params); + + // This test file contains a single audio keyframe followed by 23 + // non-keyframes. + verifying_keyframeness_sequence_ = true; + EXPECT_CALL(keyframeness_cb_, Run(Keyframeness::kKeyframe)); + EXPECT_CALL(keyframeness_cb_, Run(Keyframeness::kNonKeyframe)).Times(23); + ParseMP4File("noise-xhe-aac.mp4", 512); EXPECT_EQ(audio_decoder_config_.profile(), AudioCodecProfile::kXHE_AAC); } @@ -501,8 +517,8 @@ TEST_F(MP4StreamParserTest, HEVC_KeyAndNonKeyframeness_Match_Container) { params.detected_audio_track_count = 0; InitializeParserWithInitParametersExpectations(params); verifying_keyframeness_sequence_ = true; - EXPECT_CALL(*this, ParsedKeyframe()); - EXPECT_CALL(*this, ParsedNonKeyframe()); + EXPECT_CALL(keyframeness_cb_, Run(Keyframeness::kKeyframe)); + EXPECT_CALL(keyframeness_cb_, Run(Keyframeness::kNonKeyframe)); ParseMP4File("bear-320x240-v-2frames_frag-hevc.mp4", 256); } @@ -520,8 +536,8 @@ TEST_F(MP4StreamParserTest, HEVC_Keyframeness_Mismatches_Container) { EXPECT_MEDIA_LOG(DebugLog( "ISO-BMFF container metadata for video frame indicates that the frame is " "not a keyframe, but the video frame contents indicate the opposite.")); - EXPECT_CALL(*this, ParsedKeyframe()); - EXPECT_CALL(*this, ParsedNonKeyframe()); + EXPECT_CALL(keyframeness_cb_, Run(Keyframeness::kKeyframe)); + EXPECT_CALL(keyframeness_cb_, Run(Keyframeness::kNonKeyframe)); ParseMP4File( "bear-320x240-v-2frames-keyframe-is-non-sync-sample_frag-hevc.mp4", 256); } @@ -537,11 +553,11 @@ TEST_F(MP4StreamParserTest, HEVC_NonKeyframeness_Mismatches_Container) { params.detected_audio_track_count = 0; InitializeParserWithInitParametersExpectations(params); verifying_keyframeness_sequence_ = true; - EXPECT_CALL(*this, ParsedKeyframe()); + EXPECT_CALL(keyframeness_cb_, Run(Keyframeness::kKeyframe)); EXPECT_MEDIA_LOG(DebugLog( "ISO-BMFF container metadata for video frame indicates that the frame is " "a keyframe, but the video frame contents indicate the opposite.")); - EXPECT_CALL(*this, ParsedNonKeyframe()); + EXPECT_CALL(keyframeness_cb_, Run(Keyframeness::kNonKeyframe)); ParseMP4File( "bear-320x240-v-2frames-nonkeyframe-is-sync-sample_frag-hevc.mp4", 256); } diff --git a/chromium/media/formats/webm/webm_parser.cc b/chromium/media/formats/webm/webm_parser.cc index f59bec22748..a31fc1667cb 100644 --- a/chromium/media/formats/webm/webm_parser.cc +++ b/chromium/media/formats/webm/webm_parser.cc @@ -17,7 +17,9 @@ #include <iomanip> #include <limits> +#include "base/check_op.h" #include "base/logging.h" +#include "base/notreached.h" #include "base/numerics/safe_conversions.h" #include "base/stl_util.h" #include "media/formats/webm/webm_constants.h" |