Bug 1314529. Part 2 - remove MediaDecoder::SetMediaSeekable(). draft
authorJW Wang <jwwang@mozilla.com>
Wed, 02 Nov 2016 14:41:04 +0800
changeset 433081 3302492fee4bdc97a80f6f422ccef2fce6a8d0cc
parent 433080 cccd7fe8eee43ba3221a7586ce7fc8fb00f98134
child 433082 eee086cfc4494bd42a03af1093000c45176bade9
push id34479
push userjwwang@mozilla.com
push dateThu, 03 Nov 2016 03:38:31 +0000
bugs1314529
milestone52.0a1
Bug 1314529. Part 2 - remove MediaDecoder::SetMediaSeekable(). MozReview-Commit-ID: 6JJrKi3KTll
dom/media/MediaDecoder.cpp
dom/media/MediaDecoder.h
--- a/dom/media/MediaDecoder.cpp
+++ b/dom/media/MediaDecoder.cpp
@@ -777,17 +777,17 @@ MediaDecoder::MetadataLoaded(nsAutoPtr<M
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(!IsShutdown());
 
   DECODER_LOG("MetadataLoaded, channels=%u rate=%u hasAudio=%d hasVideo=%d",
               aInfo->mAudio.mChannels, aInfo->mAudio.mRate,
               aInfo->HasAudio(), aInfo->HasVideo());
 
-  SetMediaSeekable(aInfo->mMediaSeekable);
+  mMediaSeekable = aInfo->mMediaSeekable;
   SetMediaSeekableOnlyInBufferedRanges(aInfo->mMediaSeekableOnlyInBufferedRanges);
   mInfo = aInfo.forget();
   ConstructMediaTracks();
 
   // Make sure the element and the frame (if any) are told about
   // our new size.
   if (aEventVisibility != MediaDecoderEventVisibility::Suppressed) {
     mFiredMetadataLoaded = true;
@@ -1275,22 +1275,16 @@ MediaDecoder::UpdateEstimatedMediaDurati
       mozilla::Abs(mEstimatedDuration.Ref().ref().ToMicroseconds() - aDuration) < ESTIMATED_DURATION_FUZZ_FACTOR_USECS) {
     return;
   }
 
   mEstimatedDuration = Some(TimeUnit::FromMicroseconds(aDuration));
 }
 
 void
-MediaDecoder::SetMediaSeekable(bool aMediaSeekable) {
-  MOZ_ASSERT(NS_IsMainThread());
-  mMediaSeekable = aMediaSeekable;
-}
-
-void
 MediaDecoder::SetMediaSeekableOnlyInBufferedRanges(bool aMediaSeekableOnlyInBufferedRanges){
   MOZ_ASSERT(NS_IsMainThread());
   mMediaSeekableOnlyInBufferedRanges = aMediaSeekableOnlyInBufferedRanges;
 }
 
 bool
 MediaDecoder::IsTransportSeekable()
 {
--- a/dom/media/MediaDecoder.h
+++ b/dom/media/MediaDecoder.h
@@ -246,18 +246,16 @@ protected:
   // instability is expected; if the incoming duration is not significantly
   // different from the existing duration, the change request is ignored.
   // If the incoming duration is significantly different, the duration is
   // changed, this causes a durationchanged event to fire to the media
   // element.
   void UpdateEstimatedMediaDuration(int64_t aDuration) override;
 
 public:
-  // Set a flag indicating whether random seeking is supported
-  void SetMediaSeekable(bool aMediaSeekable);
   // Set a flag indicating whether seeking is supported only in buffered ranges
   void SetMediaSeekableOnlyInBufferedRanges(bool aMediaSeekableOnlyInBufferedRanges);
 
   // Returns true if this media supports random seeking. False for example with
   // chained ogg files.
   bool IsMediaSeekable();
   // Returns true if this media supports seeking only in buffered ranges. True
   // for example in WebMs with no cues
@@ -567,17 +565,17 @@ private:
 
   void OnPlaybackEvent(MediaEventType aEvent);
   void OnPlaybackErrorEvent(const MediaResult& aError);
 
   void OnDecoderDoctorEvent(DecoderDoctorEvent aEvent);
 
   void OnMediaNotSeekable()
   {
-    SetMediaSeekable(false);
+    mMediaSeekable = false;
   }
 
   void FinishShutdown();
 
   void ConnectMirrors(MediaDecoderStateMachine* aObject);
   void DisconnectMirrors();
 
   MediaEventProducer<void> mDataArrivedEvent;