Bug 970793 - Update correct base_data_offset. r=cpearce

This commit is contained in:
Alfredo Yang 2014-02-12 09:54:56 -05:00
parent caef91087a
commit dacf731ba9
3 changed files with 5 additions and 11 deletions

View File

@ -255,7 +255,6 @@ ISOControl::GetBufs(nsTArray<nsTArray<uint8_t>>* aOutputBufs)
uint32_t len = mOutBuffers.Length();
for (uint32_t i = 0; i < len; i++) {
mOutBuffers[i].SwapElements(*aOutputBufs->AppendElement());
mOutputSize += mOutBuffers[i].Length();
}
return FlushBuf();
}
@ -264,7 +263,6 @@ nsresult
ISOControl::FlushBuf()
{
mOutBuffers.SetLength(1);
mLastWrittenBoxPos = 0;
return NS_OK;
}
@ -278,6 +276,8 @@ ISOControl::WriteAVData(nsTArray<uint8_t>& aArray)
return 0;
}
mOutputSize += len;
// The last element already has data, allocated a new element for pointer
// swapping.
if (mOutBuffers.LastElement().Length()) {
@ -314,6 +314,7 @@ uint32_t
ISOControl::Write(uint8_t* aBuf, uint32_t aSize)
{
mOutBuffers.LastElement().AppendElements(aBuf, aSize);
mOutputSize += aSize;
return aSize;
}
@ -383,7 +384,7 @@ ISOControl::GenerateMoof(uint32_t aTrackType)
nsresult rv;
uint32_t size;
uint64_t first_sample_offset = mOutputSize + mLastWrittenBoxPos;
uint64_t first_sample_offset = mOutputSize;
nsAutoPtr<MovieFragmentBox> moof_box(new MovieFragmentBox(aTrackType, this));
nsAutoPtr<MediaDataBox> mdat_box(new MediaDataBox(aTrackType, this));

View File

@ -229,11 +229,7 @@ private:
//
nsTArray<nsTArray<uint8_t>> mOutBuffers;
// Last written position of current box, it is for box checking purpose and
// calculating the sample offset in moof.
uint32_t mLastWrittenBoxPos;
// Accumulate size of output fragments.
// Accumulate output size from Write().
uint64_t mOutputSize;
// Bit writing operation. Note: the mBitCount should be 0 before any

View File

@ -42,9 +42,6 @@ Box::BoxSizeChecker::~BoxSizeChecker()
MOZ_ASSERT(false);
}
// Keeps the last box size position, it is for counting the sample offset when
// generating moof.
mControl->mLastWrittenBoxPos += box_size;
MOZ_COUNT_DTOR(BoxSizeChecker);
}