зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset f3830d09ce0e (bug 1098126
) for bustage on a CLOSED TREE
This commit is contained in:
Родитель
c56f3e3222
Коммит
3034734290
|
@ -112,7 +112,6 @@ private:
|
|||
status_t parseSampleAuxiliaryInformationSizes(off64_t offset, off64_t size);
|
||||
status_t parseSampleAuxiliaryInformationOffsets(off64_t offset, off64_t size);
|
||||
void lookForMoof();
|
||||
status_t moveToNextFragment();
|
||||
|
||||
struct TrackFragmentHeaderInfo {
|
||||
enum Flags {
|
||||
|
@ -3584,34 +3583,6 @@ status_t MPEG4Source::read(
|
|||
}
|
||||
}
|
||||
|
||||
status_t MPEG4Source::moveToNextFragment() {
|
||||
off64_t nextMoof = mNextMoofOffset;
|
||||
mCurrentSamples.clear();
|
||||
mDeferredSaio.clear();
|
||||
mDeferredSaiz.clear();
|
||||
mCurrentSampleIndex = 0;
|
||||
uint32_t hdr[2];
|
||||
do {
|
||||
if (mDataSource->readAt(nextMoof, hdr, 8) < 8) {
|
||||
return ERROR_END_OF_STREAM;
|
||||
}
|
||||
uint64_t chunk_size = ntohl(hdr[0]);
|
||||
uint32_t chunk_type = ntohl(hdr[1]);
|
||||
|
||||
// Skip over anything that isn't a moof
|
||||
if (chunk_type != FOURCC('m', 'o', 'o', 'f')) {
|
||||
nextMoof += chunk_size;
|
||||
continue;
|
||||
}
|
||||
mCurrentMoofOffset = nextMoof;
|
||||
status_t ret = parseChunk(&nextMoof);
|
||||
if (ret != OK) {
|
||||
return ret;
|
||||
}
|
||||
} while (mCurrentSamples.size() == 0);
|
||||
return OK;
|
||||
}
|
||||
|
||||
status_t MPEG4Source::fragmentedRead(
|
||||
MediaBuffer **out, const ReadOptions *options) {
|
||||
|
||||
|
@ -3627,6 +3598,10 @@ status_t MPEG4Source::fragmentedRead(
|
|||
ReadOptions::SeekMode mode;
|
||||
if (options && options->getSeekTo(&seekTimeUs, &mode)) {
|
||||
|
||||
mCurrentSamples.clear();
|
||||
mDeferredSaio.clear();
|
||||
mDeferredSaiz.clear();
|
||||
mCurrentSampleIndex = 0;
|
||||
int numSidxEntries = mSegments.size();
|
||||
if (numSidxEntries != 0) {
|
||||
int64_t totalTime = 0;
|
||||
|
@ -3649,21 +3624,37 @@ status_t MPEG4Source::fragmentedRead(
|
|||
totalOffset += se->mSize;
|
||||
}
|
||||
mCurrentMoofOffset = totalOffset;
|
||||
mCurrentSamples.clear();
|
||||
mDeferredSaio.clear();
|
||||
mDeferredSaiz.clear();
|
||||
mCurrentSampleIndex = 0;
|
||||
mCurrentTime = totalTime * mTimescale / 1000000ll;
|
||||
mNextMoofOffset = totalOffset;
|
||||
mCurrentTime = totalTime * mTimescale / 1000000ll;
|
||||
}
|
||||
else {
|
||||
mNextMoofOffset = mFirstMoofOffset;
|
||||
uint32_t seekTime = (int32_t) ((seekTimeUs * mTimescale) / 1000000ll);
|
||||
while (true) {
|
||||
status_t ret = moveToNextFragment();
|
||||
if (ret != OK) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint32_t hdr[2];
|
||||
do {
|
||||
off64_t moofOffset = mNextMoofOffset; // lastSample.offset + lastSample.size;
|
||||
if (mDataSource->readAt(moofOffset, hdr, 8) < 8) {
|
||||
ALOGV("Seek ERROR_END_OF_STREAM\n");
|
||||
return ERROR_END_OF_STREAM;
|
||||
}
|
||||
uint64_t chunk_size = ntohl(hdr[0]);
|
||||
uint32_t chunk_type = ntohl(hdr[1]);
|
||||
char chunk[5];
|
||||
MakeFourCCString(chunk_type, chunk);
|
||||
|
||||
// If we're pointing to a segment type or sidx box then we skip them.
|
||||
if (chunk_type != FOURCC('m', 'o', 'o', 'f')) {
|
||||
mNextMoofOffset += chunk_size;
|
||||
continue;
|
||||
}
|
||||
mCurrentMoofOffset = moofOffset;
|
||||
status_t ret = parseChunk(&moofOffset);
|
||||
if (ret != OK) {
|
||||
return ret;
|
||||
}
|
||||
} while (mCurrentSamples.size() == 0);
|
||||
uint32_t time = mCurrentTime;
|
||||
int i;
|
||||
for (i = 0; i < mCurrentSamples.size() && time <= seekTime; i++) {
|
||||
|
@ -3677,6 +3668,11 @@ status_t MPEG4Source::fragmentedRead(
|
|||
if (i != mCurrentSamples.size()) {
|
||||
break;
|
||||
}
|
||||
|
||||
mCurrentSamples.clear();
|
||||
mDeferredSaio.clear();
|
||||
mDeferredSaiz.clear();
|
||||
mCurrentSampleIndex = 0;
|
||||
}
|
||||
ALOGV("Seeking offset %d; %ldus\n", mCurrentTime - seekTime,
|
||||
(((int64_t) mCurrentTime - seekTime) * 1000000ll) / mTimescale);
|
||||
|
@ -3701,10 +3697,32 @@ status_t MPEG4Source::fragmentedRead(
|
|||
newBuffer = true;
|
||||
|
||||
if (mCurrentSampleIndex >= mCurrentSamples.size()) {
|
||||
status_t ret = moveToNextFragment();
|
||||
if (ret != OK) {
|
||||
return ret;
|
||||
}
|
||||
// move to next fragment
|
||||
off64_t nextMoof = mNextMoofOffset; // lastSample.offset + lastSample.size;
|
||||
mCurrentSamples.clear();
|
||||
mDeferredSaio.clear();
|
||||
mDeferredSaiz.clear();
|
||||
mCurrentSampleIndex = 0;
|
||||
uint32_t hdr[2];
|
||||
do {
|
||||
if (mDataSource->readAt(nextMoof, hdr, 8) < 8) {
|
||||
return ERROR_END_OF_STREAM;
|
||||
}
|
||||
uint64_t chunk_size = ntohl(hdr[0]);
|
||||
uint32_t chunk_type = ntohl(hdr[1]);
|
||||
|
||||
// If we're pointing to a segment type or sidx box then we skip them.
|
||||
if (chunk_type == FOURCC('s', 't', 'y', 'p') ||
|
||||
chunk_type == FOURCC('s', 'i', 'd', 'x')) {
|
||||
nextMoof += chunk_size;
|
||||
continue;
|
||||
}
|
||||
mCurrentMoofOffset = nextMoof;
|
||||
status_t ret = parseChunk(&nextMoof);
|
||||
if (ret != OK) {
|
||||
return ret;
|
||||
}
|
||||
} while (mCurrentSamples.size() == 0);
|
||||
}
|
||||
|
||||
const Sample *smpl = &mCurrentSamples[mCurrentSampleIndex];
|
||||
|
|
Загрузка…
Ссылка в новой задаче