summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/gtest
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /media/libstagefright/gtest
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'media/libstagefright/gtest')
-rw-r--r--media/libstagefright/gtest/TestInterval.cpp89
-rw-r--r--media/libstagefright/gtest/TestMP4Rust.cpp142
-rw-r--r--media/libstagefright/gtest/TestParser.cpp479
-rw-r--r--media/libstagefright/gtest/moz.build49
-rw-r--r--media/libstagefright/gtest/test_case_1156505.mp4bin0 -> 296 bytes
-rw-r--r--media/libstagefright/gtest/test_case_1181213.mp4bin0 -> 2834 bytes
-rw-r--r--media/libstagefright/gtest/test_case_1181215.mp4bin0 -> 3086 bytes
-rw-r--r--media/libstagefright/gtest/test_case_1181220.mp4bin0 -> 2834 bytes
-rw-r--r--media/libstagefright/gtest/test_case_1181223.mp4bin0 -> 2834 bytes
-rw-r--r--media/libstagefright/gtest/test_case_1181719.mp4bin0 -> 3095 bytes
-rw-r--r--media/libstagefright/gtest/test_case_1185230.mp4bin0 -> 3250 bytes
-rw-r--r--media/libstagefright/gtest/test_case_1187067.mp4bin0 -> 2835 bytes
-rw-r--r--media/libstagefright/gtest/test_case_1200326.mp4bin0 -> 1694 bytes
-rw-r--r--media/libstagefright/gtest/test_case_1204580.mp4bin0 -> 5833 bytes
-rwxr-xr-xmedia/libstagefright/gtest/test_case_1216748.mp4bin0 -> 296 bytes
-rw-r--r--media/libstagefright/gtest/test_case_1296473.mp4bin0 -> 5995 bytes
-rw-r--r--media/libstagefright/gtest/test_case_1296532.mp4bin0 -> 152132 bytes
-rw-r--r--media/libstagefright/gtest/test_case_1301065-harder.mp4bin0 -> 632 bytes
-rw-r--r--media/libstagefright/gtest/test_case_1301065-i64max.mp4bin0 -> 632 bytes
-rw-r--r--media/libstagefright/gtest/test_case_1301065-i64min.mp4bin0 -> 632 bytes
-rw-r--r--media/libstagefright/gtest/test_case_1301065-max-ez.mp4bin0 -> 632 bytes
-rw-r--r--media/libstagefright/gtest/test_case_1301065-max-ok.mp4bin0 -> 632 bytes
-rw-r--r--media/libstagefright/gtest/test_case_1301065-overfl.mp4bin0 -> 632 bytes
-rw-r--r--media/libstagefright/gtest/test_case_1301065-u32max.mp4bin0 -> 632 bytes
-rw-r--r--media/libstagefright/gtest/test_case_1301065-u64max.mp4bin0 -> 632 bytes
-rw-r--r--media/libstagefright/gtest/test_case_1301065.mp4bin0 -> 632 bytes
-rw-r--r--media/libstagefright/gtest/test_case_1351094.mp4bin0 -> 80388 bytes
27 files changed, 759 insertions, 0 deletions
diff --git a/media/libstagefright/gtest/TestInterval.cpp b/media/libstagefright/gtest/TestInterval.cpp
new file mode 100644
index 000000000..68aa3b126
--- /dev/null
+++ b/media/libstagefright/gtest/TestInterval.cpp
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "gtest/gtest.h"
+#include "mp4_demuxer/Interval.h"
+
+using namespace mp4_demuxer;
+using namespace mozilla;
+
+TEST(Interval, Length)
+{
+ Interval<int> i(15, 25);
+ EXPECT_EQ(10, i.Length());
+}
+
+TEST(Interval, Intersection)
+{
+ Interval<int> i0(10, 20);
+ Interval<int> i1(15, 25);
+ Interval<int> i = i0.Intersection(i1);
+ EXPECT_EQ(15, i.start);
+ EXPECT_EQ(20, i.end);
+}
+
+TEST(Interval, Equals)
+{
+ Interval<int> i0(10, 20);
+ Interval<int> i1(10, 20);
+ EXPECT_EQ(i0, i1);
+
+ Interval<int> i2(5, 20);
+ EXPECT_NE(i0, i2);
+
+ Interval<int> i3(10, 15);
+ EXPECT_NE(i0, i2);
+}
+
+TEST(Interval, IntersectionVector)
+{
+ nsTArray<Interval<int>> i0;
+ i0.AppendElement(Interval<int>(5, 10));
+ i0.AppendElement(Interval<int>(20, 25));
+ i0.AppendElement(Interval<int>(40, 60));
+
+ nsTArray<Interval<int>> i1;
+ i1.AppendElement(Interval<int>(7, 15));
+ i1.AppendElement(Interval<int>(16, 27));
+ i1.AppendElement(Interval<int>(45, 50));
+ i1.AppendElement(Interval<int>(53, 57));
+
+ nsTArray<Interval<int>> i;
+ Interval<int>::Intersection(i0, i1, &i);
+
+ EXPECT_EQ(4u, i.Length());
+
+ EXPECT_EQ(7, i[0].start);
+ EXPECT_EQ(10, i[0].end);
+
+ EXPECT_EQ(20, i[1].start);
+ EXPECT_EQ(25, i[1].end);
+
+ EXPECT_EQ(45, i[2].start);
+ EXPECT_EQ(50, i[2].end);
+
+ EXPECT_EQ(53, i[3].start);
+ EXPECT_EQ(57, i[3].end);
+}
+
+TEST(Interval, Normalize)
+{
+ nsTArray<Interval<int>> i;
+ i.AppendElement(Interval<int>(20, 30));
+ i.AppendElement(Interval<int>(1, 8));
+ i.AppendElement(Interval<int>(5, 10));
+ i.AppendElement(Interval<int>(2, 7));
+
+ nsTArray<Interval<int>> o;
+ Interval<int>::Normalize(i, &o);
+
+ EXPECT_EQ(2u, o.Length());
+
+ EXPECT_EQ(1, o[0].start);
+ EXPECT_EQ(10, o[0].end);
+
+ EXPECT_EQ(20, o[1].start);
+ EXPECT_EQ(30, o[1].end);
+}
diff --git a/media/libstagefright/gtest/TestMP4Rust.cpp b/media/libstagefright/gtest/TestMP4Rust.cpp
new file mode 100644
index 000000000..a338b5386
--- /dev/null
+++ b/media/libstagefright/gtest/TestMP4Rust.cpp
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "gtest/gtest.h"
+#include "mp4parse.h"
+
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <algorithm>
+#include <vector>
+
+static intptr_t
+error_reader(uint8_t* buffer, uintptr_t size, void* userdata)
+{
+ return -1;
+}
+
+struct read_vector {
+ explicit read_vector(FILE* file, size_t length);
+ explicit read_vector(size_t length);
+
+ size_t location;
+ std::vector<uint8_t> buffer;
+};
+
+read_vector::read_vector(FILE* file, size_t length)
+ : location(0)
+{
+ buffer.resize(length);
+ size_t read = fread(buffer.data(), sizeof(decltype(buffer)::value_type),
+ buffer.size(), file);
+ buffer.resize(read);
+}
+
+read_vector::read_vector(size_t length)
+ : location(0)
+{
+ buffer.resize(length, 0);
+}
+
+static intptr_t
+vector_reader(uint8_t* buffer, uintptr_t size, void* userdata)
+{
+ if (!buffer || !userdata) {
+ return -1;
+ }
+
+ auto source = reinterpret_cast<read_vector*>(userdata);
+ if (source->location > source->buffer.size()) {
+ return -1;
+ }
+ uintptr_t available = source->buffer.size() - source->location;
+ uintptr_t length = std::min(available, size);
+ memcpy(buffer, source->buffer.data() + source->location, length);
+ source->location += length;
+ return length;
+}
+
+TEST(rust, MP4MetadataEmpty)
+{
+ mp4parse_error rv;
+ mp4parse_io io;
+
+ // Shouldn't be able to read with no context.
+ rv = mp4parse_read(nullptr);
+ EXPECT_EQ(rv, MP4PARSE_ERROR_BADARG);
+
+ // Shouldn't be able to wrap an mp4parse_io with null members.
+ io = { nullptr, nullptr };
+ mp4parse_parser* context = mp4parse_new(&io);
+ EXPECT_EQ(context, nullptr);
+
+ io = { nullptr, &io };
+ context = mp4parse_new(&io);
+ EXPECT_EQ(context, nullptr);
+
+ // FIXME: this should probably be accepted.
+ io = { error_reader, nullptr };
+ context = mp4parse_new(&io);
+ EXPECT_EQ(context, nullptr);
+
+ // Read method errors should propagate.
+ io = { error_reader, &io };
+ context = mp4parse_new(&io);
+ ASSERT_NE(context, nullptr);
+ rv = mp4parse_read(context);
+ EXPECT_EQ(rv, MP4PARSE_ERROR_IO);
+ mp4parse_free(context);
+
+ // Short buffers should fail.
+ read_vector buf(0);
+ io = { vector_reader, &buf };
+ context = mp4parse_new(&io);
+ ASSERT_NE(context, nullptr);
+ rv = mp4parse_read(context);
+ EXPECT_EQ(rv, MP4PARSE_ERROR_INVALID);
+ mp4parse_free(context);
+
+ buf.buffer.reserve(4097);
+ context = mp4parse_new(&io);
+ ASSERT_NE(context, nullptr);
+ rv = mp4parse_read(context);
+ EXPECT_EQ(rv, MP4PARSE_ERROR_INVALID);
+ mp4parse_free(context);
+
+ // Empty buffers should fail.
+ buf.buffer.resize(4097, 0);
+ context = mp4parse_new(&io);
+ rv = mp4parse_read(context);
+ EXPECT_EQ(rv, MP4PARSE_ERROR_UNSUPPORTED);
+ mp4parse_free(context);
+}
+
+TEST(rust, MP4Metadata)
+{
+ FILE* f = fopen("street.mp4", "rb");
+ ASSERT_TRUE(f != nullptr);
+ // Read just the moov header to work around the parser
+ // treating mid-box eof as an error.
+ //read_vector reader = read_vector(f, 1061);
+ struct stat s;
+ ASSERT_EQ(0, fstat(fileno(f), &s));
+ read_vector reader = read_vector(f, s.st_size);
+ fclose(f);
+
+ mp4parse_io io = { vector_reader, &reader };
+ mp4parse_parser* context = mp4parse_new(&io);
+ ASSERT_NE(nullptr, context);
+
+ mp4parse_error rv = mp4parse_read(context);
+ EXPECT_EQ(MP4PARSE_OK, rv);
+
+ uint32_t tracks = 0;
+ rv = mp4parse_get_track_count(context, &tracks);
+ EXPECT_EQ(MP4PARSE_OK, rv);
+ EXPECT_EQ(2U, tracks);
+
+ mp4parse_free(context);
+}
diff --git a/media/libstagefright/gtest/TestParser.cpp b/media/libstagefright/gtest/TestParser.cpp
new file mode 100644
index 000000000..caaca6c70
--- /dev/null
+++ b/media/libstagefright/gtest/TestParser.cpp
@@ -0,0 +1,479 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "gtest/gtest.h"
+#include "MediaData.h"
+#include "mozilla/ArrayUtils.h"
+#include "mp4_demuxer/BufferStream.h"
+#include "mp4_demuxer/MP4Metadata.h"
+#include "mp4_demuxer/MoofParser.h"
+
+using namespace mozilla;
+using namespace mp4_demuxer;
+
+class TestStream : public Stream
+{
+public:
+ TestStream(const uint8_t* aBuffer, size_t aSize)
+ : mHighestSuccessfulEndOffset(0)
+ , mBuffer(aBuffer)
+ , mSize(aSize)
+ {
+ }
+ bool ReadAt(int64_t aOffset, void* aData, size_t aLength,
+ size_t* aBytesRead) override
+ {
+ if (aOffset < 0 || aOffset > static_cast<int64_t>(mSize)) {
+ return false;
+ }
+ // After the test, 0 <= aOffset <= mSize <= SIZE_MAX, so it's safe to cast to size_t.
+ size_t offset = static_cast<size_t>(aOffset);
+ // Don't read past the end (but it's not an error to try).
+ if (aLength > mSize - offset) {
+ aLength = mSize - offset;
+ }
+ // Now, 0 <= offset <= offset + aLength <= mSize <= SIZE_MAX.
+ *aBytesRead = aLength;
+ memcpy(aData, mBuffer + offset, aLength);
+ if (mHighestSuccessfulEndOffset < offset + aLength)
+ {
+ mHighestSuccessfulEndOffset = offset + aLength;
+ }
+ return true;
+ }
+ bool CachedReadAt(int64_t aOffset, void* aData, size_t aLength,
+ size_t* aBytesRead) override
+ {
+ return ReadAt(aOffset, aData, aLength, aBytesRead);
+ }
+ bool Length(int64_t* aLength) override
+ {
+ *aLength = mSize;
+ return true;
+ }
+ void DiscardBefore(int64_t aOffset) override
+ {
+ }
+
+ // Offset past the last character ever read. 0 when nothing read yet.
+ size_t mHighestSuccessfulEndOffset;
+protected:
+ virtual ~TestStream()
+ {
+ }
+
+ const uint8_t* mBuffer;
+ size_t mSize;
+};
+
+TEST(stagefright_MP4Metadata, EmptyStream)
+{
+ RefPtr<Stream> stream = new TestStream(nullptr, 0);
+
+ EXPECT_FALSE(MP4Metadata::HasCompleteMetadata(stream));
+ RefPtr<MediaByteBuffer> metadataBuffer = MP4Metadata::Metadata(stream);
+ EXPECT_FALSE(metadataBuffer);
+
+ MP4Metadata metadata(stream);
+ EXPECT_EQ(0u, metadata.GetNumberTracks(TrackInfo::kUndefinedTrack));
+ EXPECT_EQ(0u, metadata.GetNumberTracks(TrackInfo::kAudioTrack));
+ EXPECT_EQ(0u, metadata.GetNumberTracks(TrackInfo::kVideoTrack));
+ EXPECT_EQ(0u, metadata.GetNumberTracks(TrackInfo::kTextTrack));
+ EXPECT_EQ(0u, metadata.GetNumberTracks(static_cast<TrackInfo::TrackType>(-1)));
+ EXPECT_FALSE(metadata.GetTrackInfo(TrackInfo::kUndefinedTrack, 0));
+ EXPECT_FALSE(metadata.GetTrackInfo(TrackInfo::kAudioTrack, 0));
+ EXPECT_FALSE(metadata.GetTrackInfo(TrackInfo::kVideoTrack, 0));
+ EXPECT_FALSE(metadata.GetTrackInfo(TrackInfo::kTextTrack, 0));
+ EXPECT_FALSE(metadata.GetTrackInfo(static_cast<TrackInfo::TrackType>(-1), 0));
+ // We can seek anywhere in any MPEG4.
+ EXPECT_TRUE(metadata.CanSeek());
+ EXPECT_FALSE(metadata.Crypto().valid);
+}
+
+TEST(stagefright_MoofParser, EmptyStream)
+{
+ RefPtr<Stream> stream = new TestStream(nullptr, 0);
+
+ MoofParser parser(stream, 0, false);
+ EXPECT_EQ(0u, parser.mOffset);
+ EXPECT_TRUE(parser.ReachedEnd());
+
+ MediaByteRangeSet byteRanges;
+ EXPECT_FALSE(parser.RebuildFragmentedIndex(byteRanges));
+
+ EXPECT_TRUE(parser.GetCompositionRange(byteRanges).IsNull());
+ EXPECT_TRUE(parser.mInitRange.IsEmpty());
+ EXPECT_EQ(0u, parser.mOffset);
+ EXPECT_TRUE(parser.ReachedEnd());
+ EXPECT_FALSE(parser.HasMetadata());
+ RefPtr<MediaByteBuffer> metadataBuffer = parser.Metadata();
+ EXPECT_FALSE(metadataBuffer);
+ EXPECT_TRUE(parser.FirstCompleteMediaSegment().IsEmpty());
+ EXPECT_TRUE(parser.FirstCompleteMediaHeader().IsEmpty());
+}
+
+nsTArray<uint8_t>
+ReadTestFile(const char* aFilename)
+{
+ if (!aFilename) {
+ return {};
+ }
+ FILE* f = fopen(aFilename, "rb");
+ if (!f) {
+ return {};
+ }
+
+ if (fseek(f, 0, SEEK_END) != 0) {
+ fclose(f);
+ return {};
+ }
+ long position = ftell(f);
+ // I know EOF==-1, so this test is made obsolete by '<0', but I don't want
+ // the code to rely on that.
+ if (position == 0 || position == EOF || position < 0) {
+ fclose(f);
+ return {};
+ }
+ if (fseek(f, 0, SEEK_SET) != 0) {
+ fclose(f);
+ return {};
+ }
+
+ size_t len = static_cast<size_t>(position);
+ nsTArray<uint8_t> buffer(len);
+ buffer.SetLength(len);
+ size_t read = fread(buffer.Elements(), 1, len, f);
+ fclose(f);
+ if (read != len) {
+ return {};
+ }
+
+ return buffer;
+}
+
+struct TestFileData
+{
+ const char* mFilename;
+ uint32_t mNumberVideoTracks;
+ int64_t mVideoDuration; // For first video track, -1 if N/A.
+ int32_t mWidth;
+ int32_t mHeight;
+ uint32_t mNumberAudioTracks;
+ int64_t mAudioDuration; // For first audio track, -1 if N/A.
+ bool mHasCrypto;
+ uint64_t mMoofReachedOffset; // or 0 for the end.
+ bool mValidMoof;
+ bool mHeader;
+};
+static const TestFileData testFiles[] = {
+ // filename #V dur w h #A dur crypt off moof headr
+ { "test_case_1156505.mp4", 0, -1, 0, 0, 0, -1, false, 152, false, false },
+ { "test_case_1181213.mp4", 0, -1, 0, 0, 0, -1, false, 0, false, false },
+ { "test_case_1181215.mp4", 0, -1, 0, 0, 0, -1, false, 0, false, false },
+ { "test_case_1181220.mp4", 0, -1, 0, 0, 0, -1, false, 0, false, false },
+ { "test_case_1181223.mp4", 0, -1, 0, 0, 0, -1, false, 0, false, false },
+ { "test_case_1181719.mp4", 0, -1, 0, 0, 0, -1, false, 0, false, false },
+ { "test_case_1185230.mp4", 1, 416666,
+ 320, 240, 1, 5, false, 0, false, false },
+ { "test_case_1187067.mp4", 1, 80000,
+ 160, 90, 0, -1, false, 0, false, false },
+ { "test_case_1200326.mp4", 0, -1, 0, 0, 0, -1, false, 0, false, false },
+ { "test_case_1204580.mp4", 1, 502500,
+ 320, 180, 0, -1, false, 0, false, false },
+ { "test_case_1216748.mp4", 0, -1, 0, 0, 0, -1, false, 152, false, false },
+ { "test_case_1296473.mp4", 0, -1, 0, 0, 0, -1, false, 0, false, false },
+ { "test_case_1296532.mp4", 1, 5589333,
+ 560, 320, 1, 5589333,
+ true, 0, true, true },
+ { "test_case_1301065.mp4", 0, -1, 0, 0, 1, 100079991719000000,
+ false, 0, false, false },
+ { "test_case_1301065-u32max.mp4", 0, -1, 0, 0, 1, 97391548639,
+ false, 0, false, false },
+ { "test_case_1301065-max-ez.mp4", 0, -1, 0, 0, 1, 209146758205306,
+ false, 0, false, false },
+ { "test_case_1301065-harder.mp4", 0, -1, 0, 0, 1, 209146758205328,
+ false, 0, false, false },
+ { "test_case_1301065-max-ok.mp4", 0, -1, 0, 0, 1, 9223372036854775804,
+ false, 0, false, false },
+ { "test_case_1301065-overfl.mp4", 0, -1, 0, 0, 0, -1, false, 0, false, false },
+ { "test_case_1301065-i64max.mp4", 0, -1, 0, 0, 0, -1, false, 0, false, false },
+ { "test_case_1301065-i64min.mp4", 0, -1, 0, 0, 0, -1, false, 0, false, false },
+ { "test_case_1301065-u64max.mp4", 0, -1, 0, 0, 1, 0, false, 0, false, false },
+ { "test_case_1351094.mp4", 0, -1, 0, 0, 0, -1, false, 0, true, true },
+};
+
+TEST(stagefright_MPEG4Metadata, test_case_mp4)
+{
+ for (size_t test = 0; test < ArrayLength(testFiles); ++test) {
+ nsTArray<uint8_t> buffer = ReadTestFile(testFiles[test].mFilename);
+ ASSERT_FALSE(buffer.IsEmpty());
+ RefPtr<Stream> stream = new TestStream(buffer.Elements(), buffer.Length());
+
+ EXPECT_TRUE(MP4Metadata::HasCompleteMetadata(stream));
+ RefPtr<MediaByteBuffer> metadataBuffer = MP4Metadata::Metadata(stream);
+ EXPECT_TRUE(metadataBuffer);
+
+ MP4Metadata metadata(stream);
+ EXPECT_EQ(0u, metadata.GetNumberTracks(TrackInfo::kUndefinedTrack));
+ EXPECT_EQ(testFiles[test].mNumberAudioTracks,
+ metadata.GetNumberTracks(TrackInfo::kAudioTrack));
+ EXPECT_EQ(testFiles[test].mNumberVideoTracks,
+ metadata.GetNumberTracks(TrackInfo::kVideoTrack));
+ EXPECT_EQ(0u, metadata.GetNumberTracks(TrackInfo::kTextTrack));
+ EXPECT_EQ(0u, metadata.GetNumberTracks(static_cast<TrackInfo::TrackType>(-1)));
+ EXPECT_FALSE(metadata.GetTrackInfo(TrackInfo::kUndefinedTrack, 0));
+ UniquePtr<TrackInfo> trackInfo = metadata.GetTrackInfo(TrackInfo::kVideoTrack, 0);
+ if (testFiles[test].mNumberVideoTracks == 0) {
+ EXPECT_TRUE(!trackInfo);
+ } else {
+ ASSERT_TRUE(!!trackInfo);
+ const VideoInfo* videoInfo = trackInfo->GetAsVideoInfo();
+ ASSERT_TRUE(!!videoInfo);
+ EXPECT_TRUE(videoInfo->IsValid());
+ EXPECT_TRUE(videoInfo->IsVideo());
+ EXPECT_EQ(testFiles[test].mVideoDuration, videoInfo->mDuration);
+ EXPECT_EQ(testFiles[test].mWidth, videoInfo->mDisplay.width);
+ EXPECT_EQ(testFiles[test].mHeight, videoInfo->mDisplay.height);
+ FallibleTArray<mp4_demuxer::Index::Indice> indices;
+ EXPECT_TRUE(metadata.ReadTrackIndex(indices, videoInfo->mTrackId));
+ for (const mp4_demuxer::Index::Indice& indice : indices) {
+ EXPECT_TRUE(indice.start_offset <= indice.end_offset);
+ EXPECT_TRUE(indice.start_composition <= indice.end_composition);
+ }
+ }
+ trackInfo = metadata.GetTrackInfo(TrackInfo::kAudioTrack, 0);
+ if (testFiles[test].mNumberAudioTracks == 0) {
+ EXPECT_TRUE(!trackInfo);
+ } else {
+ ASSERT_TRUE(!!trackInfo);
+ const AudioInfo* audioInfo = trackInfo->GetAsAudioInfo();
+ ASSERT_TRUE(!!audioInfo);
+ EXPECT_TRUE(audioInfo->IsValid());
+ EXPECT_TRUE(audioInfo->IsAudio());
+ EXPECT_EQ(testFiles[test].mAudioDuration, audioInfo->mDuration);
+ FallibleTArray<mp4_demuxer::Index::Indice> indices;
+ EXPECT_TRUE(metadata.ReadTrackIndex(indices, audioInfo->mTrackId));
+ for (const mp4_demuxer::Index::Indice& indice : indices) {
+ EXPECT_TRUE(indice.start_offset <= indice.end_offset);
+ EXPECT_TRUE(indice.start_composition <= indice.end_composition);
+ }
+ }
+ EXPECT_FALSE(metadata.GetTrackInfo(TrackInfo::kTextTrack, 0));
+ EXPECT_FALSE(metadata.GetTrackInfo(static_cast<TrackInfo::TrackType>(-1), 0));
+ // We can see anywhere in any MPEG4.
+ EXPECT_TRUE(metadata.CanSeek());
+ EXPECT_EQ(testFiles[test].mHasCrypto, metadata.Crypto().valid);
+ }
+}
+
+// Bug 1224019: This test produces way to much output, disabling for now.
+#if 0
+TEST(stagefright_MPEG4Metadata, test_case_mp4_subsets)
+{
+ static const size_t step = 1u;
+ for (size_t test = 0; test < ArrayLength(testFiles); ++test) {
+ nsTArray<uint8_t> buffer = ReadTestFile(testFiles[test].mFilename);
+ ASSERT_FALSE(buffer.IsEmpty());
+ ASSERT_LE(step, buffer.Length());
+ // Just exercizing the parser starting at different points through the file,
+ // making sure it doesn't crash.
+ // No checks because results would differ for each position.
+ for (size_t offset = 0; offset < buffer.Length() - step; offset += step) {
+ size_t size = buffer.Length() - offset;
+ while (size > 0) {
+ RefPtr<TestStream> stream =
+ new TestStream(buffer.Elements() + offset, size);
+
+ MP4Metadata::HasCompleteMetadata(stream);
+ RefPtr<MediaByteBuffer> metadataBuffer = MP4Metadata::Metadata(stream);
+ MP4Metadata metadata(stream);
+
+ if (stream->mHighestSuccessfulEndOffset <= 0) {
+ // No successful reads -> Cutting down the size won't change anything.
+ break;
+ }
+ if (stream->mHighestSuccessfulEndOffset < size) {
+ // Read up to a point before the end -> Resize down to that point.
+ size = stream->mHighestSuccessfulEndOffset;
+ } else {
+ // Read up to the end (or after?!) -> Just cut 1 byte.
+ size -= 1;
+ }
+ }
+ }
+ }
+}
+#endif
+
+TEST(stagefright_MoofParser, test_case_mp4)
+{
+ for (size_t test = 0; test < ArrayLength(testFiles); ++test) {
+ nsTArray<uint8_t> buffer = ReadTestFile(testFiles[test].mFilename);
+ ASSERT_FALSE(buffer.IsEmpty());
+ RefPtr<Stream> stream = new TestStream(buffer.Elements(), buffer.Length());
+
+ MoofParser parser(stream, 0, false);
+ EXPECT_EQ(0u, parser.mOffset);
+ EXPECT_FALSE(parser.ReachedEnd());
+ EXPECT_TRUE(parser.mInitRange.IsEmpty());
+
+ EXPECT_TRUE(parser.HasMetadata());
+ RefPtr<MediaByteBuffer> metadataBuffer = parser.Metadata();
+ EXPECT_TRUE(metadataBuffer);
+
+ EXPECT_FALSE(parser.mInitRange.IsEmpty());
+ const MediaByteRangeSet byteRanges(
+ MediaByteRange(0, int64_t(buffer.Length())));
+ EXPECT_EQ(testFiles[test].mValidMoof,
+ parser.RebuildFragmentedIndex(byteRanges));
+ if (testFiles[test].mMoofReachedOffset == 0) {
+ EXPECT_EQ(buffer.Length(), parser.mOffset);
+ EXPECT_TRUE(parser.ReachedEnd());
+ } else {
+ EXPECT_EQ(testFiles[test].mMoofReachedOffset, parser.mOffset);
+ EXPECT_FALSE(parser.ReachedEnd());
+ }
+
+ EXPECT_FALSE(parser.mInitRange.IsEmpty());
+ EXPECT_TRUE(parser.GetCompositionRange(byteRanges).IsNull());
+ EXPECT_TRUE(parser.FirstCompleteMediaSegment().IsEmpty());
+ EXPECT_EQ(testFiles[test].mHeader,
+ !parser.FirstCompleteMediaHeader().IsEmpty());
+ }
+}
+
+// Bug 1224019: This test produces way to much output, disabling for now.
+#if 0
+TEST(stagefright_MoofParser, test_case_mp4_subsets)
+{
+ const size_t step = 1u;
+ for (size_t test = 0; test < ArrayLength(testFiles); ++test) {
+ nsTArray<uint8_t> buffer = ReadTestFile(testFiles[test].mFilename);
+ ASSERT_FALSE(buffer.IsEmpty());
+ ASSERT_LE(step, buffer.Length());
+ // Just exercizing the parser starting at different points through the file,
+ // making sure it doesn't crash.
+ // No checks because results would differ for each position.
+ for (size_t offset = 0; offset < buffer.Length() - step; offset += step) {
+ size_t size = buffer.Length() - offset;
+ while (size > 0) {
+ RefPtr<TestStream> stream =
+ new TestStream(buffer.Elements() + offset, size);
+
+ MoofParser parser(stream, 0, false);
+ MediaByteRangeSet byteRanges;
+ EXPECT_FALSE(parser.RebuildFragmentedIndex(byteRanges));
+ parser.GetCompositionRange(byteRanges);
+ parser.HasMetadata();
+ RefPtr<MediaByteBuffer> metadataBuffer = parser.Metadata();
+ parser.FirstCompleteMediaSegment();
+ parser.FirstCompleteMediaHeader();
+
+ if (stream->mHighestSuccessfulEndOffset <= 0) {
+ // No successful reads -> Cutting down the size won't change anything.
+ break;
+ }
+ if (stream->mHighestSuccessfulEndOffset < size) {
+ // Read up to a point before the end -> Resize down to that point.
+ size = stream->mHighestSuccessfulEndOffset;
+ } else {
+ // Read up to the end (or after?!) -> Just cut 1 byte.
+ size -= 1;
+ }
+ }
+ }
+ }
+}
+#endif
+
+uint8_t media_libstagefright_gtest_video_init_mp4[] = {
+ 0x00, 0x00, 0x00, 0x18, 0x66, 0x74, 0x79, 0x70, 0x69, 0x73, 0x6f, 0x6d,
+ 0x00, 0x00, 0x00, 0x01, 0x69, 0x73, 0x6f, 0x6d, 0x61, 0x76, 0x63, 0x31,
+ 0x00, 0x00, 0x02, 0xd1, 0x6d, 0x6f, 0x6f, 0x76, 0x00, 0x00, 0x00, 0x6c,
+ 0x6d, 0x76, 0x68, 0x64, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x49, 0x73, 0xf8,
+ 0xc8, 0x4a, 0xc5, 0x7a, 0x00, 0x00, 0x02, 0x58, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18,
+ 0x69, 0x6f, 0x64, 0x73, 0x00, 0x00, 0x00, 0x00, 0x10, 0x80, 0x80, 0x80,
+ 0x07, 0x00, 0x4f, 0xff, 0xff, 0x29, 0x15, 0xff, 0x00, 0x00, 0x02, 0x0d,
+ 0x74, 0x72, 0x61, 0x6b, 0x00, 0x00, 0x00, 0x5c, 0x74, 0x6b, 0x68, 0x64,
+ 0x00, 0x00, 0x00, 0x01, 0xc8, 0x49, 0x73, 0xf8, 0xc8, 0x49, 0x73, 0xf9,
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x40, 0x00, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x01, 0x68, 0x00, 0x00,
+ 0x00, 0x00, 0x01, 0xa9, 0x6d, 0x64, 0x69, 0x61, 0x00, 0x00, 0x00, 0x20,
+ 0x6d, 0x64, 0x68, 0x64, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x49, 0x73, 0xf8,
+ 0xc8, 0x49, 0x73, 0xf9, 0x00, 0x00, 0x75, 0x30, 0x00, 0x00, 0x00, 0x00,
+ 0x55, 0xc4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x68, 0x64, 0x6c, 0x72,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x69, 0x64, 0x65,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x47, 0x50, 0x41, 0x43, 0x20, 0x49, 0x53, 0x4f, 0x20, 0x56, 0x69, 0x64,
+ 0x65, 0x6f, 0x20, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00, 0x00,
+ 0x00, 0x00, 0x01, 0x49, 0x6d, 0x69, 0x6e, 0x66, 0x00, 0x00, 0x00, 0x14,
+ 0x76, 0x6d, 0x68, 0x64, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x64, 0x69, 0x6e, 0x66,
+ 0x00, 0x00, 0x00, 0x1c, 0x64, 0x72, 0x65, 0x66, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x75, 0x72, 0x6c, 0x20,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x09, 0x73, 0x74, 0x62, 0x6c,
+ 0x00, 0x00, 0x00, 0xad, 0x73, 0x74, 0x73, 0x64, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x9d, 0x61, 0x76, 0x63, 0x31,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x80, 0x01, 0x68, 0x00, 0x48, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x18, 0xff, 0xff, 0x00, 0x00, 0x00, 0x33, 0x61, 0x76,
+ 0x63, 0x43, 0x01, 0x64, 0x00, 0x1f, 0xff, 0xe1, 0x00, 0x1b, 0x67, 0x64,
+ 0x00, 0x1f, 0xac, 0x2c, 0xc5, 0x02, 0x80, 0xbf, 0xe5, 0xc0, 0x44, 0x00,
+ 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, 0x03, 0x00, 0xf2, 0x3c, 0x60, 0xc6,
+ 0x58, 0x01, 0x00, 0x05, 0x68, 0xe9, 0x2b, 0x2c, 0x8b, 0x00, 0x00, 0x00,
+ 0x14, 0x62, 0x74, 0x72, 0x74, 0x00, 0x01, 0x5a, 0xc2, 0x00, 0x24, 0x74,
+ 0x38, 0x00, 0x09, 0x22, 0x00, 0x00, 0x00, 0x00, 0x10, 0x73, 0x74, 0x74,
+ 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x63, 0x74, 0x74, 0x73, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x73, 0x74, 0x73, 0x63, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x73, 0x74, 0x73,
+ 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x73, 0x74, 0x63, 0x6f, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6d, 0x76, 0x65,
+ 0x78, 0x00, 0x00, 0x00, 0x10, 0x6d, 0x65, 0x68, 0x64, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x05, 0x76, 0x18, 0x00, 0x00, 0x00, 0x20, 0x74, 0x72, 0x65,
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x03, 0xe8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
+ 0x00
+};
+
+const uint32_t media_libstagefright_gtest_video_init_mp4_len = 745;
+
+TEST(stagefright_MP4Metadata, EmptyCTTS)
+{
+ RefPtr<MediaByteBuffer> buffer = new MediaByteBuffer(media_libstagefright_gtest_video_init_mp4_len);
+ buffer->AppendElements(media_libstagefright_gtest_video_init_mp4, media_libstagefright_gtest_video_init_mp4_len);
+ RefPtr<BufferStream> stream = new BufferStream(buffer);
+
+ EXPECT_TRUE(MP4Metadata::HasCompleteMetadata(stream));
+ RefPtr<MediaByteBuffer> metadataBuffer = MP4Metadata::Metadata(stream);
+ EXPECT_TRUE(metadataBuffer);
+
+ MP4Metadata metadata(stream);
+
+ EXPECT_EQ(1u, metadata.GetNumberTracks(TrackInfo::kVideoTrack));
+ mozilla::UniquePtr<mozilla::TrackInfo> track =
+ metadata.GetTrackInfo(TrackInfo::kVideoTrack, 0);
+ EXPECT_TRUE(track != nullptr);
+ // We can seek anywhere in any MPEG4.
+ EXPECT_TRUE(metadata.CanSeek());
+ EXPECT_FALSE(metadata.Crypto().valid);
+}
+
diff --git a/media/libstagefright/gtest/moz.build b/media/libstagefright/gtest/moz.build
new file mode 100644
index 000000000..15d91dc94
--- /dev/null
+++ b/media/libstagefright/gtest/moz.build
@@ -0,0 +1,49 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+Library('stagefright_gtest')
+
+SOURCES += [
+ 'TestInterval.cpp',
+ 'TestParser.cpp',
+]
+
+TEST_HARNESS_FILES.gtest += [
+ 'test_case_1156505.mp4',
+ 'test_case_1181213.mp4',
+ 'test_case_1181215.mp4',
+ 'test_case_1181220.mp4',
+ 'test_case_1181223.mp4',
+ 'test_case_1181719.mp4',
+ 'test_case_1185230.mp4',
+ 'test_case_1187067.mp4',
+ 'test_case_1200326.mp4',
+ 'test_case_1204580.mp4',
+ 'test_case_1216748.mp4',
+ 'test_case_1296473.mp4',
+ 'test_case_1296532.mp4',
+ 'test_case_1301065-harder.mp4',
+ 'test_case_1301065-i64max.mp4',
+ 'test_case_1301065-i64min.mp4',
+ 'test_case_1301065-max-ez.mp4',
+ 'test_case_1301065-max-ok.mp4',
+ 'test_case_1301065-overfl.mp4',
+ 'test_case_1301065-u32max.mp4',
+ 'test_case_1301065-u64max.mp4',
+ 'test_case_1301065.mp4',
+ 'test_case_1351094.mp4',
+]
+
+if CONFIG['MOZ_RUST']:
+ UNIFIED_SOURCES += ['TestMP4Rust.cpp',]
+ TEST_HARNESS_FILES.gtest += [
+ '../../../dom/media/test/street.mp4',
+ ]
+ LOCAL_INCLUDES += [
+ '../binding/include',
+ ]
+
+FINAL_LIBRARY = 'xul-gtest'
diff --git a/media/libstagefright/gtest/test_case_1156505.mp4 b/media/libstagefright/gtest/test_case_1156505.mp4
new file mode 100644
index 000000000..687b06ee1
--- /dev/null
+++ b/media/libstagefright/gtest/test_case_1156505.mp4
Binary files differ
diff --git a/media/libstagefright/gtest/test_case_1181213.mp4 b/media/libstagefright/gtest/test_case_1181213.mp4
new file mode 100644
index 000000000..e2326edb4
--- /dev/null
+++ b/media/libstagefright/gtest/test_case_1181213.mp4
Binary files differ
diff --git a/media/libstagefright/gtest/test_case_1181215.mp4 b/media/libstagefright/gtest/test_case_1181215.mp4
new file mode 100644
index 000000000..7adba3836
--- /dev/null
+++ b/media/libstagefright/gtest/test_case_1181215.mp4
Binary files differ
diff --git a/media/libstagefright/gtest/test_case_1181220.mp4 b/media/libstagefright/gtest/test_case_1181220.mp4
new file mode 100644
index 000000000..e4a144c8e
--- /dev/null
+++ b/media/libstagefright/gtest/test_case_1181220.mp4
Binary files differ
diff --git a/media/libstagefright/gtest/test_case_1181223.mp4 b/media/libstagefright/gtest/test_case_1181223.mp4
new file mode 100644
index 000000000..2aa2d5abf
--- /dev/null
+++ b/media/libstagefright/gtest/test_case_1181223.mp4
Binary files differ
diff --git a/media/libstagefright/gtest/test_case_1181719.mp4 b/media/libstagefright/gtest/test_case_1181719.mp4
new file mode 100644
index 000000000..6846edd6e
--- /dev/null
+++ b/media/libstagefright/gtest/test_case_1181719.mp4
Binary files differ
diff --git a/media/libstagefright/gtest/test_case_1185230.mp4 b/media/libstagefright/gtest/test_case_1185230.mp4
new file mode 100644
index 000000000..ac5cbdbe8
--- /dev/null
+++ b/media/libstagefright/gtest/test_case_1185230.mp4
Binary files differ
diff --git a/media/libstagefright/gtest/test_case_1187067.mp4 b/media/libstagefright/gtest/test_case_1187067.mp4
new file mode 100644
index 000000000..fdb396eeb
--- /dev/null
+++ b/media/libstagefright/gtest/test_case_1187067.mp4
Binary files differ
diff --git a/media/libstagefright/gtest/test_case_1200326.mp4 b/media/libstagefright/gtest/test_case_1200326.mp4
new file mode 100644
index 000000000..5b8b27d50
--- /dev/null
+++ b/media/libstagefright/gtest/test_case_1200326.mp4
Binary files differ
diff --git a/media/libstagefright/gtest/test_case_1204580.mp4 b/media/libstagefright/gtest/test_case_1204580.mp4
new file mode 100644
index 000000000..4e55b0571
--- /dev/null
+++ b/media/libstagefright/gtest/test_case_1204580.mp4
Binary files differ
diff --git a/media/libstagefright/gtest/test_case_1216748.mp4 b/media/libstagefright/gtest/test_case_1216748.mp4
new file mode 100755
index 000000000..7072f53be
--- /dev/null
+++ b/media/libstagefright/gtest/test_case_1216748.mp4
Binary files differ
diff --git a/media/libstagefright/gtest/test_case_1296473.mp4 b/media/libstagefright/gtest/test_case_1296473.mp4
new file mode 100644
index 000000000..109eb5106
--- /dev/null
+++ b/media/libstagefright/gtest/test_case_1296473.mp4
Binary files differ
diff --git a/media/libstagefright/gtest/test_case_1296532.mp4 b/media/libstagefright/gtest/test_case_1296532.mp4
new file mode 100644
index 000000000..5a5669bb8
--- /dev/null
+++ b/media/libstagefright/gtest/test_case_1296532.mp4
Binary files differ
diff --git a/media/libstagefright/gtest/test_case_1301065-harder.mp4 b/media/libstagefright/gtest/test_case_1301065-harder.mp4
new file mode 100644
index 000000000..7d678b7c6
--- /dev/null
+++ b/media/libstagefright/gtest/test_case_1301065-harder.mp4
Binary files differ
diff --git a/media/libstagefright/gtest/test_case_1301065-i64max.mp4 b/media/libstagefright/gtest/test_case_1301065-i64max.mp4
new file mode 100644
index 000000000..5a3572f88
--- /dev/null
+++ b/media/libstagefright/gtest/test_case_1301065-i64max.mp4
Binary files differ
diff --git a/media/libstagefright/gtest/test_case_1301065-i64min.mp4 b/media/libstagefright/gtest/test_case_1301065-i64min.mp4
new file mode 100644
index 000000000..4d3eb366e
--- /dev/null
+++ b/media/libstagefright/gtest/test_case_1301065-i64min.mp4
Binary files differ
diff --git a/media/libstagefright/gtest/test_case_1301065-max-ez.mp4 b/media/libstagefright/gtest/test_case_1301065-max-ez.mp4
new file mode 100644
index 000000000..17fbf411e
--- /dev/null
+++ b/media/libstagefright/gtest/test_case_1301065-max-ez.mp4
Binary files differ
diff --git a/media/libstagefright/gtest/test_case_1301065-max-ok.mp4 b/media/libstagefright/gtest/test_case_1301065-max-ok.mp4
new file mode 100644
index 000000000..a5e1e4610
--- /dev/null
+++ b/media/libstagefright/gtest/test_case_1301065-max-ok.mp4
Binary files differ
diff --git a/media/libstagefright/gtest/test_case_1301065-overfl.mp4 b/media/libstagefright/gtest/test_case_1301065-overfl.mp4
new file mode 100644
index 000000000..1ef24e932
--- /dev/null
+++ b/media/libstagefright/gtest/test_case_1301065-overfl.mp4
Binary files differ
diff --git a/media/libstagefright/gtest/test_case_1301065-u32max.mp4 b/media/libstagefright/gtest/test_case_1301065-u32max.mp4
new file mode 100644
index 000000000..b1d8b6ce7
--- /dev/null
+++ b/media/libstagefright/gtest/test_case_1301065-u32max.mp4
Binary files differ
diff --git a/media/libstagefright/gtest/test_case_1301065-u64max.mp4 b/media/libstagefright/gtest/test_case_1301065-u64max.mp4
new file mode 100644
index 000000000..419dcba2c
--- /dev/null
+++ b/media/libstagefright/gtest/test_case_1301065-u64max.mp4
Binary files differ
diff --git a/media/libstagefright/gtest/test_case_1301065.mp4 b/media/libstagefright/gtest/test_case_1301065.mp4
new file mode 100644
index 000000000..543a4fba3
--- /dev/null
+++ b/media/libstagefright/gtest/test_case_1301065.mp4
Binary files differ
diff --git a/media/libstagefright/gtest/test_case_1351094.mp4 b/media/libstagefright/gtest/test_case_1351094.mp4
new file mode 100644
index 000000000..2dfd4c35c
--- /dev/null
+++ b/media/libstagefright/gtest/test_case_1351094.mp4
Binary files differ