From patchwork Thu Sep 2 15:41:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 29969 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp400434iov; Thu, 2 Sep 2021 08:42:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+0eBMzgWTM+gfuTREyvqhyuq9DMaHDIeimP77fqDjVskOstyJsAX8u+ofz0BbHrbT4gRo X-Received: by 2002:a17:906:878f:: with SMTP id za15mr4550333ejb.140.1630597357527; Thu, 02 Sep 2021 08:42:37 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id n25si2085703ejl.672.2021.09.02.08.42.37; Thu, 02 Sep 2021 08:42:37 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=ffKMYpbF; arc=fail (body hash mismatch); spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CA5A168A62F; Thu, 2 Sep 2021 18:42:02 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-oln040092074061.outbound.protection.outlook.com [40.92.74.61]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 80B1668A56C for ; Thu, 2 Sep 2021 18:42:00 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gckRuLEsPML21cyDtw/mn55ivG/fnSYddgeQ9VeiYa2rgVXwrPIohctfS0x2ylnNx2e5Y4YWyozDWCzUuONI5MNb5J3XY7mZDeTm04XtVmbOm2uzAtvNxHdMy9BizLMl/TrfQq16R84Bh23EnCMeiUTj15MiPmtd07m0gryEVJtlmayoZpvgjzWjICZaruOn5aaCx5gUbZ0nlui96lULAGBzl1MXyY2lYzKBo/SUEJYGA/4Pb9/EjBiZTFLWeFrCdfJOgmt50ty+ORgSH4Q9YjPaDXMpT7HirR11ProIEXhSdE/3Ctlms2h4AFjKzuUQiXKaVdUpgHFW5OiQPk4Tjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=OU+asJWM85uywzSK5+3s5iI9whYOKK6YdKfO2SqipYA=; b=O4uvervMcOJCTRNggOMYmwZ1PktqTmoCED9wVHVBD4AAo9NXGCuKTCf5YSfLECHBW4eJgQnbnzZMWLcgu+OjO/Mk/0sIEgMohlBSS6jifcv4Do1/CxNg0jBn7/GSsP0uU+0HDOijkDJbYT7MN5JXFtmaWeZpXzADA6vF6Dkz/qHt3IRShI89QNtBmLOXpSqemEQ8aue/Pr9En3yuW+WZA22XuqqX+y2oVLSnmK1IDcRlR4ovB6GJ1smVSwyHx1LtcyCmTm9l83qAVmLyvKHcD6woBLv/ejJyW2vitl834sZTfCf6Gr8Jd8VunlxmLrFGu9TleZC4QOLBtrokxTy6Fw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OU+asJWM85uywzSK5+3s5iI9whYOKK6YdKfO2SqipYA=; b=ffKMYpbF6zDk55SCzqJ9hWor+CymYwK5DWu+KiF5H/DOMouFxy9QzchnuFbur7suChsrFhX0eBEEQpEaVH0Opfp117lh1fR4jCTMQWrb2rsJTczjw6vukjmRT8N1TNUExy4f4ubYH72Wnlz6tpqkgmZpW1qwC6nTQ1TW1gVDnRmM1+Qy0IqYE+KZSiBNqzkKZCsow2fIEhIN67ItjfGJS59bHgpW8kk9QSVgxdQYMTLkqe21+9PqMGmZpkvfKYfQCdBTojTEItbwWoY03rwKPB4EKcOJRMcKdBercS9S7O8ZOA/T3kA9raeVHv9iOlPTuehn4je6VDXkz/q2C4s1Ow== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM5PR0301MB2436.eurprd03.prod.outlook.com (2603:10a6:203:8::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.19; Thu, 2 Sep 2021 15:41:55 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f8b5:1ef2:89b2:f8c5]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f8b5:1ef2:89b2:f8c5%7]) with mapi id 15.20.4457.024; Thu, 2 Sep 2021 15:41:55 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 2 Sep 2021 17:41:27 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [EnPTL/N1NdnX13xyfNwOO0cIUD5CQZAS] X-ClientProxiedBy: PR1P264CA0031.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:19f::18) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210902154127.2571616-12-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by PR1P264CA0031.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:19f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.20 via Frontend Transport; Thu, 2 Sep 2021 15:41:54 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 67c6bf95-de6e-4c34-bfd0-08d96e2830f9 X-MS-Exchange-SLBlob-MailProps: q+fD6XS3/UI47HzvBIDxi1MyuBlz6AIUdMTW1jCPOuc2mcRG5dlGgVvOXEZOkq5z9OBMIr5UJSgKYfpd9lUIKH+XeMouWI+kamDVWsxSG/GTDLd7TmLGaFlZYE21N5W63LeTw8kPdypSp4kfzgI4ffeThbUwm0t0O2kCuYQssXjD3jdFKREGzg0QlzRijlanjrjtNgaNxYICbfhHXVdyMmgWCmT/t30kFyWlwI4+W7yAm4edkkGwkLpnM28HRgF0VkDcICTELau4j3CiZZVKGQiSycOcxYPXJ2aQfZQhg0cymTvpfYS+L39QBc4WykqXLpFpya4XYN4i70ERj01usk3vbQzGoMPQGRdocMRbH8lETpaIUE5G7h+5c8aARtaIw9Wj1L58sgpbeiz/kOO14ZTqpCYF5/7N5ygBx9kgvAZ4Gugi/24gSBCkPWQq+hsqYZoNGgzZCf6RVJGrzTYrhe7+LU07B3aOrpjboOcQJdwCtxzQQ/kx7Eq4qqP+l2Pk7cFU8acBTOY4nuD45xYTkHYIsXtkGzDVj6X592XKA1ub/r+0VIv5Ekf4ySv6mBy2EfYx55d0xtM9msWG78gLATbPwG2MpuGUY51hOzNJyM3M8LvqtXFu7kVHc/eQcxuGVXBKeA7p50vj+X42t909PSUsRsGD0kfBqE2+DnIZGi9QDulU0G2FmJyb1kmBASj+NaP+bILBrSTGezyf8wjTRg== X-MS-TrafficTypeDiagnostic: AM5PR0301MB2436: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: k/JHa0hjA0NPlCh2vDHxVH4hmWT9Z0EAXxwcUTW78XwBBiROdh/hp/kl5lRg/Cs8UY+BP1YA8gYagY7yWn/RUK8Iin0JxNQtoZ95Orq1BOFf0Ju7BY8q09w/clW6meOA2kYQcUWHaImTfWSSYdMGnDUcy/LxgcKtvCGKIeug3oH20/pbVmakY7OLmT+h0fWOVfPdQAGZiueF/IiSPK7+B4+KWCNa1FI+N1Yr4mUpC9G+tyeTN4S0kuQ8yQ7sT8uqhbW1xzXHmgB4OMPFaPW/l5RJVT7R2r3Car2AC6H67AlK0ieBFToSNgIb+DvTJrYwsUY9Nk32YZdKuQNdSVrw9DxEVCu+JxAjMawIz4u2Cipef2MNrYPKUh3Le6BEo34V3S8TjU56VWtGZ/vscBX/BP35/uBLHgxvOdDwvQoTaEIYo5vp8fWzCN7JwqCoWSGy X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LuhrZezSQ5orzr/0u8enzMG3cAdNPJyZJjfdBNUlIiwTGmhCWfvhJD7QFdEdv/JGn2EulGqLqdW+JK6eVNdKZ+ROvKSac1bfad2FmHe8Q8szPBuJRKjFLihgH1et18dClOx+9fT7tZbLv2BSb9RuMQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67c6bf95-de6e-4c34-bfd0-08d96e2830f9 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Sep 2021 15:41:55.1476 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0301MB2436 Subject: [FFmpeg-devel] [PATCH 13/13] avcodec/omx: Reindentation X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: PBWhOSaeg7wP Signed-off-by: Andreas Rheinhardt --- libavcodec/omx.c | 62 ++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/libavcodec/omx.c b/libavcodec/omx.c index 7086ddd3a4..4078ac84a4 100644 --- a/libavcodec/omx.c +++ b/libavcodec/omx.c @@ -596,45 +596,45 @@ static av_cold int omx_component_init(AVCodecContext *avctx, const char *role) static av_cold void cleanup(OMXCodecContext *s) { - int i, executing; + int executing; /* If the mutexes/condition variables have not been properly initialized, * nothing has been initialized and locking the mutex might be unsafe. */ if (s->mutex_cond_inited_cnt == NB_MUTEX_CONDS) { - pthread_mutex_lock(&s->state_mutex); - executing = s->state == OMX_StateExecuting; - pthread_mutex_unlock(&s->state_mutex); + pthread_mutex_lock(&s->state_mutex); + executing = s->state == OMX_StateExecuting; + pthread_mutex_unlock(&s->state_mutex); - if (executing) { - OMX_SendCommand(s->handle, OMX_CommandStateSet, OMX_StateIdle, NULL); - wait_for_state(s, OMX_StateIdle); - OMX_SendCommand(s->handle, OMX_CommandStateSet, OMX_StateLoaded, NULL); - for (i = 0; i < s->num_in_buffers; i++) { - OMX_BUFFERHEADERTYPE *buffer = get_buffer(&s->input_mutex, &s->input_cond, - &s->num_free_in_buffers, s->free_in_buffers, 1); - if (s->input_zerocopy) - buffer->pBuffer = NULL; - OMX_FreeBuffer(s->handle, s->in_port, buffer); + if (executing) { + OMX_SendCommand(s->handle, OMX_CommandStateSet, OMX_StateIdle, NULL); + wait_for_state(s, OMX_StateIdle); + OMX_SendCommand(s->handle, OMX_CommandStateSet, OMX_StateLoaded, NULL); + for (int i = 0; i < s->num_in_buffers; i++) { + OMX_BUFFERHEADERTYPE *buffer = get_buffer(&s->input_mutex, &s->input_cond, + &s->num_free_in_buffers, s->free_in_buffers, 1); + if (s->input_zerocopy) + buffer->pBuffer = NULL; + OMX_FreeBuffer(s->handle, s->in_port, buffer); + } + for (int i = 0; i < s->num_out_buffers; i++) { + OMX_BUFFERHEADERTYPE *buffer = get_buffer(&s->output_mutex, &s->output_cond, + &s->num_done_out_buffers, s->done_out_buffers, 1); + OMX_FreeBuffer(s->handle, s->out_port, buffer); + } + wait_for_state(s, OMX_StateLoaded); } - for (i = 0; i < s->num_out_buffers; i++) { - OMX_BUFFERHEADERTYPE *buffer = get_buffer(&s->output_mutex, &s->output_cond, - &s->num_done_out_buffers, s->done_out_buffers, 1); - OMX_FreeBuffer(s->handle, s->out_port, buffer); + if (s->handle) { + s->omx_context->ptr_FreeHandle(s->handle); + s->handle = NULL; } - wait_for_state(s, OMX_StateLoaded); - } - if (s->handle) { - s->omx_context->ptr_FreeHandle(s->handle); - s->handle = NULL; - } - omx_deinit(s->omx_context); - s->omx_context = NULL; - av_freep(&s->in_buffer_headers); - av_freep(&s->out_buffer_headers); - av_freep(&s->free_in_buffers); - av_freep(&s->done_out_buffers); - av_freep(&s->output_buf); + omx_deinit(s->omx_context); + s->omx_context = NULL; + av_freep(&s->in_buffer_headers); + av_freep(&s->out_buffer_headers); + av_freep(&s->free_in_buffers); + av_freep(&s->done_out_buffers); + av_freep(&s->output_buf); } ff_pthread_free(s, omx_codec_context_offsets); }