[vlc-commits] [Git][videolan/vlc][master] mediacodec: fix crash with early decoder close

Jean-Baptiste Kempf gitlab at videolan.org
Sat Jun 26 07:36:05 UTC 2021



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
242e43cc by Alexandre Janniaux at 2021-06-26T07:22:34+00:00
mediacodec: fix crash with early decoder close

Since 1fa05cf40605a459c6a256a2073c96b9ac21c15f and
57323ddadbe6579697cc9ecdef0de2fbc6831dac, flush and release have been
made asynchronous and logger object might have been destroyed while we
use the mediacodec API, leading to crash.

- - - - -


3 changed files:

- modules/codec/omxil/mediacodec.c
- modules/codec/omxil/mediacodec_jni.c
- modules/codec/omxil/mediacodec_ndk.c


Changes:

=====================================
modules/codec/omxil/mediacodec.c
=====================================
@@ -1457,6 +1457,12 @@ static void *OutThread(void *data)
                 continue;
         }
 
+        if (i_index == MC_API_ERROR)
+        {
+            msg_Warn(p_dec, "Failure in MediaCodec.dequeueOutputBuffer");
+            break;
+        }
+
         /* Process output returned by dequeue_out */
         if (i_index >= 0 || i_index == MC_API_INFO_OUTPUT_FORMAT_CHANGED
          || i_index == MC_API_INFO_OUTPUT_BUFFERS_CHANGED)
@@ -1495,7 +1501,8 @@ static void *OutThread(void *data)
         else
             break;
     }
-    msg_Warn(p_dec, "OutThread stopped");
+    if (!p_sys->b_decoder_dead)
+        msg_Warn(p_dec, "OutThread stopped");
 
     /* Signal DecoderFlush that the output thread aborted */
     p_sys->b_aborted = true;


=====================================
modules/codec/omxil/mediacodec_jni.c
=====================================
@@ -875,10 +875,8 @@ static int DequeueOutput(mc_api *api, vlc_tick_t i_timeout)
                                     jfields.dequeue_output_buffer,
                                     p_sys->buffer_info, i_timeout);
     if (CHECK_EXCEPTION())
-    {
-        msg_Warn(api->p_obj, "Exception in MediaCodec.dequeueOutputBuffer");
         return MC_API_ERROR;
-    }
+
     if (i_index >= 0)
         return i_index;
     else if (i_index == INFO_OUTPUT_FORMAT_CHANGED)


=====================================
modules/codec/omxil/mediacodec_ndk.c
=====================================
@@ -501,10 +501,7 @@ static int DequeueOutput(mc_api *api, vlc_tick_t i_timeout)
     else if (i_index == AMEDIACODEC_INFO_OUTPUT_FORMAT_CHANGED)
         return MC_API_INFO_OUTPUT_FORMAT_CHANGED;
     else
-    {
-        msg_Warn(api->p_obj, "AMediaCodec.dequeueOutputBuffer failed");
         return MC_API_ERROR;
-    }
 }
 
 /*****************************************************************************



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/242e43ccbda671321d376934816156e47e34ae6b

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/242e43ccbda671321d376934816156e47e34ae6b
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list