Backed out 2 changesets (bug 1336358) for android failures in video-replay-after-audio-end.html a=backout

Backed out changeset c474e07f9ad8 (bug 1336358)
Backed out changeset 1ffc124c5fc1 (bug 1336358)

MozReview-Commit-ID: 3IS2QDRTQkN

--HG--
extra : rebase_source : ba363cc027cb51d8f9711f671fa08a3cc2eae277
This commit is contained in:
Wes Kocher 2017-02-08 12:34:48 -08:00
Родитель 6206009d10
Коммит 2880f6ee5a
3 изменённых файлов: 14 добавлений и 43 удалений

Просмотреть файл

@ -145,7 +145,7 @@ public:
void HandleInputExhausted() override
{
mDecoder->ReturnDecodedData();
mDecoder->InputExhausted();
}
void HandleOutput(Sample::Param aSample) override
@ -318,8 +318,7 @@ private:
};
layers::ImageContainer* mImageContainer;
// This must be a reference until bug 1336431 is resolved.
const VideoInfo& mConfig;
const VideoInfo mConfig;
RefPtr<AndroidSurfaceTexture> mSurfaceTexture;
DurationQueue mInputDurations;
bool mIsCodecSupportAdaptivePlayback = false;
@ -344,7 +343,7 @@ public:
if (!formatHasCSD && aConfig.mCodecSpecificConfig->Length() >= 2) {
jni::ByteBuffer::LocalRef buffer(env);
buffer = jni::ByteBuffer::New(aConfig.mCodecSpecificConfig->Elements(),
aConfig.mCodecSpecificConfig->Length());
aConfig.mCodecSpecificConfig->Length());
NS_ENSURE_SUCCESS_VOID(
aFormat->SetByteBuffer(NS_LITERAL_STRING("csd-0"), buffer));
}
@ -377,7 +376,7 @@ private:
void HandleInputExhausted() override
{
mDecoder->ReturnDecodedData();
mDecoder->InputExhausted();
}
void HandleOutput(Sample::Param aSample) override
@ -512,9 +511,6 @@ RemoteDataDecoder::Flush()
{
RefPtr<RemoteDataDecoder> self = this;
return InvokeAsync(mTaskQueue, __func__, [self, this]() {
mDrained = true;
mDraining = false;
mDecodedData.Clear();
mDecodePromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__);
mDrainPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__);
mJavaDecoder->Flush();
@ -527,27 +523,15 @@ RemoteDataDecoder::Drain()
{
RefPtr<RemoteDataDecoder> self = this;
return InvokeAsync(mTaskQueue, __func__, [self, this]() {
RefPtr<DecodePromise> p = mDrainPromise.Ensure(__func__);
if (mDrained) {
// There's no operation to perform other than returning any already
// decoded data.
ReturnDecodedData();
return p;
}
if (mDraining) {
// Draining operation already pending, let it complete its course.
return p;
}
BufferInfo::LocalRef bufferInfo;
nsresult rv = BufferInfo::New(&bufferInfo);
if (NS_FAILED(rv)) {
return DecodePromise::CreateAndReject(NS_ERROR_OUT_OF_MEMORY, __func__);
}
bufferInfo->Set(0, 0, -1, MediaCodec::BUFFER_FLAG_END_OF_STREAM);
RefPtr<DecodePromise> p = mDrainPromise.Ensure(__func__);
mJavaDecoder->Input(nullptr, bufferInfo, nullptr);
mDraining = true;
return p;
});
}
@ -602,7 +586,6 @@ RemoteDataDecoder::Decode(MediaRawData* aSample)
RefPtr<DecodePromise> p = mDecodePromise.Ensure(__func__);
mJavaDecoder->Input(bytes, bufferInfo, GetCryptoInfoFromSample(sample));
mDrained = false;
return p;
});
}
@ -620,29 +603,22 @@ RemoteDataDecoder::Output(MediaData* aSample)
return;
}
mDecodedData.AppendElement(aSample);
ReturnDecodedData();
}
void
RemoteDataDecoder::ReturnDecodedData()
RemoteDataDecoder::InputExhausted()
{
if (!mTaskQueue->IsCurrentThreadIn()) {
mTaskQueue->Dispatch(
NewRunnableMethod(this, &RemoteDataDecoder::ReturnDecodedData));
NewRunnableMethod(this, &RemoteDataDecoder::InputExhausted));
return;
}
AssertOnTaskQueue();
if (mShutdown) {
return;
}
// We only want to clear mDecodedData when we have resolved the promises.
if (!mDecodePromise.IsEmpty()) {
mDecodePromise.Resolve(mDecodedData, __func__);
mDecodedData.Clear();
} else if (!mDrainPromise.IsEmpty()) {
mDrainPromise.Resolve(mDecodedData, __func__);
mDecodedData.Clear();
}
mDecodePromise.ResolveIfExists(mDecodedData, __func__);
mDecodedData.Clear();
}
void
@ -657,9 +633,8 @@ RemoteDataDecoder::DrainComplete()
if (mShutdown) {
return;
}
mDraining = false;
mDrained = true;
ReturnDecodedData();
mDrainPromise.ResolveIfExists(mDecodedData, __func__);
mDecodedData.Clear();
}
void

Просмотреть файл

@ -48,7 +48,7 @@ protected:
// Methods only called on mTaskQueue.
RefPtr<ShutdownPromise> ProcessShutdown();
void Output(MediaData* aSample);
void ReturnDecodedData();
void InputExhausted();
void DrainComplete();
void Error(const MediaResult& aError);
void AssertOnTaskQueue()
@ -68,10 +68,6 @@ protected:
RefPtr<TaskQueue> mTaskQueue;
// Only ever accessed on mTaskqueue.
bool mShutdown = false;
// Indicates if the decoder has already been drained.
bool mDrained = true;
// Indicates if there's a draining operation pending.
bool mDraining = false;
MozPromiseHolder<DecodePromise> mDecodePromise;
MozPromiseHolder<DecodePromise> mDrainPromise;
DecodedData mDecodedData;

Просмотреть файл

@ -621,7 +621,7 @@ pref("media.decoder.recycle.enabled", true);
pref("media.android-media-codec.enabled", true);
pref("media.android-media-codec.preferred", true);
// Run decoder in seperate process.
pref("media.android-remote-codec.enabled", true);
pref("media.android-remote-codec.enabled", false);
// Enable MSE
pref("media.mediasource.enabled", true);