shithub: openh264

Download patch

ref: 7847f69eab5008153a53052a0bb938818cf5b702
parent: 123b904f77552a23fd0282fe9635278033d3d5a3
parent: 78650363b80920e45b68f61973257437ef150963
author: Ethan Hugg <ethanhugg@gmail.com>
date: Mon Jul 21 15:37:58 EDT 2014

Merge pull request #1200 from ruil2/decoder_ret_1

    add decoder return value

--- a/module/gmp-openh264.cpp
+++ b/module/gmp-openh264.cpp
@@ -608,13 +608,15 @@
       assert (false);
       break;
     }
-
+    DECODING_STATE dState = dsErrorFree;
     worker_thread_->Post (WrapTask (
                             this, &OpenH264VideoDecoder::Decode_w,
                             inputFrame,
                             missingFrames,
+                            dState,
                             renderTimeMs));
-
+    if (dState)
+      return GMPGenericErr;
     return GMPNoErr;
   }
 
@@ -633,6 +635,7 @@
  private:
   void Decode_w (GMPVideoEncodedFrame* inputFrame,
                  bool missingFrames,
+                 DECODING_STATE& dState,
                  int64_t renderTimeMs = -1) {
     GMPLOG (GL_DEBUG, "Frame decode on worker thread length = "
             << inputFrame->Size());
@@ -642,13 +645,13 @@
     memset (&decoded, 0, sizeof (decoded));
     unsigned char* data[3] = {nullptr, nullptr, nullptr};
 
-    int rv = decoder_->DecodeFrame2 (inputFrame->Buffer(),
+    dState = decoder_->DecodeFrame2 (inputFrame->Buffer(),
                                      inputFrame->Size(),
                                      data,
                                      &decoded);
 
-    if (rv) {
-      GMPLOG (GL_ERROR, "Decoding error rv=" << rv);
+    if (dState) {
+      GMPLOG (GL_ERROR, "Decoding error dState=" << dState);
     } else {
       valid = true;
     }