]> granicus.if.org Git - handbrake/commitdiff
libav: update fraem threading state patch
authorjstebbins <jstebbins.hb@gmail.com>
Fri, 22 Aug 2014 15:53:14 +0000 (15:53 +0000)
committerjstebbins <jstebbins.hb@gmail.com>
Fri, 22 Aug 2014 15:53:14 +0000 (15:53 +0000)
Use version written by Janne and committed to libav

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6344 b64f7644-9d1e-0410-96f1-a4d463321fa5

contrib/ffmpeg/A06-frame-threading-state.patch

index e44819a49071f5f16628c641f6b0aa607c992d9e..9efe1f68f9418999ee16e5410d226b60854973af 100644 (file)
-diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
-index a658f3e..c3846bb 100644
---- a/libavcodec/pthread_frame.c
-+++ b/libavcodec/pthread_frame.c
-@@ -298,6 +298,7 @@ static int submit_packet(PerThreadContext *p, AVPacket *avpkt)
-     FrameThreadContext *fctx = p->parent;
-     PerThreadContext *prev_thread = fctx->prev_thread;
-     const AVCodec *codec = p->avctx->codec;
-+    int err = 0;
-     if (!avpkt->size && !(codec->capabilities & CODEC_CAP_DELAY)) return 0;
-@@ -306,7 +307,6 @@ static int submit_packet(PerThreadContext *p, AVPacket *avpkt)
-     release_delayed_buffers(p);
-     if (prev_thread) {
--        int err;
-         if (prev_thread->state == STATE_SETTING_UP) {
-             pthread_mutex_lock(&prev_thread->progress_mutex);
-             while (prev_thread->state == STATE_SETTING_UP)
-@@ -315,10 +315,6 @@ static int submit_packet(PerThreadContext *p, AVPacket *avpkt)
-         }
-         err = update_context_from_thread(p->avctx, prev_thread->avctx, 0);
--        if (err) {
--            pthread_mutex_unlock(&p->mutex);
--            return err;
--        }
-     }
-     av_packet_unref(&p->avpkt);
-@@ -358,7 +354,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
-     fctx->prev_thread = p;
-     fctx->next_decoding++;
--    return 0;
-+    return err;
- }
- int ff_thread_decode_frame(AVCodecContext *avctx,
-@@ -374,6 +370,7 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
-      * Submit a packet to the next decoding thread.
-      */
-+    if (fctx->next_decoding >= avctx->thread_count) fctx->next_decoding = 0;
-     p = &fctx->threads[fctx->next_decoding];
-     err = update_context_from_user(p->avctx, avctx);
-     if (err) return err;
-@@ -426,8 +423,6 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
-     update_context_from_thread(avctx, p->avctx, 1);
--    if (fctx->next_decoding >= avctx->thread_count) fctx->next_decoding = 0;
--
-     fctx->next_finished = finished;
-     /* return the size of the consumed packet if no error occurred */
+Received: from oboro.libav.org (77.109.144.72) by cas.jetheaddev.com\r
+ (192.168.13.27) with Microsoft SMTP Server id 14.3.195.1; Fri, 22 Aug 2014\r
+ 04:13:09 -0700\r
+Received: from oboro.libav.org (localhost [127.0.0.1]) by oboro.libav.org\r
+ (Postfix) with ESMTP id 54F155DBA3;   Fri, 22 Aug 2014 13:13:06 +0200 (CEST)\r
+X-Original-To: libav-commits@libav.org\r
+Delivered-To: libav-commits@libav.org\r
+Received: from localhost (localhost [127.0.0.1]) by oboro.libav.org (Postfix)\r
+ with ESMTP id A5E705DBA3 for <libav-commits@libav.org>; Fri, 22 Aug 2014\r
+ 13:13:04 +0200 (CEST)\r
+Received: from oboro.libav.org ([127.0.0.1]) by localhost (oboro.libav.org\r
+ [127.0.0.1]) (amavisd-new, port 10024) with LMTP id q_DABqtOoALY for\r
+ <libav-commits@libav.org>; Fri, 22 Aug 2014 13:13:04 +0200 (CEST)\r
+Received: from aruru.libav.org (aruru.libav.org [77.109.144.70]) by\r
+ oboro.libav.org (Postfix) with ESMTP id 8C8AA5DB88 for\r
+ <libav-commits@libav.org>; Fri, 22 Aug 2014 13:13:04 +0200 (CEST)\r
+Received: by aruru.libav.org (Postfix, from userid 106) id 8436F5DD71; Fri, 22\r
+ Aug 2014 13:13:04 +0200 (CEST)\r
+To: <libav-commits@libav.org>\r
+From: "Janne Grunau " <git@libav.org>\r
+Message-ID: <20140822111304.8436F5DD71@aruru.libav.org>\r
+Date: Fri, 22 Aug 2014 13:13:04 +0200\r
+Subject: [libav-commits] rv34: use ff_mpeg_update_thread_context only when\r
+       decoder is fully initialized\r
+X-BeenThere: libav-commits@libav.org\r
+X-Mailman-Version: 2.1.15\r
+Precedence: list\r
+Reply-To: <libav-devel@libav.org>\r
+List-Id: libav commit notifications <libav-commits.libav.org>\r
+List-Unsubscribe: <https://lists.libav.org/mailman/options/libav-commits>,\r
+ <mailto:libav-commits-request@libav.org?subject=unsubscribe>\r
+List-Archive: <http://lists.libav.org/pipermail/libav-commits/>\r
+List-Post: <mailto:libav-commits@libav.org>\r
+List-Help: <mailto:libav-commits-request@libav.org?subject=help>\r
+List-Subscribe: <https://lists.libav.org/mailman/listinfo/libav-commits>,\r
+ <mailto:libav-commits-request@libav.org?subject=subscribe>\r
+Content-Type: text/plain; charset="us-ascii"\r
+Content-Transfer-Encoding: 7bit\r
+Errors-To: libav-commits-bounces@libav.org\r
+Sender: libav-commits <libav-commits-bounces@libav.org>\r
+Return-Path: libav-commits-bounces@libav.org\r
+X-MS-Exchange-Organization-AuthSource: cas.jetheaddev.com\r
+X-MS-Exchange-Organization-AuthAs: Anonymous\r
+X-MS-Exchange-Organization-PRD: libav.org\r
+X-MS-Exchange-Organization-SenderIdResult: None\r
+Received-SPF: None (cas.jetheaddev.com: libav-commits-bounces@libav.org does\r
+ not designate permitted sender hosts)\r
+X-MS-Exchange-Organization-SCL: 0\r
+X-MS-Exchange-Organization-PCL: 2\r
+X-MS-Exchange-Organization-Antispam-Report: DV:3.3.14004.476;SID:SenderIDStatus None;OrigIP:77.109.144.72\r
+MIME-Version: 1.0\r
+\r
+Module: libav\r
+Branch: master\r
+Commit: dc4b2e7d33903a6b9380e8a84b22b3a20facbb08\r
+\r
+Author:    Janne Grunau <janne-libav@jannau.net>\r
+Committer: Janne Grunau <janne-libav@jannau.net>\r
+Date:      Thu Aug 21 13:26:33 2014 +0200\r
+\r
+rv34: use ff_mpeg_update_thread_context only when decoder is fully initialized\r
+\r
+MpegEncContext based decoders are only fully initialized after the first\r
+ff_thread_get_buffer() call. The RV30/40 decoders may fail before a frame\r
+buffer was requested. ff_mpeg_update_thread_context() fails on half\r
+initialized MpegEncContexts. Since this can only happen before a the\r
+first frame was decoded there is no need to call\r
+ff_mpeg_update_thread_context().\r
+\r
+Based on patches by John Stebbins and tested by John Stebbins.\r
+\r
+CC: libav-stable@libav.org\r
+\r
+---\r
+\r
+ libavcodec/rv34.c |   10 ++++++----\r
+ 1 file changed, 6 insertions(+), 4 deletions(-)\r
+\r
+diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c\r
+index 4ed2a33..26ab7e4 100644\r
+--- a/libavcodec/rv34.c\r
++++ b/libavcodec/rv34.c\r
+@@ -1555,16 +1555,18 @@ int ff_rv34_decode_update_thread_context(AVCodecContext *dst, const AVCodecConte\r
+             return err;\r
+     }\r
\r
+-    if ((err = ff_mpeg_update_thread_context(dst, src)))\r
+-        return err;\r
+-\r
+     r->cur_pts  = r1->cur_pts;\r
+     r->last_pts = r1->last_pts;\r
+     r->next_pts = r1->next_pts;\r
\r
+     memset(&r->si, 0, sizeof(r->si));\r
\r
+-    return 0;\r
++    // Do no call ff_mpeg_update_thread_context on a partially initialized\r
++    // decoder context.\r
++    if (!s1->linesize)\r
++        return 0;\r
++\r
++    return ff_mpeg_update_thread_context(dst, src);\r
+ }\r
\r
+ static int get_slice_offset(AVCodecContext *avctx, const uint8_t *buf, int n)\r
+\r
+_______________________________________________\r
+libav-commits mailing list\r
+libav-commits@libav.org\r
+https://lists.libav.org/mailman/listinfo/libav-commits\r