Bug 1374184. P1 - add NotifyDataArrivedInternal() and let ResourceCallback call it.
MozReview-Commit-ID: GTmNrRtxJ0U
--- a/dom/media/MediaDecoder.cpp
+++ b/dom/media/MediaDecoder.cpp
@@ -187,17 +187,17 @@ MediaDecoder::ResourceCallback::NotifyNe
}
/* static */ void
MediaDecoder::ResourceCallback::TimerCallback(nsITimer* aTimer, void* aClosure)
{
MOZ_ASSERT(NS_IsMainThread());
ResourceCallback* thiz = static_cast<ResourceCallback*>(aClosure);
MOZ_ASSERT(thiz->mDecoder);
- thiz->mDecoder->NotifyDataArrived();
+ thiz->mDecoder->NotifyDataArrivedInternal();
thiz->mTimerArmed = false;
}
void
MediaDecoder::ResourceCallback::NotifyDataArrived()
{
MOZ_ASSERT(NS_IsMainThread());
if (!mDecoder) {
@@ -1535,23 +1535,29 @@ void MediaDecoder::AddSizeOfResources(Re
MOZ_ASSERT(NS_IsMainThread());
if (GetResource()) {
aSizes->mByteSize +=
GetResource()->SizeOfIncludingThis(aSizes->mMallocSizeOf);
}
}
void
-MediaDecoder::NotifyDataArrived()
+MediaDecoder::NotifyDataArrivedInternal()
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_DIAGNOSTIC_ASSERT(!IsShutdown());
mDataArrivedEvent.Notify();
}
+void
+MediaDecoder::NotifyDataArrived()
+{
+ NotifyDataArrivedInternal();
+}
+
// Provide access to the state machine object
MediaDecoderStateMachine*
MediaDecoder::GetStateMachine() const
{
MOZ_ASSERT(NS_IsMainThread());
return mDecoderStateMachine;
}
--- a/dom/media/MediaDecoder.h
+++ b/dom/media/MediaDecoder.h
@@ -584,16 +584,18 @@ protected:
// Amount of buffered data ahead of current time required to consider that
// the next frame is available.
// An arbitrary value of 250ms is used.
static constexpr auto DEFAULT_NEXT_FRAME_AVAILABLE_BUFFERED =
media::TimeUnit::FromMicroseconds(250000);
private:
+ void NotifyDataArrivedInternal();
+
nsCString GetDebugInfo();
// Called when the metadata from the media file has been loaded by the
// state machine. Call on the main thread only.
void MetadataLoaded(UniquePtr<MediaInfo> aInfo,
UniquePtr<MetadataTags> aTags,
MediaDecoderEventVisibility aEventVisibility);