Bug 1374184. P3 - rename NotifyDownloadProgressed to DownloadProgressed for it is used internally by MediaDecoder and fix the comment. draft
authorJW Wang <jwwang@mozilla.com>
Mon, 19 Jun 2017 14:27:58 +0800
changeset 597061 7332d8076ec36179547fade023eab511b1c317d9
parent 597060 25947f7d9be8d2f2817b14e80054bf0dcb5d85e9
child 597111 b2aca87193b7f29719feb5c9184ae4134c27ac3b
child 597115 980d77c9a2e15d289b0d10c9972138a386595fb6
push id64816
push userjwwang@mozilla.com
push dateTue, 20 Jun 2017 03:04:06 +0000
bugs1374184
milestone56.0a1
Bug 1374184. P3 - rename NotifyDownloadProgressed to DownloadProgressed for it is used internally by MediaDecoder and fix the comment. MozReview-Commit-ID: 6nUEjvZ73ko
dom/media/MediaDecoder.cpp
dom/media/MediaDecoder.h
--- 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);