Bug 1353459 - handle queueInputBuffer exceptions. r=esawin
authorJohn Lin <jolin@mozilla.com>
Tue, 11 Apr 2017 16:26:12 +0800
changeset 353385 202eda8e82ce48b6e3e8d0c5e91cef84dd3333b4
parent 353384 b23de5a54b082f8725c503caf84895d68caa88c6
child 353386 3ed60b88774dc3c4aaa8e06ee0f9caf4d957d3fe
push id31665
push userarchaeopteryx@coole-files.de
push dateMon, 17 Apr 2017 14:19:16 +0000
treeherdermozilla-central@3148ecea537e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersesawin
bugs1353459
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1353459 - handle queueInputBuffer exceptions. r=esawin MozReview-Commit-ID: 1Tm0vcl3Uv7
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/Codec.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/CodecProxy.java
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/Codec.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/Codec.java
@@ -142,25 +142,28 @@ import java.util.concurrent.ConcurrentLi
                         sample.writeToByteBuffer(buf);
                     } catch (IOException e) {
                         e.printStackTrace();
                         len = 0;
                     }
                     mSamplePool.recycleInput(sample);
                 }
 
-                if (cryptoInfo != null && len > 0) {
-                    mCodec.queueSecureInputBuffer(index, 0, cryptoInfo, pts, flags);
-                } else {
-                    mCodec.queueInputBuffer(index, 0, len, pts, flags);
-                }
                 try {
+                    if (cryptoInfo != null && len > 0) {
+                        mCodec.queueSecureInputBuffer(index, 0, cryptoInfo, pts, flags);
+                    } else {
+                        mCodec.queueInputBuffer(index, 0, len, pts, flags);
+                    }
                     mCallbacks.onInputQueued(pts);
                 } catch (RemoteException e) {
                     e.printStackTrace();
+                } catch (Exception e) {
+                    reportError(Error.FATAL, e);
+                    return;
                 }
             }
             reportPendingInputs();
         }
 
         private void reportPendingInputs() {
             try {
                 for (Input i : mInputSamples) {
@@ -506,17 +509,21 @@ import java.util.concurrent.ConcurrentLi
         } catch (Exception e) {
             // Translate allocation error to remote exception.
             throw new RemoteException(e.getMessage());
         }
     }
 
     @Override
     public synchronized void queueInput(Sample sample) throws RemoteException {
-        mInputProcessor.onSample(sample);
+        try {
+            mInputProcessor.onSample(sample);
+        } catch (Exception e) {
+            throw new RemoteException(e.getMessage());
+        }
     }
 
     @Override
     public synchronized void setRates(int newBitRate) {
         try {
             mCodec.setRates(newBitRate);
         } catch (Exception e) {
             reportError(Error.FATAL, e);
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/CodecProxy.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/CodecProxy.java
@@ -188,17 +188,17 @@ public final class CodecProxy {
         mCallbacks.setEndOfInput(eos);
 
         if (eos) {
             return sendInput(Sample.EOS);
         }
 
         try {
             return sendInput(mRemote.dequeueInput(info.size).set(bytes, info, cryptoInfo));
-        } catch (RemoteException e) {
+        } catch (RemoteException | NullPointerException e) {
             Log.e(LOGTAG, "fail to dequeue input buffer", e);
             return false;
         } catch (IOException e) {
             Log.e(LOGTAG, "fail to copy input data.", e);
             // Balance dequeue/queue.
             return sendInput(null);
         }
     }