Backed out changeset 14ca527ef1cc (bug 1273523) for Android bustage.
authorRyan VanderMeulen <ryanvm@gmail.com>
Thu, 26 May 2016 10:35:03 -0400
changeset 378931 01575697ce9dca45c2304e28c63e41fe9e418027
parent 378930 5564b762402e5c577f720c88244baeb641738b39
child 378932 388772a2f7620727b3125c722c142abee8a74aa0
push id21011
push usermak77@bonardo.net
push dateThu, 16 Jun 2016 13:40:45 +0000
bugs1273523
milestone47.0
backs out14ca527ef1cc93f67abd0da87ff7616b12852665
Backed out changeset 14ca527ef1cc (bug 1273523) for Android bustage.
dom/media/platforms/android/AndroidDecoderModule.cpp
dom/media/platforms/android/AndroidDecoderModule.h
--- a/dom/media/platforms/android/AndroidDecoderModule.cpp
+++ b/dom/media/platforms/android/AndroidDecoderModule.cpp
@@ -513,50 +513,41 @@ MediaCodecDataDecoder::HandleEOS(int32_t
   }
 
   mDecoder->ReleaseOutputBuffer(aOutputStatus, false);
 }
 
 TimeUnit
 MediaCodecDataDecoder::GetOutputDuration()
 {
-  if (mDurations.empty()) {
-    return Nothing();
-  }
-  const Maybe<TimeUnit> duration = Some(mDurations.front());
+  MOZ_ASSERT(!mDurations.empty(), "Should have had a duration queued");
+  const TimeUnit duration = mDurations.front();
   mDurations.pop();
   return duration;
 }
 
 nsresult
 MediaCodecDataDecoder::ProcessOutput(
     BufferInfo::Param aInfo, MediaFormat::Param aFormat, int32_t aStatus)
 {
   AutoLocalJNIFrame frame(jni::GetEnvForThread(), 1);
 
-  const Maybe<TimeUnit> duration = GetOutputDuration();
-  if (!duration) {
-    // Some devices report failure in QueueSample while actually succeeding at
-    // it, in which case we get an output buffer without having a cached duration
-    // (bug 1273523).
-    return NS_OK;
-  }
-
+  const TimeUnit duration = GetOutputDuration();
   const auto buffer = jni::Object::LocalRef::Adopt(
       frame.GetEnv()->GetObjectArrayElement(mOutputBuffers.Get(), aStatus));
 
   if (buffer) {
     // The buffer will be null on Android L if we are decoding to a Surface.
     void* directBuffer = frame.GetEnv()->GetDirectBufferAddress(buffer.Get());
-    Output(aInfo, directBuffer, aFormat, duration.value());
+    Output(aInfo, directBuffer, aFormat, duration);
   }
 
   // The Surface will be updated at this point (for video).
   mDecoder->ReleaseOutputBuffer(aStatus, true);
-  PostOutput(aInfo, aFormat, duration.value());
+  PostOutput(aInfo, aFormat, duration);
 
   return NS_OK;
 }
 
 void
 MediaCodecDataDecoder::DecoderLoop()
 {
   bool isOutputDone = false;
--- a/dom/media/platforms/android/AndroidDecoderModule.h
+++ b/dom/media/platforms/android/AndroidDecoderModule.h
@@ -6,17 +6,16 @@
 #define AndroidDecoderModule_h_
 
 #include "PlatformDecoderModule.h"
 
 #include "MediaCodec.h"
 #include "SurfaceTexture.h"
 #include "TimeUnits.h"
 #include "mozilla/Monitor.h"
-#include "mozilla/Maybe.h"
 
 #include <queue>
 
 namespace mozilla {
 
 typedef std::queue<RefPtr<MediaRawData>> SampleQueue;
 
 class AndroidDecoderModule : public PlatformDecoderModule {
@@ -98,17 +97,17 @@ protected:
   nsresult ResetOutputBuffers();
 
   nsresult GetInputBuffer(JNIEnv* env, int index, jni::Object::LocalRef* buffer);
   bool WaitForInput();
   already_AddRefed<MediaRawData> PeekNextSample();
   nsresult QueueSample(const MediaRawData* aSample);
   nsresult QueueEOS();
   void HandleEOS(int32_t aOutputStatus);
-  Maybe<media::TimeUnit> GetOutputDuration();
+  media::TimeUnit GetOutputDuration();
   nsresult ProcessOutput(widget::sdk::BufferInfo::Param aInfo,
                          widget::sdk::MediaFormat::Param aFormat,
                          int32_t aStatus);
   ModuleState State() const;
   void State(ModuleState aState);
   void DecoderLoop();
 
   virtual void ClearQueue();