Bug 1057612 - Tell Apple AAC decoder about seeks. r=cpearce

According to the documentation we should set this flag to
mark data discontinuities after seeking.
This commit is contained in:
Ralph Giles 2014-08-22 16:39:00 -07:00
parent df9ac5b045
commit c143f98cab
2 changed files with 14 additions and 1 deletions

View File

@ -35,6 +35,7 @@ AppleATDecoder::AppleATDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig,
, mCurrentAudioTimestamp(0)
, mSamplePosition(0)
, mHaveOutput(false)
, mFlushed(false)
{
MOZ_COUNT_CTOR(AppleATDecoder);
LOG("Creating Apple AudioToolbox Audio decoder");
@ -135,6 +136,9 @@ AppleATDecoder::Flush()
LOG("Error %d resetting AudioConverter", rv);
return NS_ERROR_FAILURE;
}
// Notify our task queue of the coming input discontinuity.
mTaskQueue->Dispatch(
NS_NewRunnableMethod(this, &AppleATDecoder::SignalFlush));
return NS_OK;
}
@ -353,10 +357,11 @@ AppleATDecoder::SubmitSample(nsAutoPtr<mp4_demuxer::MP4Sample> aSample)
{
mSamplePosition = aSample->byte_offset;
mCurrentAudioTimestamp = aSample->composition_timestamp;
uint32_t flags = mFlushed ? kAudioFileStreamParseFlag_Discontinuity : 0;
OSStatus rv = AudioFileStreamParseBytes(mStream,
aSample->size,
aSample->data,
0);
flags);
if (rv != noErr) {
LOG("Error %d parsing audio data", rv);
mCallback->Error();
@ -370,4 +375,10 @@ AppleATDecoder::SubmitSample(nsAutoPtr<mp4_demuxer::MP4Sample> aSample)
}
}
void
AppleATDecoder::SignalFlush()
{
mFlushed = true;
}
} // namespace mozilla

View File

@ -52,11 +52,13 @@ private:
Microseconds mCurrentAudioTimestamp;
int64_t mSamplePosition;
bool mHaveOutput;
bool mFlushed;
AudioStreamBasicDescription mOutputFormat;
AudioFileTypeID mFileType;
void SetupDecoder();
void SubmitSample(nsAutoPtr<mp4_demuxer::MP4Sample> aSample);
void SignalFlush();
};
} // namespace mozilla