Bug 1031500 - Increase number of buffers for webrtc OMX H.264 decode. r=sotaro, a=2.0+
authorRandell Jesup <rjesup@jesup.org>
Fri, 27 Jun 2014 21:49:24 -0400
changeset 207495 75f0e9ea86296b6fec924e6250c910da6f97bf9e
parent 207494 ad0cdb7f2b46ea5e6503052634bb32c9e604a7c9
child 207496 94a49e5ffdf8960aaf3d81c9a709b708cd83328c
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssotaro, 2
bugs1031500
milestone32.0a2
Bug 1031500 - Increase number of buffers for webrtc OMX H.264 decode. r=sotaro, a=2.0+
media/webrtc/signaling/src/media-conduit/WebrtcOMXH264VideoCodec.cpp
media/webrtc/signaling/src/media-conduit/WebrtcOMXH264VideoCodec.h
--- a/media/webrtc/signaling/src/media-conduit/WebrtcOMXH264VideoCodec.cpp
+++ b/media/webrtc/signaling/src/media-conduit/WebrtcOMXH264VideoCodec.cpp
@@ -278,17 +278,21 @@ public:
     mWidth = aWidth;
     mHeight = aHeight;
 
     sp<Surface> surface = nullptr;
     mNativeWindow = new GonkNativeWindow();
     if (mNativeWindow.get()) {
       // listen to buffers queued by MediaCodec::RenderOutputBufferAndRelease().
       mNativeWindow->setNewFrameCallback(this);
-      surface = new Surface(mNativeWindow->getBufferQueue());
+      // XXX remove buffer changes after a better solution lands - bug 1009420
+      sp<GonkBufferQueue> bq = mNativeWindow->getBufferQueue();
+      // More spare buffers to avoid OMX decoder waiting for native window
+      bq->setMaxAcquiredBufferCount(WEBRTC_OMX_H264_MIN_DECODE_BUFFERS);
+      surface = new Surface(bq);
     }
     status_t result = mCodec->configure(config, surface, nullptr, 0);
     if (result == OK) {
       CODEC_LOGD("OMX:%p decoder configured", this);
       result = Start();
     }
     return result;
   }
--- a/media/webrtc/signaling/src/media-conduit/WebrtcOMXH264VideoCodec.h
+++ b/media/webrtc/signaling/src/media-conduit/WebrtcOMXH264VideoCodec.h
@@ -19,16 +19,19 @@ namespace android {
   class OMXVideoEncoder;
 }
 
 namespace mozilla {
 
 class WebrtcOMXDecoder;
 class OMXOutputDrain;
 
+// XXX see if we can reduce this
+#define WEBRTC_OMX_H264_MIN_DECODE_BUFFERS 10
+
 class WebrtcOMXH264VideoEncoder : public WebrtcVideoEncoder
 {
 public:
   WebrtcOMXH264VideoEncoder();
 
   virtual ~WebrtcOMXH264VideoEncoder();
 
   // Implement VideoEncoder interface.