[vlc-commits] videotoolboc: refactor StopVideoToolboxSession

Thomas Guillem git at videolan.org
Fri Jan 20 11:22:10 CET 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Jan 20 08:51:25 2017 +0100| [bda0b95d2a5504434ca7d17b3d8f650e43359164] | committer: Thomas Guillem

videotoolboc: refactor StopVideoToolboxSession

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

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

diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m
index be50e01..3a2312d 100644
--- a/modules/codec/videotoolbox.m
+++ b/modules/codec/videotoolbox.m
@@ -632,17 +632,23 @@ static int StartVideoToolbox(decoder_t *p_dec, block_t *p_block)
     return VLC_SUCCESS;
 }
 
+static void StopVideoToolboxSession(decoder_t *p_dec)
+{
+    decoder_sys_t *p_sys = p_dec->p_sys;
+
+    VTDecompressionSessionInvalidate(p_sys->session);
+    CFRelease(p_sys->session);
+    p_sys->session = nil;
+    p_sys->b_format_propagated = false;
+}
+
 static void StopVideoToolbox(decoder_t *p_dec)
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
 
     if (p_sys->session != nil) {
         Flush(p_dec);
-        VTDecompressionSessionInvalidate(p_sys->session);
-        CFRelease(p_sys->session);
-        p_sys->session = nil;
-
-        p_sys->b_format_propagated = false;
+        StopVideoToolboxSession(p_dec);
     }
 
     if (p_sys->videoFormatDescription != nil) {
@@ -665,13 +671,8 @@ static void RestartVideoToolbox(decoder_t *p_dec)
 
     msg_Dbg(p_dec, "Restarting decoder session");
 
-    if (p_sys->session != nil) {
-        VTDecompressionSessionInvalidate(p_sys->session);
-        CFRelease(p_sys->session);
-        p_sys->session = nil;
-    }
-
-    p_sys->b_format_propagated = false;
+    if (p_sys->session != nil)
+        StopVideoToolboxSession(p_dec);
 
     Flush(p_dec);
 



More information about the vlc-commits mailing list