Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1083)

Unified Diff: media/ffmpeg/ffmpeg_common_unittest.cc

Issue 2497603003: Roll src/third_party/ffmpeg/ 3c7a09882..cdf4accee (3188 commits). (Closed)
Patch Set: Updated DEPS to ffmpeg origin/master Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/ffmpeg/ffmpeg_common.cc ('k') | media/ffmpeg/ffmpeg_regression_tests.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/ffmpeg/ffmpeg_common_unittest.cc
diff --git a/media/ffmpeg/ffmpeg_common_unittest.cc b/media/ffmpeg/ffmpeg_common_unittest.cc
index 098417ad9a07f70e4ede34cbb9ea542f56952013..393180db5ca84f178a34c8427171100cca882344 100644
--- a/media/ffmpeg/ffmpeg_common_unittest.cc
+++ b/media/ffmpeg/ffmpeg_common_unittest.cc
@@ -42,40 +42,43 @@ void TestConfigConvertExtraData(
EXPECT_TRUE(converter_fn.Run(stream, decoder_config));
// Store orig to let FFmpeg free whatever it allocated.
- AVCodecContext* codec_context = stream->codec;
- uint8_t* orig_extradata = codec_context->extradata;
- int orig_extradata_size = codec_context->extradata_size;
+ AVCodecParameters* codec_parameters = stream->codecpar;
+ uint8_t* orig_extradata = codec_parameters->extradata;
+ int orig_extradata_size = codec_parameters->extradata_size;
- // Valid combination: extra_data = NULL && size = 0.
- codec_context->extradata = NULL;
- codec_context->extradata_size = 0;
+ // Valid combination: extra_data = nullptr && size = 0.
+ codec_parameters->extradata = nullptr;
+ codec_parameters->extradata_size = 0;
EXPECT_TRUE(converter_fn.Run(stream, decoder_config));
- EXPECT_EQ(static_cast<size_t>(codec_context->extradata_size),
+ EXPECT_EQ(static_cast<size_t>(codec_parameters->extradata_size),
decoder_config->extra_data().size());
- // Valid combination: extra_data = non-NULL && size > 0.
- codec_context->extradata = &kExtraData[0];
- codec_context->extradata_size = arraysize(kExtraData);
+ // Valid combination: extra_data = non-nullptr && size > 0.
+ codec_parameters->extradata = &kExtraData[0];
+ codec_parameters->extradata_size = arraysize(kExtraData);
EXPECT_TRUE(converter_fn.Run(stream, decoder_config));
- EXPECT_EQ(static_cast<size_t>(codec_context->extradata_size),
+ EXPECT_EQ(static_cast<size_t>(codec_parameters->extradata_size),
decoder_config->extra_data().size());
- EXPECT_EQ(0, memcmp(codec_context->extradata,
- &decoder_config->extra_data()[0],
- decoder_config->extra_data().size()));
-
- // Invalid combination: extra_data = NULL && size != 0.
- codec_context->extradata = NULL;
- codec_context->extradata_size = 10;
- EXPECT_FALSE(converter_fn.Run(stream, decoder_config));
+ EXPECT_EQ(
+ 0, memcmp(codec_parameters->extradata, &decoder_config->extra_data()[0],
+ decoder_config->extra_data().size()));
+
+ // Possible combination: extra_data = nullptr && size != 0, but the converter
+ // function considers this valid and having no extra_data, due to behavior of
+ // avcodec_parameters_to_context().
+ codec_parameters->extradata = nullptr;
+ codec_parameters->extradata_size = 10;
+ EXPECT_TRUE(converter_fn.Run(stream, decoder_config));
+ EXPECT_EQ(0UL, decoder_config->extra_data().size());
- // Invalid combination: extra_data = non-NULL && size = 0.
- codec_context->extradata = &kExtraData[0];
- codec_context->extradata_size = 0;
+ // Invalid combination: extra_data = non-nullptr && size = 0.
+ codec_parameters->extradata = &kExtraData[0];
+ codec_parameters->extradata_size = 0;
EXPECT_FALSE(converter_fn.Run(stream, decoder_config));
// Restore orig values for sane cleanup.
- codec_context->extradata = orig_extradata;
- codec_context->extradata_size = orig_extradata_size;
+ codec_parameters->extradata = orig_extradata;
+ codec_parameters->extradata_size = orig_extradata_size;
}
TEST_F(FFmpegCommonTest, AVStreamToDecoderConfig) {
@@ -95,8 +98,8 @@ TEST_F(FFmpegCommonTest, AVStreamToDecoderConfig) {
i < format_context->nb_streams && (!found_audio || !found_video);
++i) {
AVStream* stream = format_context->streams[i];
- AVCodecContext* codec_context = stream->codec;
- AVMediaType codec_type = codec_context->codec_type;
+ AVCodecParameters* codec_parameters = stream->codecpar;
+ AVMediaType codec_type = codec_parameters->codec_type;
if (codec_type == AVMEDIA_TYPE_AUDIO) {
if (found_audio)
@@ -184,59 +187,6 @@ TEST_F(FFmpegCommonTest, VerifyFormatSizes) {
}
}
-TEST_F(FFmpegCommonTest, UTCDateToTime_Valid) {
- base::Time result;
- EXPECT_TRUE(FFmpegUTCDateToTime("2012-11-10 12:34:56", &result));
-
- base::Time::Exploded exploded;
- result.UTCExplode(&exploded);
- EXPECT_TRUE(exploded.HasValidValues());
- EXPECT_EQ(2012, exploded.year);
- EXPECT_EQ(11, exploded.month);
- EXPECT_EQ(6, exploded.day_of_week);
- EXPECT_EQ(10, exploded.day_of_month);
- EXPECT_EQ(12, exploded.hour);
- EXPECT_EQ(34, exploded.minute);
- EXPECT_EQ(56, exploded.second);
- EXPECT_EQ(0, exploded.millisecond);
-}
-
-TEST_F(FFmpegCommonTest, UTCDateToTime_Invalid) {
- const char* invalid_date_strings[] = {
- "",
- "2012-11-10",
- "12:34:56",
- "-- ::",
- "2012-11-10 12:34:",
- "2012-11-10 12::56",
- "2012-11-10 :34:56",
- "2012-11- 12:34:56",
- "2012--10 12:34:56",
- "-11-10 12:34:56",
- "2012-11 12:34:56",
- "2012-11-10-12 12:34:56",
- "2012-11-10 12:34",
- "2012-11-10 12:34:56:78",
- "ABCD-11-10 12:34:56",
- "2012-EF-10 12:34:56",
- "2012-11-GH 12:34:56",
- "2012-11-10 IJ:34:56",
- "2012-11-10 12:JL:56",
- "2012-11-10 12:34:MN",
- "2012-11-10 12:34:56.123",
- "2012-11-1012:34:56",
- "2012-11-10 12:34:56 UTC",
- };
-
- for (size_t i = 0; i < arraysize(invalid_date_strings); ++i) {
- const char* date_string = invalid_date_strings[i];
- base::Time result;
- EXPECT_FALSE(FFmpegUTCDateToTime(date_string, &result))
- << "date_string '" << date_string << "'";
- EXPECT_TRUE(result.is_null());
- }
-}
-
// Verifies there are no collisions of the codec name hashes used for UMA. Also
// includes code for updating the histograms XML.
TEST_F(FFmpegCommonTest, VerifyUmaCodecHashes) {
« no previous file with comments | « media/ffmpeg/ffmpeg_common.cc ('k') | media/ffmpeg/ffmpeg_regression_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698