Bug 1227396: P8. Replace MediaByteRange with Interval<int64_t> typedef. r=cpearce

It's now okay to simplify.
This commit is contained in:
Jean-Yves Avenard 2015-11-24 20:37:21 +11:00
parent c8c275cee2
commit a7975b198f
5 changed files with 5 additions and 27 deletions

View File

@ -101,7 +101,7 @@ private:
virtual nsresult GetCachedRanges(MediaByteRangeSet& aRanges) override
{
aRanges += MediaByteRange(0, mLength);
aRanges += MediaByteRange(0, int64_t(mLength));
return NS_OK;
}

View File

@ -132,27 +132,7 @@ private:
// Represents a section of contiguous media, with a start and end offset.
// Used to denote ranges of data which are cached.
class MediaByteRange : public media::Interval<int64_t> {
public:
typedef Interval<int64_t> BaseType;
// We can't use inherited constructors yet. So we have to duplicate the
// constructors found in Interval base class.
// all this could be later replaced with:
// using Interval<int64_t>::Interval;
MOZ_IMPLICIT MediaByteRange(const BaseType& aOther)
: BaseType(aOther)
{}
MOZ_IMPLICIT MediaByteRange(BaseType&& aOther)
: BaseType(Move(aOther))
{}
MediaByteRange(int64_t aStart, int64_t aEnd)
: media::Interval<int64_t>(aStart, aEnd)
{}
MediaByteRange() = default;
};
typedef media::Interval<int64_t> MediaByteRange;
typedef media::IntervalSet<int64_t> MediaByteRangeSet;
class RtspMediaResource;

View File

@ -440,7 +440,7 @@ public:
mResource->AppendData(aData);
MediaByteRangeSet byteRanges;
byteRanges +=
MediaByteRange(mParser->mOffset, mResource->GetLength());
MediaByteRange(int64_t(mParser->mOffset), mResource->GetLength());
mParser->RebuildFragmentedIndex(byteRanges);
if (initSegment || !HasCompleteInitData()) {
@ -609,7 +609,7 @@ public:
return false;
}
mHasInitData = true;
mCompleteInitSegmentRange = MediaByteRange(0, header.header_length);
mCompleteInitSegmentRange = MediaByteRange(0, int64_t(header.header_length));
// Cache raw header in case the caller wants a copy.
mInitData = new MediaByteBuffer(header.header_length);

View File

@ -85,7 +85,7 @@ TEST(ContainerParser, ADTSHeader) {
ASSERT_NE(init, nullptr);
EXPECT_EQ(init->Length(), header->Length());
EXPECT_EQ(parser->InitSegmentRange(), MediaByteRange(0, header->Length()));
EXPECT_EQ(parser->InitSegmentRange(), MediaByteRange(0, int64_t(header->Length())));
// Media segment range should be empty here.
EXPECT_EQ(parser->MediaHeaderRange(), MediaByteRange());
EXPECT_EQ(parser->MediaSegmentRange(), MediaByteRange());

View File

@ -14,8 +14,6 @@
#include "MediaInfo.h"
#include "MediaResource.h"
namespace mozilla { class MediaByteRange; }
namespace stagefright { class MetaData; }
namespace mp4_demuxer