Bug 1173287 - Add calling SeekingStoppedAtEnd(). r=bwu, a=jocheng
authorSotaro Ikeda <sikeda@mozilla.com>
Mon, 15 Jun 2015 06:58:00 -0400
changeset 238641 19f27b4fba89d6b794e79978bd01d0874bfdba01
parent 238640 74510e64899477179b9cc9a5557c621cf916adfe
child 238642 54c620b1d7ef514fbc2cef6697f6df7d75950ae6
push id700
push userryanvm@gmail.com
push dateTue, 16 Jun 2015 22:02:03 +0000
treeherdermozilla-b2g37_v2_2@19f27b4fba89 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbwu, jocheng
bugs1173287
milestone37.0
Bug 1173287 - Add calling SeekingStoppedAtEnd(). r=bwu, a=jocheng
dom/media/MediaDecoder.h
dom/media/omx/MediaOmxCommonDecoder.cpp
dom/media/omx/MediaOmxCommonDecoder.h
--- a/dom/media/MediaDecoder.h
+++ b/dom/media/MediaDecoder.h
@@ -789,17 +789,17 @@ public:
   // sometime in the not-too-distant future, either from the network or from
   // an appendBuffer call on a MediaSource element.
   //
   // Acquires the monitor. Call from any thread.
   virtual bool IsExpectingMoreData();
 
   // Called when the video has completed playing.
   // Call on the main thread only.
-  void PlaybackEnded();
+  virtual void PlaybackEnded();
 
   // Seeking has stopped. Inform the element on the main
   // thread.
   void SeekingStopped();
 
   // Seeking has stopped at the end of the resource. Inform the element on the main
   // thread.
   void SeekingStoppedAtEnd();
--- a/dom/media/omx/MediaOmxCommonDecoder.cpp
+++ b/dom/media/omx/MediaOmxCommonDecoder.cpp
@@ -168,16 +168,30 @@ MediaOmxCommonDecoder::SetPlaybackRate(d
     PlaybackPositionChanged();
     ResumeStateMachine();
   }
 
   MediaDecoder::SetPlaybackRate(aPlaybackRate);
 }
 
 void
+MediaOmxCommonDecoder::PlaybackEnded()
+{
+  MOZ_ASSERT(NS_IsMainThread());
+
+  if (mAudioOffloadPlayer &&
+      mPlayState == PLAY_STATE_SEEKING) {
+    MediaDecoder::SeekingStoppedAtEnd();
+    return;
+  }
+
+  MediaDecoder::PlaybackEnded();
+}
+
+void
 MediaOmxCommonDecoder::ChangeState(PlayState aState)
 {
   MOZ_ASSERT(NS_IsMainThread());
   // Keep MediaDecoder state in sync with MediaElement irrespective of offload
   // playback so it will continue to work in normal mode when offloading fails
   // in between
   MediaDecoder::ChangeState(aState);
 
--- a/dom/media/omx/MediaOmxCommonDecoder.h
+++ b/dom/media/omx/MediaOmxCommonDecoder.h
@@ -31,16 +31,17 @@ public:
   virtual void PlaybackPositionChanged();
   virtual void UpdateReadyStateForData();
   virtual void SetElementVisibility(bool aIsVisible);
   virtual void SetPlatformCanOffloadAudio(bool aCanOffloadAudio);
   virtual bool CheckDecoderCanOffloadAudio();
   virtual void AddOutputStream(ProcessedMediaStream* aStream,
                                bool aFinishWhenEnded);
   virtual void SetPlaybackRate(double aPlaybackRate);
+  virtual void PlaybackEnded();
 
   void AudioOffloadTearDown();
 
   virtual MediaDecoderStateMachine* CreateStateMachine();
 
   virtual MediaOmxCommonReader* CreateReader() = 0;
   virtual MediaDecoderStateMachine* CreateStateMachineFromReader(MediaOmxCommonReader* aReader) = 0;