[vlc-commits] videotoolbox: lock p_sys->i_restart_count

Thomas Guillem git at videolan.org
Fri Mar 9 13:44:57 CET 2018


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Mar  9 11:32:36 2018 +0100| [580d5dbd5076499f661461b5daa4060f91da3b01] | committer: Thomas Guillem

videotoolbox: lock p_sys->i_restart_count

(cherry picked from commit 8accf7bbddaba294e031dea133b5c9db29257e5c)
Signed-off-by: Thomas Guillem <thomas at gllm.fr>

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

 modules/codec/videotoolbox.m | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m
index db9ba81c8c..77183b2262 100644
--- a/modules/codec/videotoolbox.m
+++ b/modules/codec/videotoolbox.m
@@ -1772,7 +1772,6 @@ static int HandleVTStatus(decoder_t *p_dec, OSStatus status,
             case kVTVideoDecoderBadDataErr:
             case kVTInvalidSessionErr:
                 *p_vtsession_status = VTSESSION_STATUS_RESTART;
-                p_sys->i_restart_count++;
                 break;
             default:
                 *p_vtsession_status = VTSESSION_STATUS_OK;
@@ -1985,6 +1984,8 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_block)
     else
     {
         vlc_mutex_lock(&p_sys->lock);
+        if (vtsession_status == VTSESSION_STATUS_RESTART)
+            p_sys->i_restart_count++;
         p_sys->vtsession_status = vtsession_status;
         /* In case of abort, the decoder module will be reloaded next time
          * since we already modified the input block */
@@ -2146,7 +2147,11 @@ static void DecoderCallback(void *decompressionOutputRefCon,
     if (HandleVTStatus(p_dec, status, &vtsession_status) != VLC_SUCCESS)
     {
         if (p_sys->vtsession_status != VTSESSION_STATUS_ABORT)
+        {
             p_sys->vtsession_status = vtsession_status;
+            if (vtsession_status == VTSESSION_STATUS_RESTART)
+                p_sys->i_restart_count++;
+        }
         goto end;
     }
     if (unlikely(!imageBuffer))



More information about the vlc-commits mailing list