Bug 941274 - Fix ResetDecode in MediaOmxReader. r=doublec

This commit is contained in:
Sotaro Ikeda 2013-12-02 22:38:16 -05:00
parent 9dd4bc9de0
commit 05a8724f6a
2 changed files with 11 additions and 15 deletions

View File

@ -37,6 +37,10 @@ MediaOmxReader::MediaOmxReader(AbstractMediaDecoder *aDecoder) :
MediaOmxReader::~MediaOmxReader()
{
ResetDecode();
VideoFrameContainer* container = mDecoder->GetVideoFrameContainer();
if (container) {
container->ClearCurrentFrame();
}
mOmxDecoder.clear();
}
@ -64,6 +68,12 @@ bool MediaOmxReader::IsDormantNeeded()
void MediaOmxReader::ReleaseMediaResources()
{
ResetDecode();
// Before freeing a video codec, all video buffers needed to be released
// even from graphics pipeline.
VideoFrameContainer* container = mDecoder->GetVideoFrameContainer();
if (container) {
container->ClearCurrentFrame();
}
if (mOmxDecoder.get()) {
mOmxDecoder->ReleaseMediaResources();
}
@ -166,18 +176,6 @@ nsresult MediaOmxReader::ReadMetadata(MediaInfo* aInfo,
return NS_OK;
}
// Resets all state related to decoding, emptying all buffers etc.
nsresult MediaOmxReader::ResetDecode()
{
MediaDecoderReader::ResetDecode();
VideoFrameContainer* container = mDecoder->GetVideoFrameContainer();
if (container) {
container->ClearCurrentFrame();
}
return NS_OK;
}
bool MediaOmxReader::DecodeVideoFrame(bool &aKeyframeSkip,
int64_t aTimeThreshold)
{
@ -347,12 +345,11 @@ nsresult MediaOmxReader::Seek(int64_t aTarget, int64_t aStartTime, int64_t aEndT
{
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
ResetDecode();
VideoFrameContainer* container = mDecoder->GetVideoFrameContainer();
if (container && container->GetImageContainer()) {
container->GetImageContainer()->ClearAllImagesExceptFront();
}
mVideoQueue.Reset();
mAudioQueue.Reset();
mAudioSeekTimeUs = mVideoSeekTimeUs = aTarget;

View File

@ -48,7 +48,6 @@ public:
~MediaOmxReader();
virtual nsresult Init(MediaDecoderReader* aCloneDonor);
virtual nsresult ResetDecode();
virtual void NotifyDataArrived(const char* aBuffer, uint32_t aLength, int64_t aOffset);