Bug 1374184. P3 - rename NotifyDownloadProgressed to DownloadProgressed for it is used internally by MediaDecoder and fix the comment.
MozReview-Commit-ID: 6nUEjvZ73ko
--- a/dom/media/MediaDecoder.cpp
+++ b/dom/media/MediaDecoder.cpp
@@ -199,17 +199,17 @@ MediaDecoder::ResourceCallback::TimerCal
void
MediaDecoder::ResourceCallback::NotifyDataArrived()
{
MOZ_ASSERT(NS_IsMainThread());
if (!mDecoder) {
return;
}
- mDecoder->NotifyDownloadProgressed();
+ mDecoder->DownloadProgressed();
if (mTimerArmed) {
return;
}
// In situations where these notifications come from stochastic network
// activity, we can save significant computation by throttling the
// calls to MediaDecoder::NotifyDataArrived() which will update the buffer
// ranges of the reader.
@@ -1040,17 +1040,17 @@ MediaDecoder::ShouldThrottleDownload()
return false;
}
uint32_t factor =
std::max(2u, Preferences::GetUint("media.throttle-factor", 2));
return stats.mDownloadRate > factor * stats.mPlaybackRate;
}
void
-MediaDecoder::NotifyDownloadProgressed()
+MediaDecoder::DownloadProgressed()
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_DIAGNOSTIC_ASSERT(!IsShutdown());
UpdatePlaybackRate();
GetOwner()->DownloadProgressed();
mResource->ThrottleReadahead(ShouldThrottleDownload());
}
@@ -1546,17 +1546,17 @@ MediaDecoder::NotifyDataArrivedInternal(
MOZ_DIAGNOSTIC_ASSERT(!IsShutdown());
mDataArrivedEvent.Notify();
}
void
MediaDecoder::NotifyDataArrived()
{
NotifyDataArrivedInternal();
- NotifyDownloadProgressed();
+ DownloadProgressed();
}
// 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
@@ -582,19 +582,19 @@ protected:
// 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();
- // Called by MediaResource when some data has been received.
+ // Called to recompute playback rate and notify 'progress' event.
// Call on the main thread only.
- void NotifyDownloadProgressed();
+ void DownloadProgressed();
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);