Commit 99d61885 authored by jrummell@chromium.org's avatar jrummell@chromium.org

Improve container detection testing by testing additional containers (new...

Improve container detection testing by testing additional containers (new containers added https://codereview.chromium.org/16034004/). Also put back original reference URLs in source.

BUG=235108

Review URL: https://chromiumcodereview.appspot.com/15966005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203019 0039d316-1c4b-4281-b951-d872f2087c98
parent a4a08d0b
......@@ -231,7 +231,7 @@ static bool CheckBink(const uint8* buffer, int buffer_size) {
// Additional checks for a CAF container.
static bool CheckCaf(const uint8* buffer, int buffer_size) {
// Reference: Apple Core Audio Format Specification 1.0
// (http://goo.gl/Vgb9r)
// (https://developer.apple.com/library/mac/#documentation/MusicAudio/Reference/CAFSpec/CAF_spec/CAF_spec.html)
RCHECK(buffer_size >= 52);
BitReader reader(buffer, buffer_size);
......@@ -272,7 +272,7 @@ static bool kExtAudioIdValid[8] = { true, false, true, false, false, false,
// Additional checks for a DTS container.
static bool CheckDts(const uint8* buffer, int buffer_size) {
// Reference: ETSI TS 102 114 V1.3.1 (2011-08)
// (http://goo.gl/FhHrk)
// (http://www.etsi.org/deliver/etsi_ts/102100_102199/102114/01.03.01_60/ts_102114v010301p.pdf)
RCHECK(buffer_size > 11);
int offset = 0;
......@@ -327,7 +327,7 @@ static bool CheckDts(const uint8* buffer, int buffer_size) {
// Checks for a DV container.
static bool CheckDV(const uint8* buffer, int buffer_size) {
// Reference: SMPTE 314M (Annex A has differences with IEC 61834).
// (http://goo.gl/kMn6p)
// (http://standards.smpte.org/content/978-1-61482-454-1/st-314-2005/SEC1.body.pdf)
RCHECK(buffer_size > 11);
int offset = 0;
......@@ -390,7 +390,7 @@ static bool CheckDV(const uint8* buffer, int buffer_size) {
// Checks for a GSM container.
static bool CheckGsm(const uint8* buffer, int buffer_size) {
// Reference: ETSI EN 300 961 V8.1.1
// (http://goo.gl/h2VDS)
// (http://www.etsi.org/deliver/etsi_en/300900_300999/300961/08.01.01_60/en_300961v080101p.pdf)
// also http://tools.ietf.org/html/rfc3551#page-24
// GSM files have a 33 byte block, only first 4 bits are fixed.
RCHECK(buffer_size >= 1024); // Need enough data to do a decent check.
......@@ -947,7 +947,7 @@ static bool CheckMpeg4BitStream(const uint8* buffer, int buffer_size) {
// Additional checks for a MOV/QuickTime/MPEG4 container.
static bool CheckMov(const uint8* buffer, int buffer_size) {
// Reference: ISO/IEC 14496-12:2005(E).
// (http://goo.gl/OWH0Q)
// (http://standards.iso.org/ittf/PubliclyAvailableStandards/c061988_ISO_IEC_14496-12_2012.zip)
RCHECK(buffer_size > 8);
int offset = 0;
......@@ -1298,7 +1298,7 @@ enum VC1StartCodes {
// Checks for a VC1 bitstream container.
static bool CheckVC1(const uint8* buffer, int buffer_size) {
// Reference: SMPTE 421M
// (http://goo.gl/fLvaE)
// (http://standards.smpte.org/content/978-1-61482-555-5/st-421-2006/SEC1.body.pdf)
// However, no length ... simply scan for start code values.
// Expect to see SEQ | [ [ ENTRY ] PIC* ]*
// Note tags are very similar to H.264.
......
......@@ -111,38 +111,93 @@ void TestFile(MediaContainerName expected, const base::FilePath& filename) {
<< "Failure with file " << filename.value();
}
// Test several OGG files to ensure that the container is detected properly.
TEST(ContainerNamesTest, FileCheckOGG) {
TestFile(CONTAINER_OGG, GetTestDataFilePath("bear.ogv"));
TestFile(CONTAINER_OGG, GetTestDataFilePath("9ch.ogg"));
}
// Test several WAV files to ensure that the container is detected properly.
TEST(ContainerNamesTest, FileCheckWAV) {
TestFile(CONTAINER_WAV, GetTestDataFilePath("4ch.wav"));
TestFile(CONTAINER_WAV, GetTestDataFilePath("sfx_f32le.wav"));
TestFile(CONTAINER_WAV, GetTestDataFilePath("sfx_s16le.wav"));
}
// Test several MOV files to ensure that the container is detected properly.
TEST(ContainerNamesTest, FileCheckMOV) {
TestFile(CONTAINER_MOV, GetTestDataFilePath("bear-1280x720.mp4"));
TestFile(CONTAINER_MOV, GetTestDataFilePath("sfx.m4a"));
}
// Test several WEBM files to ensure that the container is detected properly.
TEST(ContainerNamesTest, FileCheckWEBM) {
TestFile(CONTAINER_WEBM, GetTestDataFilePath("bear-320x240.webm"));
TestFile(CONTAINER_WEBM, GetTestDataFilePath("no_streams.webm"));
TestFile(CONTAINER_WEBM, GetTestDataFilePath("webm_ebml_element"));
}
// Test several MP3 files to ensure that the container is detected properly.
TEST(ContainerNamesTest, FileCheckMP3) {
TestFile(CONTAINER_MP3, GetTestDataFilePath("id3_test.mp3"));
TestFile(CONTAINER_MP3, GetTestDataFilePath("sfx.mp3"));
}
TEST(ContainerNamesTest, FileCheckAC3) {
TestFile(CONTAINER_AC3, GetTestDataFilePath("bear.ac3"));
}
TEST(ContainerNamesTest, FileCheckAAC) {
TestFile(CONTAINER_AAC, GetTestDataFilePath("bear.adts"));
}
TEST(ContainerNamesTest, FileCheckAIFF) {
TestFile(CONTAINER_AIFF, GetTestDataFilePath("bear.aiff"));
}
TEST(ContainerNamesTest, FileCheckASF) {
TestFile(CONTAINER_ASF, GetTestDataFilePath("bear.asf"));
}
TEST(ContainerNamesTest, FileCheckAVI) {
TestFile(CONTAINER_AVI, GetTestDataFilePath("bear.avi"));
}
TEST(ContainerNamesTest, FileCheckEAC3) {
TestFile(CONTAINER_EAC3, GetTestDataFilePath("bear.eac3"));
}
TEST(ContainerNamesTest, FileCheckFLAC) {
TestFile(CONTAINER_FLAC, GetTestDataFilePath("bear.flac"));
}
TEST(ContainerNamesTest, FileCheckFLV) {
TestFile(CONTAINER_FLV, GetTestDataFilePath("bear.flv"));
}
TEST(ContainerNamesTest, FileCheckH261) {
TestFile(CONTAINER_H261, GetTestDataFilePath("bear.h261"));
}
TEST(ContainerNamesTest, FileCheckH263) {
TestFile(CONTAINER_H263, GetTestDataFilePath("bear.h263"));
}
TEST(ContainerNamesTest, FileCheckMJPEG) {
TestFile(CONTAINER_MJPEG, GetTestDataFilePath("bear.mjpeg"));
}
TEST(ContainerNamesTest, FileCheckMPEG2PS) {
TestFile(CONTAINER_MPEG2PS, GetTestDataFilePath("bear.mpeg"));
}
TEST(ContainerNamesTest, FileCheckMPEG2TS) {
TestFile(CONTAINER_MPEG2TS, GetTestDataFilePath("bear.m2ts"));
}
TEST(ContainerNamesTest, FileCheckRM) {
TestFile(CONTAINER_RM, GetTestDataFilePath("bear.rm"));
}
TEST(ContainerNamesTest, FileCheckSWF) {
TestFile(CONTAINER_SWF, GetTestDataFilePath("bear.swf"));
}
// Try a few non containers.
TEST(ContainerNamesTest, FileCheckUNKNOWN) {
TestFile(CONTAINER_UNKNOWN, GetTestDataFilePath("ten_byte_file"));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment