Skip to content

Commit

Permalink
Backed out 5 changesets (bug 1788119) for causing bustages complainin…
Browse files Browse the repository at this point in the history
…g about AVIFDecodedData. CLOSED TREE

Backed out changeset 430e71478ff5 (bug 1788119)
Backed out changeset 9493029c76b9 (bug 1788119)
Backed out changeset 7d5cc211e3f5 (bug 1788119)
Backed out changeset 3eaac75dde3c (bug 1788119)
Backed out changeset 1f8eacf96c71 (bug 1788119)
  • Loading branch information
Butkovits Atila committed Jan 27, 2023
1 parent 705d03e commit 1a20919
Show file tree
Hide file tree
Showing 79 changed files with 6,449 additions and 5,488 deletions.
2 changes: 1 addition & 1 deletion .cargo/config.in
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ replace-with = "vendored-sources"

[source."https://github.com/mozilla/mp4parse-rust"]
git = "https://github.com/mozilla/mp4parse-rust"
rev = "eb0b625bd7e888d05ebcfc7685e2501b34c3b374"
rev = "3bfc47d9a571d0842676043ba60716318e946c06"
replace-with = "vendored-sources"

[source."https://github.com/mozilla/neqo"]
Expand Down
38 changes: 28 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ memmap2 = { path = "build/rust/memmap2" }
# Patch getrandom 0.7 to 0.8
rand = { path = "build/rust/rand" }

# Patch env_logger 0.8 to 0.9
env_logger = { path = "build/rust/env_logger" }

# Patch parking_lot 0.12 down to 0.11, which is compatible for most crates that use it, to avoid
# dependencies on windows-sys.
parking_lot = { path = "build/rust/parking_lot" }
Expand Down
19 changes: 19 additions & 0 deletions build/rust/env_logger/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "env_logger"
version = "0.8.999"
edition = "2018"
license = "MPL-2.0"

[lib]
path = "lib.rs"

[dependencies.env_logger]
version = "0.9"
default-features = false

[features]
default = ["env_logger/default"]
termcolor = ["env_logger/termcolor"]
atty = ["env_logger/atty"]
humantime = ["env_logger/humantime"]
regex = ["env_logger/regex"]
5 changes: 5 additions & 0 deletions build/rust/env_logger/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* 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/. */

pub use env_logger::*;
4 changes: 2 additions & 2 deletions dom/media/gtest/mp4_demuxer/TestMP4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ TEST(rust, MP4MetadataEmpty)
io = {vector_reader, &buf};
rv = mp4parse_new(&io, &parser);
ASSERT_EQ(parser, nullptr);
EXPECT_EQ(rv, MP4PARSE_STATUS_MOOV_MISSING);
EXPECT_EQ(rv, MP4PARSE_STATUS_NO_MOOV);

buf.buffer.reserve(4097);
rv = mp4parse_new(&io, &parser);
ASSERT_EQ(parser, nullptr);
EXPECT_EQ(rv, MP4PARSE_STATUS_MOOV_MISSING);
EXPECT_EQ(rv, MP4PARSE_STATUS_NO_MOOV);

// Empty buffers should fail.
buf.buffer.resize(4097, 0);
Expand Down
4 changes: 2 additions & 2 deletions dom/media/gtest/mp4_demuxer/TestParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ TEST(MP4Metadata, test_case_mp4)
<< tests[test].mFilename;
if (tests[test].mHasVideoIndice) {
for (size_t i = 0; i < indices.Ref()->Length(); i++) {
MP4SampleIndex::Indice data;
Index::Indice data;
EXPECT_TRUE(indices.Ref()->GetIndice(i, data))
<< tests[test].mFilename;
EXPECT_TRUE(data.start_offset <= data.end_offset)
Expand Down Expand Up @@ -349,7 +349,7 @@ TEST(MP4Metadata, test_case_mp4)
metadata.GetTrackIndice(audioInfo->mTrackId);
EXPECT_TRUE(!!indices.Ref()) << tests[test].mFilename;
for (size_t i = 0; i < indices.Ref()->Length(); i++) {
MP4SampleIndex::Indice data;
Index::Indice data;
EXPECT_TRUE(indices.Ref()->GetIndice(i, data)) << tests[test].mFilename;
EXPECT_TRUE(data.start_offset <= data.end_offset)
<< tests[test].mFilename;
Expand Down
4 changes: 2 additions & 2 deletions dom/media/mediasource/ContainerParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
#ifdef MOZ_FMP4
# include "AtomType.h"
# include "BufferReader.h"
# include "ByteStream.h"
# include "Index.h"
# include "MP4Interval.h"
# include "SampleIterator.h"
# include "ByteStream.h"
#endif
#include "SourceBufferResource.h"
#include <algorithm>
Expand Down
2 changes: 1 addition & 1 deletion dom/media/mp4/DecoderData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ MediaResult MP4AudioInfo::Update(const Mp4parseTrackInfo* aTrack,
}

// Pass the padding number, in frames, to the AAC decoder as well.
MP4SampleIndex::Indice indice = {0};
Index::Indice indice = {0};
bool rv = aIndices->GetIndice(aIndices->Length() - 1, indice);
uint64_t mediaFrameCount = 0;
if (rv) {
Expand Down
29 changes: 13 additions & 16 deletions dom/media/mp4/SampleIterator.cpp → dom/media/mp4/Index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* 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 "SampleIterator.h"
#include "Index.h"

#include <algorithm>
#include <limits>
Expand Down Expand Up @@ -71,15 +71,13 @@ bool RangeFinder::Contains(MediaByteRange aByteRange) {
return false;
}

SampleIterator::SampleIterator(MP4SampleIndex* aIndex)
SampleIterator::SampleIterator(Index* aIndex)
: mIndex(aIndex), mCurrentMoof(0), mCurrentSample(0) {
mIndex->RegisterIterator(this);
}

SampleIterator::~SampleIterator() { mIndex->UnregisterIterator(this); }

bool SampleIterator::HasNext() { return !!Get(); }

already_AddRefed<MediaRawData> SampleIterator::GetNext() {
Sample* s(Get());
if (!s) {
Expand Down Expand Up @@ -415,9 +413,8 @@ Microseconds SampleIterator::GetNextKeyframeTime() {
return -1;
}

MP4SampleIndex::MP4SampleIndex(const IndiceWrapper& aIndices,
ByteStream* aSource, uint32_t aTrackId,
bool aIsAudio)
Index::Index(const IndiceWrapper& aIndices, ByteStream* aSource,
uint32_t aTrackId, bool aIsAudio)
: mSource(aSource), mIsAudio(aIsAudio) {
if (!aIndices.Length()) {
mMoofParser =
Expand Down Expand Up @@ -498,14 +495,14 @@ MP4SampleIndex::MP4SampleIndex(const IndiceWrapper& aIndices,
}
}

MP4SampleIndex::~MP4SampleIndex() = default;
Index::~Index() = default;

void MP4SampleIndex::UpdateMoofIndex(const MediaByteRangeSet& aByteRanges) {
void Index::UpdateMoofIndex(const MediaByteRangeSet& aByteRanges) {
UpdateMoofIndex(aByteRanges, false);
}

void MP4SampleIndex::UpdateMoofIndex(const MediaByteRangeSet& aByteRanges,
bool aCanEvict) {
void Index::UpdateMoofIndex(const MediaByteRangeSet& aByteRanges,
bool aCanEvict) {
if (!mMoofParser) {
return;
}
Expand All @@ -532,7 +529,7 @@ void MP4SampleIndex::UpdateMoofIndex(const MediaByteRangeSet& aByteRanges,
}
}

Microseconds MP4SampleIndex::GetEndCompositionIfBuffered(
Microseconds Index::GetEndCompositionIfBuffered(
const MediaByteRangeSet& aByteRanges) {
FallibleTArray<Sample>* index;
if (mMoofParser) {
Expand All @@ -559,7 +556,7 @@ Microseconds MP4SampleIndex::GetEndCompositionIfBuffered(
return 0;
}

TimeIntervals MP4SampleIndex::ConvertByteRangesToTimeRanges(
TimeIntervals Index::ConvertByteRangesToTimeRanges(
const MediaByteRangeSet& aByteRanges) {
if (aByteRanges == mLastCachedRanges) {
return mLastBufferedRanges;
Expand Down Expand Up @@ -673,7 +670,7 @@ TimeIntervals MP4SampleIndex::ConvertByteRangesToTimeRanges(
return ranges;
}

uint64_t MP4SampleIndex::GetEvictionOffset(Microseconds aTime) {
uint64_t Index::GetEvictionOffset(Microseconds aTime) {
uint64_t offset = std::numeric_limits<uint64_t>::max();
if (mMoofParser) {
// We need to keep the whole moof if we're keeping any of it because the
Expand All @@ -699,11 +696,11 @@ uint64_t MP4SampleIndex::GetEvictionOffset(Microseconds aTime) {
return offset;
}

void MP4SampleIndex::RegisterIterator(SampleIterator* aIterator) {
void Index::RegisterIterator(SampleIterator* aIterator) {
mIterators.AppendElement(aIterator);
}

void MP4SampleIndex::UnregisterIterator(SampleIterator* aIterator) {
void Index::UnregisterIterator(SampleIterator* aIterator) {
mIterators.RemoveElement(aIterator);
}

Expand Down
27 changes: 13 additions & 14 deletions dom/media/mp4/SampleIterator.h → dom/media/mp4/Index.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* 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/. */

#ifndef DOM_MEDIA_MP4_SAMPLE_ITERATOR_H_
#define DOM_MEDIA_MP4_SAMPLE_ITERATOR_H_
#ifndef INDEX_H_
#define INDEX_H_

#include "ByteStream.h"
#include "MediaData.h"
Expand All @@ -15,19 +15,18 @@
#include "TimeUnits.h"

namespace mozilla {

struct CencSampleEncryptionInfoEntry;
class IndiceWrapper;
class MP4SampleIndex;
struct Sample;
struct CencSampleEncryptionInfoEntry;

class Index;

typedef int64_t Microseconds;

class SampleIterator {
public:
explicit SampleIterator(MP4SampleIndex* aIndex);
explicit SampleIterator(Index* aIndex);
~SampleIterator();
bool HasNext();
already_AddRefed<mozilla::MediaRawData> GetNext();
void Seek(Microseconds aTime);
Microseconds GetNextKeyframeTime();
Expand All @@ -49,15 +48,15 @@ class SampleIterator {
Result<CryptoScheme, nsCString> GetEncryptionScheme();

void Next();
RefPtr<MP4SampleIndex> mIndex;
friend class MP4SampleIndex;
RefPtr<Index> mIndex;
friend class Index;
size_t mCurrentMoof;
size_t mCurrentSample;
};

class MP4SampleIndex {
class Index {
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MP4SampleIndex)
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(Index)

struct Indice {
uint64_t start_offset;
Expand Down Expand Up @@ -100,8 +99,8 @@ class MP4SampleIndex {
MP4Interval<Microseconds> mTime;
};

MP4SampleIndex(const mozilla::IndiceWrapper& aIndices, ByteStream* aSource,
uint32_t aTrackId, bool aIsAudio);
Index(const mozilla::IndiceWrapper& aIndices, ByteStream* aSource,
uint32_t aTrackId, bool aIsAudio);

void UpdateMoofIndex(const mozilla::MediaByteRangeSet& aByteRanges,
bool aCanEvict);
Expand All @@ -116,7 +115,7 @@ class MP4SampleIndex {
friend class SampleIterator;

private:
~MP4SampleIndex();
~Index();
void RegisterIterator(SampleIterator* aIterator);
void UnregisterIterator(SampleIterator* aIterator);

Expand Down
Loading

0 comments on commit 1a20919

Please sign in to comment.