]> granicus.if.org Git - handbrake/commitdiff
qsv: Update condition under which context is closed.
authorTim Walker <tdskywalker@gmail.com>
Sun, 11 Sep 2016 01:45:07 +0000 (03:45 +0200)
committerJohn Stebbins <jstebbins.hb@gmail.com>
Sat, 17 Dec 2016 15:28:51 +0000 (07:28 -0800)
libhb/decavcodec.c

index 3ea4dbed47b8c899a876cf52da05ee2f32729c4b..57d3bba3a89b866bcea75bf0aa1378249fd865a5 100644 (file)
@@ -350,9 +350,13 @@ static void closePrivData( hb_work_private_t ** ppv )
              * MFXClose() on the QSV session. Even if decoding is complete, we
              * still need that session for QSV filtering and/or encoding, so we
              * we can't close the context here until we implement a proper fix.
+             *
+             * Interestingly, this may cause crashes even when QSV-accelerated
+             * decoding and encoding sessions are independent (e.g. decoding via
+             * libavcodec, but encoding using libhb, without us requesting any
+             * form of communication between the two libmfx sessions).
              */
-            if (pv->qsv.decode == NULL ||
-                pv->qsv.config.io_pattern != MFX_IOPATTERN_OUT_OPAQUE_MEMORY)
+            if (!(pv->qsv.decode && pv->job != NULL && (pv->job->vcodec & HB_VCODEC_QSV_MASK)))
 #endif
             {
                 hb_avcodec_close(pv->context);