2016-03-31 11:32:03 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef MediaDecoderReaderWrapper_h_
|
|
|
|
#define MediaDecoderReaderWrapper_h_
|
|
|
|
|
|
|
|
#include "mozilla/AbstractThread.h"
|
|
|
|
#include "mozilla/RefPtr.h"
|
|
|
|
#include "nsISupportsImpl.h"
|
|
|
|
|
|
|
|
#include "MediaDecoderReader.h"
|
2016-04-27 09:50:23 +03:00
|
|
|
#include "MediaCallbackID.h"
|
2016-03-31 11:32:03 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
class StartTimeRendezvous;
|
|
|
|
|
|
|
|
typedef MozPromise<bool, bool, /* isExclusive = */ false> HaveStartTimePromise;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A wrapper around MediaDecoderReader to offset the timestamps of Audio/Video
|
|
|
|
* samples by the start time to ensure MDSM can always assume zero start time.
|
|
|
|
* It also adjusts the seek target passed to Seek() to ensure correct seek time
|
|
|
|
* is passed to the underlying reader.
|
|
|
|
*/
|
|
|
|
class MediaDecoderReaderWrapper {
|
|
|
|
typedef MediaDecoderReader::MetadataPromise MetadataPromise;
|
2016-04-22 09:16:49 +03:00
|
|
|
typedef MediaDecoderReader::MediaDataPromise MediaDataPromise;
|
2016-03-31 11:32:03 +03:00
|
|
|
typedef MediaDecoderReader::SeekPromise SeekPromise;
|
2016-04-19 11:14:30 +03:00
|
|
|
typedef MediaDecoderReader::WaitForDataPromise WaitForDataPromise;
|
|
|
|
typedef MediaDecoderReader::BufferedUpdatePromise BufferedUpdatePromise;
|
2016-04-18 09:33:52 +03:00
|
|
|
typedef MediaDecoderReader::TargetQueues TargetQueues;
|
2016-03-31 11:32:03 +03:00
|
|
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaDecoderReaderWrapper);
|
|
|
|
|
2016-04-27 09:50:23 +03:00
|
|
|
/*
|
|
|
|
* Type 1: void(MediaData*)
|
|
|
|
* void(RefPtr<MediaData>)
|
|
|
|
*/
|
|
|
|
template <typename T>
|
|
|
|
class ArgType1CheckHelper {
|
|
|
|
template<typename C, typename... Ts>
|
|
|
|
static TrueType
|
|
|
|
test(void(C::*aMethod)(Ts...),
|
|
|
|
decltype((DeclVal<C>().*aMethod)(DeclVal<MediaData*>()), 0));
|
|
|
|
|
|
|
|
template <typename F>
|
|
|
|
static TrueType
|
|
|
|
test(F&&, decltype(DeclVal<F>()(DeclVal<MediaData*>()), 0));
|
|
|
|
|
|
|
|
static FalseType test(...);
|
|
|
|
public:
|
|
|
|
typedef decltype(test(DeclVal<T>(), 0)) Type;
|
|
|
|
};
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
struct ArgType1Check : public ArgType1CheckHelper<T>::Type {};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Type 2: void(MediaData*, TimeStamp)
|
|
|
|
* void(RefPtr<MediaData>, TimeStamp)
|
|
|
|
* void(MediaData*, TimeStamp&)
|
|
|
|
* void(RefPtr<MediaData>, const TimeStamp&&)
|
|
|
|
*/
|
|
|
|
template <typename T>
|
|
|
|
class ArgType2CheckHelper {
|
|
|
|
|
|
|
|
template<typename C, typename... Ts>
|
|
|
|
static TrueType
|
|
|
|
test(void(C::*aMethod)(Ts...),
|
|
|
|
decltype((DeclVal<C>().*aMethod)(DeclVal<MediaData*>(), DeclVal<TimeStamp>()), 0));
|
|
|
|
|
|
|
|
template <typename F>
|
|
|
|
static TrueType
|
|
|
|
test(F&&, decltype(DeclVal<F>()(DeclVal<MediaData*>(), DeclVal<TimeStamp>()), 0));
|
|
|
|
|
|
|
|
static FalseType test(...);
|
|
|
|
public:
|
|
|
|
typedef decltype(test(DeclVal<T>(), 0)) Type;
|
|
|
|
};
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
struct ArgType2Check : public ArgType2CheckHelper<T>::Type {};
|
|
|
|
|
|
|
|
struct CallbackBase
|
|
|
|
{
|
|
|
|
virtual ~CallbackBase() {}
|
|
|
|
virtual void OnResolved(MediaData*, TimeStamp) = 0;
|
|
|
|
virtual void OnRejected(MediaDecoderReader::NotDecodedReason) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename ThisType, typename ResolveMethodType, typename RejectMethodType>
|
|
|
|
struct MethodCallback : public CallbackBase
|
|
|
|
{
|
|
|
|
MethodCallback(ThisType* aThis, ResolveMethodType aResolveMethod, RejectMethodType aRejectMethod)
|
|
|
|
: mThis(aThis), mResolveMethod(aResolveMethod), mRejectMethod(aRejectMethod)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename F>
|
|
|
|
typename EnableIf<ArgType1Check<F>::value, void>::Type
|
|
|
|
CallHelper(MediaData* aSample, TimeStamp)
|
|
|
|
{
|
|
|
|
(mThis->*mResolveMethod)(aSample);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename F>
|
|
|
|
typename EnableIf<ArgType2Check<F>::value, void>::Type
|
|
|
|
CallHelper(MediaData* aSample, TimeStamp aDecodeStartTime)
|
|
|
|
{
|
|
|
|
(mThis->*mResolveMethod)(aSample, aDecodeStartTime);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OnResolved(MediaData* aSample, TimeStamp aDecodeStartTime) override
|
|
|
|
{
|
|
|
|
CallHelper<ResolveMethodType>(aSample, aDecodeStartTime);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OnRejected(MediaDecoderReader::NotDecodedReason aReason) override
|
|
|
|
{
|
|
|
|
(mThis->*mRejectMethod)(aReason);
|
|
|
|
}
|
|
|
|
|
|
|
|
RefPtr<ThisType> mThis;
|
|
|
|
ResolveMethodType mResolveMethod;
|
|
|
|
RejectMethodType mRejectMethod;
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename ResolveFunctionType, typename RejectFunctionType>
|
|
|
|
struct FunctionCallback : public CallbackBase
|
|
|
|
{
|
|
|
|
FunctionCallback(ResolveFunctionType&& aResolveFuntion, RejectFunctionType&& aRejectFunction)
|
|
|
|
: mResolveFuntion(Move(aResolveFuntion)), mRejectFunction(Move(aRejectFunction))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename F>
|
|
|
|
typename EnableIf<ArgType1Check<F>::value, void>::Type
|
|
|
|
CallHelper(MediaData* aSample, TimeStamp)
|
|
|
|
{
|
|
|
|
mResolveFuntion(aSample);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename F>
|
|
|
|
typename EnableIf<ArgType2Check<F>::value, void>::Type
|
|
|
|
CallHelper(MediaData* aSample, TimeStamp aDecodeStartTime)
|
|
|
|
{
|
|
|
|
mResolveFuntion(aSample, aDecodeStartTime);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OnResolved(MediaData* aSample, TimeStamp aDecodeStartTime) override
|
|
|
|
{
|
|
|
|
CallHelper<ResolveFunctionType>(aSample, aDecodeStartTime);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OnRejected(MediaDecoderReader::NotDecodedReason aReason) override
|
|
|
|
{
|
|
|
|
mRejectFunction(aReason);
|
|
|
|
}
|
|
|
|
|
|
|
|
ResolveFunctionType mResolveFuntion;
|
|
|
|
RejectFunctionType mRejectFunction;
|
|
|
|
};
|
|
|
|
|
2016-05-19 12:55:55 +03:00
|
|
|
struct WaitForDataCallbackBase
|
|
|
|
{
|
|
|
|
virtual ~WaitForDataCallbackBase() {}
|
|
|
|
virtual void OnResolved(MediaData::Type aType) = 0;
|
|
|
|
virtual void OnRejected(WaitForDataRejectValue aRejection) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename ThisType, typename ResolveMethodType, typename RejectMethodType>
|
|
|
|
struct WaitForDataMethodCallback : public WaitForDataCallbackBase
|
|
|
|
{
|
|
|
|
WaitForDataMethodCallback(ThisType* aThis, ResolveMethodType aResolveMethod, RejectMethodType aRejectMethod)
|
|
|
|
: mThis(aThis), mResolveMethod(aResolveMethod), mRejectMethod(aRejectMethod)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void OnResolved(MediaData::Type aType) override
|
|
|
|
{
|
|
|
|
(mThis->*mResolveMethod)(aType);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OnRejected(WaitForDataRejectValue aRejection) override
|
|
|
|
{
|
|
|
|
(mThis->*mRejectMethod)(aRejection);
|
|
|
|
}
|
|
|
|
|
|
|
|
RefPtr<ThisType> mThis;
|
|
|
|
ResolveMethodType mResolveMethod;
|
|
|
|
RejectMethodType mRejectMethod;
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename ResolveFunctionType, typename RejectFunctionType>
|
|
|
|
struct WaitForDataFunctionCallback : public WaitForDataCallbackBase
|
|
|
|
{
|
|
|
|
WaitForDataFunctionCallback(ResolveFunctionType&& aResolveFuntion, RejectFunctionType&& aRejectFunction)
|
|
|
|
: mResolveFuntion(Move(aResolveFuntion)), mRejectFunction(Move(aRejectFunction))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void OnResolved(MediaData::Type aType) override
|
|
|
|
{
|
|
|
|
mResolveFuntion(aType);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OnRejected(WaitForDataRejectValue aRejection) override
|
|
|
|
{
|
|
|
|
mRejectFunction(aRejection);
|
|
|
|
}
|
|
|
|
|
|
|
|
ResolveFunctionType mResolveFuntion;
|
|
|
|
RejectFunctionType mRejectFunction;
|
|
|
|
};
|
|
|
|
|
2016-03-31 11:32:03 +03:00
|
|
|
public:
|
|
|
|
MediaDecoderReaderWrapper(bool aIsRealTime,
|
|
|
|
AbstractThread* aOwnerThread,
|
|
|
|
MediaDecoderReader* aReader);
|
|
|
|
|
|
|
|
media::TimeUnit StartTime() const;
|
|
|
|
RefPtr<MetadataPromise> ReadMetadata();
|
|
|
|
RefPtr<HaveStartTimePromise> AwaitStartTime();
|
2016-04-27 09:50:23 +03:00
|
|
|
|
|
|
|
template<typename ThisType, typename ResolveMethodType, typename RejectMethodType>
|
|
|
|
CallbackID
|
|
|
|
SetAudioCallback(ThisType* aThisVal,
|
|
|
|
ResolveMethodType aResolveMethod,
|
|
|
|
RejectMethodType aRejectMethod)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn());
|
|
|
|
MOZ_ASSERT(!mRequestAudioDataCB,
|
|
|
|
"Please cancel the original callback before setting a new one.");
|
|
|
|
|
|
|
|
mRequestAudioDataCB.reset(
|
|
|
|
new MethodCallback<ThisType, ResolveMethodType, RejectMethodType>(
|
|
|
|
aThisVal, aResolveMethod, aRejectMethod));
|
|
|
|
|
|
|
|
return mAudioCallbackID;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename ResolveFunction, typename RejectFunction>
|
|
|
|
CallbackID
|
|
|
|
SetAudioCallback(ResolveFunction&& aResolveFunction,
|
|
|
|
RejectFunction&& aRejectFunction)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn());
|
|
|
|
MOZ_ASSERT(!mRequestAudioDataCB,
|
|
|
|
"Please cancel the original callback before setting a new one.");
|
|
|
|
|
|
|
|
mRequestAudioDataCB.reset(
|
|
|
|
new FunctionCallback<ResolveFunction, RejectFunction>(
|
|
|
|
Move(aResolveFunction), Move(aRejectFunction)));
|
|
|
|
|
|
|
|
return mAudioCallbackID;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename ThisType, typename ResolveMethodType, typename RejectMethodType>
|
|
|
|
CallbackID
|
|
|
|
SetVideoCallback(ThisType* aThisVal,
|
|
|
|
ResolveMethodType aResolveMethod,
|
|
|
|
RejectMethodType aRejectMethod)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn());
|
|
|
|
MOZ_ASSERT(!mRequestVideoDataCB,
|
|
|
|
"Please cancel the original callback before setting a new one.");
|
|
|
|
|
|
|
|
mRequestVideoDataCB.reset(
|
|
|
|
new MethodCallback<ThisType, ResolveMethodType, RejectMethodType>(
|
|
|
|
aThisVal, aResolveMethod, aRejectMethod));
|
|
|
|
|
|
|
|
return mVideoCallbackID;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename ResolveFunction, typename RejectFunction>
|
|
|
|
CallbackID
|
|
|
|
SetVideoCallback(ResolveFunction&& aResolveFunction,
|
|
|
|
RejectFunction&& aRejectFunction)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn());
|
|
|
|
MOZ_ASSERT(!mRequestVideoDataCB,
|
|
|
|
"Please cancel the original callback before setting a new one.");
|
|
|
|
|
|
|
|
mRequestVideoDataCB.reset(
|
|
|
|
new FunctionCallback<ResolveFunction, RejectFunction>(
|
|
|
|
Move(aResolveFunction), Move(aRejectFunction)));
|
|
|
|
|
|
|
|
return mVideoCallbackID;
|
|
|
|
}
|
|
|
|
|
2016-05-19 12:55:55 +03:00
|
|
|
template<typename ThisType, typename ResolveMethodType, typename RejectMethodType>
|
|
|
|
CallbackID
|
|
|
|
SetWaitAudioCallback(ThisType* aThisVal,
|
|
|
|
ResolveMethodType aResolveMethod,
|
|
|
|
RejectMethodType aRejectMethod)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn());
|
|
|
|
MOZ_ASSERT(!mWaitAudioDataCB,
|
|
|
|
"Please cancel the original callback before setting a new one.");
|
|
|
|
|
|
|
|
mWaitAudioDataCB.reset(
|
|
|
|
new WaitForDataMethodCallback<ThisType, ResolveMethodType, RejectMethodType>(
|
|
|
|
aThisVal, aResolveMethod, aRejectMethod));
|
|
|
|
|
|
|
|
return mWaitAudioCallbackID;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename ResolveFunction, typename RejectFunction>
|
|
|
|
CallbackID
|
|
|
|
SetWaitAudioCallback(ResolveFunction&& aResolveFunction,
|
|
|
|
RejectFunction&& aRejectFunction)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn());
|
|
|
|
MOZ_ASSERT(!mWaitAudioDataCB,
|
|
|
|
"Please cancel the original callback before setting a new one.");
|
|
|
|
|
|
|
|
mWaitAudioDataCB.reset(
|
|
|
|
new WaitForDataFunctionCallback<ResolveFunction, RejectFunction>(
|
|
|
|
Move(aResolveFunction), Move(aRejectFunction)));
|
|
|
|
|
|
|
|
return mWaitAudioCallbackID;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename ThisType, typename ResolveMethodType, typename RejectMethodType>
|
|
|
|
CallbackID
|
|
|
|
SetWaitVideoCallback(ThisType* aThisVal,
|
|
|
|
ResolveMethodType aResolveMethod,
|
|
|
|
RejectMethodType aRejectMethod)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn());
|
|
|
|
MOZ_ASSERT(!mWaitVideoDataCB,
|
|
|
|
"Please cancel the original callback before setting a new one.");
|
|
|
|
|
|
|
|
mWaitVideoDataCB.reset(
|
|
|
|
new WaitForDataMethodCallback<ThisType, ResolveMethodType, RejectMethodType>(
|
|
|
|
aThisVal, aResolveMethod, aRejectMethod));
|
|
|
|
|
|
|
|
return mWaitVideoCallbackID;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename ResolveFunction, typename RejectFunction>
|
|
|
|
CallbackID
|
|
|
|
SetWaitVideoCallback(ResolveFunction&& aResolveFunction,
|
|
|
|
RejectFunction&& aRejectFunction)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn());
|
|
|
|
MOZ_ASSERT(!mWaitVideoDataCB,
|
|
|
|
"Please cancel the original callback before setting a new one.");
|
|
|
|
|
|
|
|
mWaitVideoDataCB.reset(
|
|
|
|
new WaitForDataFunctionCallback<ResolveFunction, RejectFunction>(
|
|
|
|
Move(aResolveFunction), Move(aRejectFunction)));
|
|
|
|
|
|
|
|
return mWaitVideoCallbackID;
|
|
|
|
}
|
|
|
|
|
2016-04-27 09:50:23 +03:00
|
|
|
void CancelAudioCallback(CallbackID aID);
|
|
|
|
void CancelVideoCallback(CallbackID aID);
|
2016-05-19 12:55:55 +03:00
|
|
|
void CancelWaitAudioCallback(CallbackID aID);
|
|
|
|
void CancelWaitVideoCallback(CallbackID aID);
|
2016-04-27 09:50:23 +03:00
|
|
|
|
|
|
|
// NOTE: please set callbacks before requesting audio/video data!
|
|
|
|
void RequestAudioData();
|
|
|
|
void RequestVideoData(bool aSkipToNextKeyframe, media::TimeUnit aTimeThreshold);
|
|
|
|
|
2016-05-19 14:02:20 +03:00
|
|
|
// NOTE: please set callbacks before invoking WaitForData()!
|
|
|
|
void WaitForData(MediaData::Type aType);
|
|
|
|
|
2016-04-27 09:50:23 +03:00
|
|
|
bool IsRequestingAudioData() const;
|
2016-05-13 03:22:30 +03:00
|
|
|
bool IsRequestingVideoData() const;
|
2016-05-19 12:55:55 +03:00
|
|
|
bool IsWaitingAudioData() const;
|
|
|
|
bool IsWaitingVideoData() const;
|
2016-04-27 09:50:23 +03:00
|
|
|
|
2016-03-31 11:32:03 +03:00
|
|
|
RefPtr<SeekPromise> Seek(SeekTarget aTarget, media::TimeUnit aEndTime);
|
2016-04-19 11:14:30 +03:00
|
|
|
RefPtr<BufferedUpdatePromise> UpdateBufferedWithPromise();
|
|
|
|
RefPtr<ShutdownPromise> Shutdown();
|
|
|
|
|
|
|
|
void ReleaseMediaResources();
|
|
|
|
void SetIdle();
|
2016-04-18 09:33:52 +03:00
|
|
|
void ResetDecode(TargetQueues aQueues);
|
2016-04-19 11:14:30 +03:00
|
|
|
|
|
|
|
nsresult Init() { return mReader->Init(); }
|
2016-04-19 11:14:33 +03:00
|
|
|
bool IsWaitForDataSupported() const { return mReader->IsWaitForDataSupported(); }
|
2016-04-19 11:14:30 +03:00
|
|
|
bool IsAsync() const { return mReader->IsAsync(); }
|
2016-04-19 11:14:33 +03:00
|
|
|
bool UseBufferingHeuristics() const { return mReader->UseBufferingHeuristics(); }
|
2016-04-19 11:14:30 +03:00
|
|
|
bool ForceZeroStartTime() const { return mReader->ForceZeroStartTime(); }
|
|
|
|
|
|
|
|
bool VideoIsHardwareAccelerated() const {
|
|
|
|
return mReader->VideoIsHardwareAccelerated();
|
|
|
|
}
|
|
|
|
TimedMetadataEventSource& TimedMetadataEvent() {
|
|
|
|
return mReader->TimedMetadataEvent();
|
|
|
|
}
|
2016-04-20 09:45:40 +03:00
|
|
|
MediaEventSource<void>& OnMediaNotSeekable() {
|
|
|
|
return mReader->OnMediaNotSeekable();
|
|
|
|
}
|
|
|
|
size_t SizeOfVideoQueueInBytes() const {
|
|
|
|
return mReader->SizeOfVideoQueueInBytes();
|
|
|
|
}
|
|
|
|
size_t SizeOfAudioQueueInBytes() const {
|
|
|
|
return mReader->SizeOfAudioQueueInBytes();
|
|
|
|
}
|
2016-04-19 11:14:30 +03:00
|
|
|
size_t SizeOfAudioQueueInFrames() const {
|
|
|
|
return mReader->SizeOfAudioQueueInFrames();
|
|
|
|
}
|
|
|
|
size_t SizeOfVideoQueueInFrames() const {
|
|
|
|
return mReader->SizeOfVideoQueueInFrames();
|
|
|
|
}
|
|
|
|
void ReadUpdatedMetadata(MediaInfo* aInfo) {
|
|
|
|
mReader->ReadUpdatedMetadata(aInfo);
|
|
|
|
}
|
|
|
|
AbstractCanonical<media::TimeIntervals>* CanonicalBuffered() {
|
|
|
|
return mReader->CanonicalBuffered();
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef MOZ_EME
|
|
|
|
void SetCDMProxy(CDMProxy* aProxy) { mReader->SetCDMProxy(aProxy); }
|
|
|
|
#endif
|
2016-03-31 11:32:03 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
~MediaDecoderReaderWrapper();
|
|
|
|
|
|
|
|
void OnMetadataRead(MetadataHolder* aMetadata);
|
|
|
|
void OnMetadataNotRead() {}
|
2016-04-27 09:50:23 +03:00
|
|
|
void OnSampleDecoded(CallbackBase* aCallback, MediaData* aSample,
|
|
|
|
TimeStamp aVideoDecodeStartTime);
|
|
|
|
void OnNotDecoded(CallbackBase* aCallback,
|
|
|
|
MediaDecoderReader::NotDecodedReason aReason);
|
2016-03-31 11:32:03 +03:00
|
|
|
|
2016-05-19 14:02:20 +03:00
|
|
|
UniquePtr<WaitForDataCallbackBase>& WaitCallbackRef(MediaData::Type aType);
|
|
|
|
MozPromiseRequestHolder<WaitForDataPromise>& WaitRequestRef(MediaData::Type aType);
|
|
|
|
|
2016-03-31 11:32:03 +03:00
|
|
|
const bool mForceZeroStartTime;
|
|
|
|
const RefPtr<AbstractThread> mOwnerThread;
|
|
|
|
const RefPtr<MediaDecoderReader> mReader;
|
|
|
|
|
|
|
|
bool mShutdown = false;
|
|
|
|
RefPtr<StartTimeRendezvous> mStartTimeRendezvous;
|
2016-04-27 09:50:23 +03:00
|
|
|
|
|
|
|
UniquePtr<CallbackBase> mRequestAudioDataCB;
|
|
|
|
UniquePtr<CallbackBase> mRequestVideoDataCB;
|
2016-05-19 12:55:55 +03:00
|
|
|
UniquePtr<WaitForDataCallbackBase> mWaitAudioDataCB;
|
|
|
|
UniquePtr<WaitForDataCallbackBase> mWaitVideoDataCB;
|
2016-04-27 09:50:23 +03:00
|
|
|
MozPromiseRequestHolder<MediaDataPromise> mAudioDataRequest;
|
|
|
|
MozPromiseRequestHolder<MediaDataPromise> mVideoDataRequest;
|
2016-05-19 12:55:55 +03:00
|
|
|
MozPromiseRequestHolder<WaitForDataPromise> mAudioWaitRequest;
|
|
|
|
MozPromiseRequestHolder<WaitForDataPromise> mVideoWaitRequest;
|
2016-04-27 09:50:23 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* These callback ids are used to prevent mis-canceling callback.
|
|
|
|
*/
|
|
|
|
CallbackID mAudioCallbackID;
|
|
|
|
CallbackID mVideoCallbackID;
|
2016-05-19 12:55:55 +03:00
|
|
|
CallbackID mWaitAudioCallbackID;
|
|
|
|
CallbackID mWaitVideoCallbackID;
|
2016-03-31 11:32:03 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // MediaDecoderReaderWrapper_h_
|