[vlc-commits] videotoolbox: abort when restart fails from Malfunction

Thomas Guillem git at videolan.org
Mon Apr 24 17:55:51 CEST 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Apr 24 17:46:30 2017 +0200| [a2df2f3590ff0e190664084a554a3789b687b3da] | committer: Thomas Guillem

videotoolbox: abort when restart fails from Malfunction

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a2df2f3590ff0e190664084a554a3789b687b3da
---

 modules/codec/videotoolbox.m | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m
index 482b0c3f58..edc4c5b65f 100644
--- a/modules/codec/videotoolbox.m
+++ b/modules/codec/videotoolbox.m
@@ -1346,17 +1346,13 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_block)
         p_sys->b_vt_feed = true;
     else
     {
+        bool b_abort = false;
         switch (status)
         {
             case -8960 /* codecErr */:
             case kCVReturnInvalidArgument:
             case kVTVideoDecoderMalfunctionErr:
-                msg_Err(p_dec, "decoder failure, Abort.");
-                /* The decoder module will be reloaded next time since we already
-                 * modified the input block */
-                vlc_mutex_lock(&p_sys->lock);
-                p_dec->p_sys->b_abort = true;
-                vlc_mutex_unlock(&p_sys->lock);
+                b_abort = true;
                 break;
             case -8969 /* codecBadDataErr */:
             case kVTVideoDecoderBadDataErr:
@@ -1368,7 +1364,7 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_block)
                     if (status != 0)
                     {
                         free( p_info );
-                        StopVideoToolbox(p_dec, true);
+                        b_abort = true;
                     }
                 }
                 break;
@@ -1376,6 +1372,15 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_block)
                 RestartVideoToolbox(p_dec, true);
                 break;
         }
+        if (b_abort)
+        {
+            msg_Err(p_dec, "decoder failure, Abort.");
+            /* The decoder module will be reloaded next time since we already
+             * modified the input block */
+            vlc_mutex_lock(&p_sys->lock);
+            p_dec->p_sys->b_abort = true;
+            vlc_mutex_unlock(&p_sys->lock);
+        }
     }
     CFRelease(sampleBuffer);
 



More information about the vlc-commits mailing list