зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1043710 - Expose decode timestamp. r=edwin
This commit is contained in:
Родитель
e7899e86a5
Коммит
9d6e322813
|
@ -56,6 +56,7 @@ FFmpegH264Decoder<LIBAV_VER>::DecodeFrame(mp4_demuxer::MP4Sample* aSample)
|
|||
aSample->Pad(FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
packet.data = aSample->data;
|
||||
packet.size = aSample->size;
|
||||
packet.dts = aSample->decode_timestamp;
|
||||
packet.pts = aSample->composition_timestamp;
|
||||
packet.flags = aSample->is_sync_point ? AV_PKT_FLAG_KEY : 0;
|
||||
packet.pos = aSample->byte_offset;
|
||||
|
|
|
@ -186,6 +186,7 @@ VideoDecoderConfig::IsValid()
|
|||
|
||||
MP4Sample::MP4Sample()
|
||||
: mMediaBuffer(nullptr)
|
||||
, decode_timestamp(0)
|
||||
, composition_timestamp(0)
|
||||
, duration(0)
|
||||
, byte_offset(0)
|
||||
|
@ -206,6 +207,7 @@ void
|
|||
MP4Sample::Update()
|
||||
{
|
||||
sp<MetaData> m = mMediaBuffer->meta_data();
|
||||
decode_timestamp = FindInt64(m, kKeyDecodingTime);
|
||||
composition_timestamp = FindInt64(m, kKeyTime);
|
||||
duration = FindInt64(m, kKeyDuration);
|
||||
byte_offset = FindInt64(m, kKey64BitFileOffset);
|
||||
|
|
|
@ -137,6 +137,7 @@ public:
|
|||
|
||||
stagefright::MediaBuffer* mMediaBuffer;
|
||||
|
||||
Microseconds decode_timestamp;
|
||||
Microseconds composition_timestamp;
|
||||
Microseconds duration;
|
||||
int64_t byte_offset;
|
||||
|
|
|
@ -3232,6 +3232,7 @@ status_t MPEG4Source::read(
|
|||
|
||||
off64_t offset = 0;
|
||||
size_t size = 0;
|
||||
uint32_t dts = 0;
|
||||
uint32_t cts = 0;
|
||||
uint32_t duration = 0;
|
||||
bool isSyncSample = false;
|
||||
|
@ -3242,7 +3243,7 @@ status_t MPEG4Source::read(
|
|||
status_t err =
|
||||
mSampleTable->getMetaDataForSample(
|
||||
mCurrentSampleIndex, &offset, &size, &cts, &duration,
|
||||
&isSyncSample);
|
||||
&isSyncSample, &dts);
|
||||
|
||||
if (err != OK) {
|
||||
return err;
|
||||
|
@ -3273,6 +3274,8 @@ status_t MPEG4Source::read(
|
|||
if (!mTimescale) {
|
||||
return ERROR_MALFORMED;
|
||||
}
|
||||
mBuffer->meta_data()->setInt64(
|
||||
kKeyDecodingTime, ((int64_t)dts * 1000000) / mTimescale);
|
||||
mBuffer->meta_data()->setInt64(
|
||||
kKeyTime, ((int64_t)cts * 1000000) / mTimescale);
|
||||
mBuffer->meta_data()->setInt64(
|
||||
|
@ -3400,6 +3403,8 @@ status_t MPEG4Source::read(
|
|||
if (!mTimescale) {
|
||||
return ERROR_MALFORMED;
|
||||
}
|
||||
mBuffer->meta_data()->setInt64(
|
||||
kKeyDecodingTime, ((int64_t)dts * 1000000) / mTimescale);
|
||||
mBuffer->meta_data()->setInt64(
|
||||
kKeyTime, ((int64_t)cts * 1000000) / mTimescale);
|
||||
mBuffer->meta_data()->setInt64(
|
||||
|
@ -3480,6 +3485,7 @@ status_t MPEG4Source::fragmentedRead(
|
|||
|
||||
off64_t offset = 0;
|
||||
size_t size = 0;
|
||||
uint32_t dts = 0;
|
||||
uint32_t cts = 0;
|
||||
uint32_t duration = 0;
|
||||
bool isSyncSample = false;
|
||||
|
@ -3519,6 +3525,7 @@ status_t MPEG4Source::fragmentedRead(
|
|||
const Sample *smpl = &mCurrentSamples[mCurrentSampleIndex];
|
||||
offset = smpl->offset;
|
||||
size = smpl->size;
|
||||
dts = mCurrentTime;
|
||||
cts = mCurrentTime + smpl->ctsOffset;
|
||||
duration = smpl->duration;
|
||||
mCurrentTime += smpl->duration;
|
||||
|
@ -3563,6 +3570,8 @@ status_t MPEG4Source::fragmentedRead(
|
|||
if (!mTimescale) {
|
||||
return ERROR_MALFORMED;
|
||||
}
|
||||
mBuffer->meta_data()->setInt64(
|
||||
kKeyDecodingTime, ((int64_t)dts * 1000000) / mTimescale);
|
||||
mBuffer->meta_data()->setInt64(
|
||||
kKeyTime, ((int64_t)cts * 1000000) / mTimescale);
|
||||
mBuffer->meta_data()->setInt64(
|
||||
|
@ -3690,6 +3699,8 @@ status_t MPEG4Source::fragmentedRead(
|
|||
if (!mTimescale) {
|
||||
return ERROR_MALFORMED;
|
||||
}
|
||||
mBuffer->meta_data()->setInt64(
|
||||
kKeyDecodingTime, ((int64_t)dts * 1000000) / mTimescale);
|
||||
mBuffer->meta_data()->setInt64(
|
||||
kKeyTime, ((int64_t)cts * 1000000) / mTimescale);
|
||||
mBuffer->meta_data()->setInt64(
|
||||
|
|
|
@ -141,7 +141,8 @@ status_t SampleIterator::seekTo(uint32_t sampleIndex) {
|
|||
|
||||
// mTTSDuration is set by findSampleTime()
|
||||
mCurrentSampleDuration = mTTSDuration;
|
||||
|
||||
mCurrentSampleDecodeTime = mTTSSampleTime + mTTSDuration * (sampleIndex -
|
||||
mTTSSampleIndex);
|
||||
mCurrentSampleIndex = sampleIndex;
|
||||
|
||||
mInitialized = true;
|
||||
|
|
|
@ -780,7 +780,8 @@ status_t SampleTable::getMetaDataForSample(
|
|||
size_t *size,
|
||||
uint32_t *compositionTime,
|
||||
uint32_t *duration,
|
||||
bool *isSyncSample) {
|
||||
bool *isSyncSample,
|
||||
uint32_t *decodeTime) {
|
||||
Mutex::Autolock autoLock(mLock);
|
||||
|
||||
status_t err;
|
||||
|
@ -800,6 +801,10 @@ status_t SampleTable::getMetaDataForSample(
|
|||
*compositionTime = mSampleIterator->getSampleTime();
|
||||
}
|
||||
|
||||
if (decodeTime) {
|
||||
*decodeTime = mSampleIterator->getSampleDecodeTime();
|
||||
}
|
||||
|
||||
if (duration) {
|
||||
*duration = mSampleIterator->getSampleDuration();
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ struct SampleIterator {
|
|||
off64_t getSampleOffset() const { return mCurrentSampleOffset; }
|
||||
size_t getSampleSize() const { return mCurrentSampleSize; }
|
||||
uint32_t getSampleTime() const { return mCurrentSampleTime; }
|
||||
uint32_t getSampleDecodeTime() const { return mCurrentSampleDecodeTime; }
|
||||
uint32_t getSampleDuration() const { return mCurrentSampleDuration; }
|
||||
|
||||
status_t getSampleSizeDirect(
|
||||
|
@ -65,6 +66,7 @@ private:
|
|||
off64_t mCurrentSampleOffset;
|
||||
size_t mCurrentSampleSize;
|
||||
uint32_t mCurrentSampleTime;
|
||||
uint32_t mCurrentSampleDecodeTime;
|
||||
uint32_t mCurrentSampleDuration;
|
||||
|
||||
void reset();
|
||||
|
|
|
@ -67,7 +67,8 @@ public:
|
|||
size_t *size,
|
||||
uint32_t *compositionTime,
|
||||
uint32_t *duration = NULL,
|
||||
bool *isSyncSample = NULL);
|
||||
bool *isSyncSample = NULL,
|
||||
uint32_t *decodeTime = NULL);
|
||||
|
||||
enum {
|
||||
kFlagBefore,
|
||||
|
|
Загрузка…
Ссылка в новой задаче