From patchwork Mon Sep 5 21:16:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Fellechner X-Patchwork-Id: 37683 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp2868426pzh; Mon, 5 Sep 2022 14:17:36 -0700 (PDT) X-Google-Smtp-Source: AA6agR5UYvQVwK/ornW3YR1uhSeldubpWLUFxpSwvfri8eor0QQdadNmGo7c0g7aEhni6wMRo/+O X-Received: by 2002:a17:907:b15:b0:741:8ae4:f79d with SMTP id h21-20020a1709070b1500b007418ae4f79dmr26771851ejl.247.1662412656125; Mon, 05 Sep 2022 14:17:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662412656; cv=none; d=google.com; s=arc-20160816; b=DWQgRzy7Ddeks5QcuzjtMuPrV8SkGTHrky1YqdChMEA4xc4C7Wv6UO+/n/KOU33XwI Gb4WpG8CSs/9G+x6ntSPD5jBQ/mvUBD4JRslyB6QaLhr7PGJtoBaYDUlMnezuYdCQtwW GNmalVAxr/dXe0J1D9CaH/I8NSJzr1EGDqH03P7WG3VYgegeZTpxmJEVapYlG0FPhamD hBHE+MdfNxI2xhDnpHws8L5jvZ3epg24sDAJ30R6SZqmjfigaSixtoT3vlcgwXk9lZcj 8AZxgXYdFEcpJJdE2V+yaSrSYgrdHNEauh43OWC761Y5bGX5ocaHQOJNdC6BRZeSf3j7 9WQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=5VFF/rijoQm7dBFIig+IE5j0Ewb/Su4rlg2WMD2Io+o=; b=PjhkVL5nLIdblKVPibJn+fpw9o2qfF+gUZYrb4HH0NlbapxkSZ4M8mFZuQDkisbE1g G8fEupCStnW00k7uoUu5JtfUnO8HGZtG5DWOq0pRb496JHCCiWiVQygrHfCpP2YBoaEe hEOLV4bGQqUQwjK3mjZRem+03t/iAfdxNS2fxN5xsbO9w6sDHuffedM1tqDwjnO4fXyM hb0Ujz8b29S3dKQ+8MppTKny6pAIWsUuaEBYXVoHrpcnfUmsiDeaeX12WG9pTh5xIps2 zWkEJ9PCmoGZwfd8tNcsxz6Td8xJergQ/qVbAh2TB/WYsAtyWuWm3GGI5OEzIaRuWGuj Qbug== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmx.net header.s=badeba3b8450 header.b=LGacLBMM; 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=gmx.net Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id sh11-20020a1709076e8b00b00741827c6304si8318949ejc.772.2022.09.05.14.17.35; Mon, 05 Sep 2022 14:17:36 -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=@gmx.net header.s=badeba3b8450 header.b=LGacLBMM; 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=gmx.net Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8DB7A68B9E6; Tue, 6 Sep 2022 00:17:07 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DC3B468B972 for ; Tue, 6 Sep 2022 00:16:58 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1662412618; bh=tTuqp0nntrUH9IhvLKMEVTaZpPECrM9n0MVKx8jGNsg=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=LGacLBMM/COdI8FdDfm04h188n13QyRqw/17GaIgKzujo3tWVnfu7eCnmetOGc9dk I3jN4V72v0urh4f2pGtjqXXG0qkbJWA8pTXxvKhV48tPGH+MQFU9zq7ExJHLykTw00 1z8GWj8uXKhFufD0muA/pHPg64yzhjtX7Z6y4ZG4= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([94.134.107.163]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mlw3X-1pD8TS3UY7-00j1dS; Mon, 05 Sep 2022 23:16:57 +0200 From: Lukas Fellechner To: ffmpeg-devel@ffmpeg.org Date: Mon, 5 Sep 2022 23:16:31 +0200 Message-Id: <20220905211634.1460-2-lukas.fellechner@gmx.net> X-Mailer: git-send-email 2.31.1.windows.1 In-Reply-To: <20220905211634.1460-1-lukas.fellechner@gmx.net> References: <20220905211634.1460-1-lukas.fellechner@gmx.net> MIME-Version: 1.0 X-Provags-ID: V03:K1:kG5t7sRFtwSBv9gT6BHJABdnPbxdVl7PgnUWJM0AOcDUctFcqCI DiNqo1e4Ujy/6VKC6qo+QYSa+xhgYNb8x+52PUwkiEaNP1+BnUqQN1al9t6zc0J3aLFVDA4 VDJnt7yLAaTdS4rKg1rT+6eDRaOiAN6jhuHtQQXUmywJubwHKKby4ZM5frmXXD9BqpERz0E 2hL3ZrU82ikWxOk3gYEwQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:ylgZnTr6iOQ=:koOnVvS6mrKYw7QhS2WMUF xqNZbLpBntYT/b6IEmRsS84mOvDPXrSadE6//kyDkeJhJ6v5FTw+1vhQyEsTV4noH5gLpf3vy dfjlorI95Qsy8pXQb7tuMKFBQDjNEhzSVJxJlFxVyFYAzLhtNRi9hAlmwvHy0C9hrf+/oZMCg MrgvhMWWeCNcu3z9+aQLu74fISX6j0hiUQ7+EO2rHvEStcoLfYFAh9BUcsSexrII5BKqBS8kI DL/5roTLkpln9/jMRBUTK2LMGe+jscfD1XomeAnjiqPi37o5aQwfNLio+mLvZ7WpbMqYaNc6x 7sJ/5gJ6376/8kwJkaKiGjKl3IpOcidh5KN77MidDWhUTDgl607pHa6vkACvkK5yqE7WIIpsv zxLDGC+XY1v74fDmWMC/538lJoBBjq2tpGEdfMlU9U64qshiRikfYQbooo8fzuRJEnJzoi+JY ex2JKg3B81CjghQ6tuoi3awDLbjcpW4rEIrEO0U5RXFI9DFPolMAAzApLsgT0c8F5vQ7PMEzs bSSwTVJ1yryhNraEFxAo1u1CourJlJFkTH7b2AUt+A8r980bKZJ5lLBl+YYaY+2iScD0lEh62 whWCXSsLDsC+Mwr/UCbMdN4i72domtJEAm3duayG4M/Blr01GV0nvjKUx0yymxZxsCkGfAl7M BONqRfix+utX7KijxIWvcfFlOHymAZ5zXNwZ9OANUMI2qwhoqZrpbBxbKSC22jw0TZW7nZGcz Vun3w7jj4sdwX/rM6QzES9hgnFo/ZmaKd3IUVoNB39I5jeODHFQmQh2fFvT4nUMipFCPtllAA Ihq6PnSBvp4w8DTlXu1pUzM59KFRtIJb8Jk3Alnoc9D213SB3cCa3qludTTFDOdIaM+LPVTsm uAAE02biDiJlYZuvF5nHankCw+L/1g00F4P5LvRbquN3Nh3pRijACC5q1n6UchR6pMGE/4nI6 osh4Jv5//bpNPvdwrl4Qd6UYOz3mojkkJonHcMRZC9KVxeB1v83obmu48cVEGiq8KSTEjhYo5 oJHx4zMalUqdw7TrGJUu/HQDPVVtGsUHqF5ViCe1nUAjp95/vCziF5PlfMHJYHNT6uL08AFNF OszyGtHj+WUScsekGOp1YJCFhdF4w8Xe4UAVKl4+wUTZwYB7cl8kpyYr0Cwqz4duWuLTrlKNI MJgRDgyDFY4HaAK/8fPfMghSxz Subject: [FFmpeg-devel] [PATCH v4 1/4] lavf/dashdec: Prepare DASH decoder for multithreading 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: Lukas Fellechner Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: qyCxkjdc5DeI For adding multithreading to the DASH decoder initialization, the open_demux_for_component() method must be split up into two parts: begin_open_demux_for_component(): Opens the stream and does probing and format detection. This can be run in parallel. end_open_demux_for_component(): Creates the AVStreams and adds them to the common parent AVFormatContext. This method must always be run synchronously, after all threads are finished. --- libavformat/dashdec.c | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) -- 2.28.0.windows.1 diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 63bf7e96a5..e82da45e43 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -1918,10 +1918,9 @@ fail: return ret; } -static int open_demux_for_component(AVFormatContext *s, struct representation *pls) +static int begin_open_demux_for_component(AVFormatContext *s, struct representation *pls) { int ret = 0; - int i; pls->parent = s; pls->cur_seq_no = calc_cur_seg_no(s, pls); @@ -1931,9 +1930,15 @@ static int open_demux_for_component(AVFormatContext *s, struct representation *p } ret = reopen_demux_for_component(s, pls); - if (ret < 0) { - goto fail; - } + + return ret; +} + +static int end_open_demux_for_component(AVFormatContext *s, struct representation *pls) +{ + int ret = 0; + int i; + for (i = 0; i < pls->ctx->nb_streams; i++) { AVStream *st = avformat_new_stream(s, NULL); AVStream *ist = pls->ctx->streams[i]; @@ -1965,6 +1970,19 @@ fail: return ret; } +static int open_demux_for_component(AVFormatContext* s, struct representation* pls) +{ + int ret = 0; + + ret = begin_open_demux_for_component(s, pls); + if (ret < 0) + return ret; + + ret = end_open_demux_for_component(s, pls); + + return ret; +} + static int is_common_init_section_exist(struct representation **pls, int n_pls) { struct fragment *first_init_section = pls[0]->init_section; @@ -2040,9 +2058,15 @@ static int dash_read_header(AVFormatContext *s) av_dict_set(&c->avio_opts, "seekable", "0", 0); } - if(c->n_videos) + if (c->n_videos) c->is_init_section_common_video = is_common_init_section_exist(c->videos, c->n_videos); + if (c->n_audios) + c->is_init_section_common_audio = is_common_init_section_exist(c->audios, c->n_audios); + + if (c->n_subtitles) + c->is_init_section_common_subtitle = is_common_init_section_exist(c->subtitles, c->n_subtitles); + /* Open the demuxer for video and audio components if available */ for (i = 0; i < c->n_videos; i++) { rep = c->videos[i]; @@ -2059,9 +2083,6 @@ static int dash_read_header(AVFormatContext *s) ++stream_index; } - if(c->n_audios) - c->is_init_section_common_audio = is_common_init_section_exist(c->audios, c->n_audios); - for (i = 0; i < c->n_audios; i++) { rep = c->audios[i]; if (i > 0 && c->is_init_section_common_audio) { @@ -2077,9 +2098,6 @@ static int dash_read_header(AVFormatContext *s) ++stream_index; } - if (c->n_subtitles) - c->is_init_section_common_subtitle = is_common_init_section_exist(c->subtitles, c->n_subtitles); - for (i = 0; i < c->n_subtitles; i++) { rep = c->subtitles[i]; if (i > 0 && c->is_init_section_common_subtitle) { From patchwork Mon Sep 5 21:16:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Fellechner X-Patchwork-Id: 37682 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp2868371pzh; Mon, 5 Sep 2022 14:17:27 -0700 (PDT) X-Google-Smtp-Source: AA6agR7ktGOYpMzNJMpWTLTcIWATVyXI3LPpZRuHBK9DrsOFizgdK3CLjqN9ojASu/poP5XGiVBT X-Received: by 2002:a17:907:60d6:b0:741:422e:d51e with SMTP id hv22-20020a17090760d600b00741422ed51emr30008968ejc.579.1662412647615; Mon, 05 Sep 2022 14:17:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662412647; cv=none; d=google.com; s=arc-20160816; b=d939ICR9xOy6fXV9Se4OVydGSn8CZ76sJoZz+eIg/g0HucrT3PAxycLPVb0RSlNQa2 nUyHTyYdqabzSgdp+IQjfnF+lM4uSXnylyk2cvfZ2BxIyrFK+AyEjEMWnBr2q4b0DYZE 1zk1OJA1ubwPYBoYhwv2bGjV+02RsbLpraUh28bTlsb8BnRj8+MNvAv6zqeRZ3/ZHS9y NLSSVCoG2OtUHYJye/k/cRHKvLKiRRTt1us0qtp6LrNPRAkD4KIxT2x75pQX9jK4aglY HmzaUJKCjJvdlgKmTsr39eg69uT9GqezEPKLA07xEkGU6h3OGkWQsKqTjIrXEe/Pr+8p EK4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=J1xNfdcZn6tVQBSeuwxd+6CggXUC6RP7jehTqnGitGI=; b=Y25dVw7HJoQhUn/EvOwnWoWlpQVJ1Mx2+bDF4rntPswrA6fFA7rE8P3O46qzhBLZJ0 xglFiD6kSVyIwU2dQ0PbjnWZpR+sy3gCaxlLjVRM4HGZL5Yrg9fzUErVVzG1PMsB/RRA PU/2uRKiAmJptk1kUTjE1o8pfW4PkhiHAsbm4Ro7g/OmYARrLWiyR+2hUWf2HYhYrZBk 3lPtg3rIMb63zsqVrB1u2Z3luvKJY+3EkZS68Vr8Q1fVkjFmOVHGw4+irD3wKObH5uuY u6SOdbvnmj9VfFhgDIqf9UDBqpjK/nQesA94BqXZe21gy89dwpezwAhjyKbVW8l5rEQ5 GJrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmx.net header.s=badeba3b8450 header.b="V/mfa+vZ"; 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=gmx.net Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id dm21-20020a170907949500b0073da13bf4c3si9172021ejc.726.2022.09.05.14.17.26; Mon, 05 Sep 2022 14:17:27 -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=@gmx.net header.s=badeba3b8450 header.b="V/mfa+vZ"; 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=gmx.net Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8D5E068B9D9; Tue, 6 Sep 2022 00:17:06 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CA33468B800 for ; Tue, 6 Sep 2022 00:16:58 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1662412618; bh=21rWWfcHsQa+8QrNdx1n0Pf7In6mstWmZS0691x0o0g=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=V/mfa+vZLf+95pQ/BE6qrlFPA/UJliURKRFetD5+IoRgGywNXyHo16HBGyp61OXPN c/fMoIWqGRgvm7aigqfYR/9/cEHmJtnLMMiJWv0h7IHLxvXoS20dIWWRqgl2CYiDpu HcGTz8LsXysJ0QxvGPdNuL8Yeej/pvRwv9izEk9I= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([94.134.107.163]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MplXp-1pAPS845iX-00q8ua; Mon, 05 Sep 2022 23:16:58 +0200 From: Lukas Fellechner To: ffmpeg-devel@ffmpeg.org Date: Mon, 5 Sep 2022 23:16:32 +0200 Message-Id: <20220905211634.1460-3-lukas.fellechner@gmx.net> X-Mailer: git-send-email 2.31.1.windows.1 In-Reply-To: <20220905211634.1460-1-lukas.fellechner@gmx.net> References: <20220905211634.1460-1-lukas.fellechner@gmx.net> MIME-Version: 1.0 X-Provags-ID: V03:K1:3l55Or0MUsmUe1HAjtlDxMZJWK25NaSHlQuZIY/qHOkRk8WE/Mc 6d3pIc4B32aRGzKgqcllqD/mGW1qcQ2f5vglj0NxTgVdFIx05d+ZF6OiVjPUv67y82hfdl8 vL9HUaxsUwIt50mAkqnvkYlNMhh4wpHvGpYtq1yx759/thQPzdElGjSyVBzz9EOfYicYvrx UbGL/ETds/q2GOCHCdhBw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:w6WmU/gesC8=:BJ1p8dSqRZ2CLkcvjE/m2K h4+CE2OaS/y7VmtlyU4EGwSCLYqBE2saMuGVY6H2bKgx1j+QWN4vsUb6M84FNv941goe2pbFa 92L4JEbNU5acFg4Bp57hmtY+JaUdI6X7xo39H03qsSYPD2blX/Pw+a86Mg13py3+krkzRMLaY 54SRVTfxbTFZOUDt4PH2/d9dDW7SHPBKLu7YxHHi61UbT+apAtx/9y/2WjrP+jArg9zrhLTb1 sUARbn2sHkDDnEjtwznX3CMZpjKVqQOI51RRlmqt1NtRcCfCsyBPhCL0xfkenJsjqVWmkggp5 AKxBvLmcPQdjNztlwjoI3bg2MXQ6XPF4cqxOXXSQTMjK8dR3ilQ/vV7QZwccqs97FdCl5pWhs 4EdYh4priFxaetlrOI+9G3XzV0cup3yzxxFx+g+0DoY4shw2LHzPxTHRWhcxP8+oK0WnDAXUu WWbwEUb6BdbaeM8d3S7ZRhZl+bomrwb/eGs/1ZBz3G65bP+z60rZi8ngmLAQZRplrN/5/xzqI 1oPy9snowyUk/vmBqLRt/6669OIybktXXhxdObkdjNUgZdeKJS8ES6xfyu6sa7l0PoDoiRpqK VmICwKs13Zs5HtUc+LRRVoorXwBLIolL8+YYWMB/TT44YuenuMybrJUPjcEWAjUvvMfPmjnaZ Dc1bRtEvtlD3LJoCaR+5nGGlPwqg9/wgK64R2tS2/T8yjPrIpigxty31r39CKu2mjLEinH7IQ 5PKyCIoqWgyX/+BwHbnrQ5oGn23ppjdVZ4xJsDr571L9hEUSfAqvTmWYqNRM8q4ogUoVneqvY u8MSvo6sn/oZ6H4TNaINNlGcF8XoX1dvApwRXFR0l9+uncp1A/lSnA+JOwpGMIArmNF5zsM7N 0XNjrhr6uHS2S6If666Pyd3MMN5k3O+8SMXyA6EyrHKAXKzZbjcLAqDs3THq2qj2NH1g6qFqE csfP19NH44B+usckOUTPoAtLuw7KHoynQCFDhDWoR04fP8vTw+t9UYNgge0NPKGec4UMFObOD Z4Gn7YVp5PDKMspQ9NfzgyWmNCXBw61PebdAunYxFnxjarpChX/gZ3iBGTCb9MhCb3eWO6OFy w7TKo2hWsb++aOJBPNCvtlho7uu+navfVJcgIQ+zSGUMQFp5LtTc5AzOweAVMG0L02FxwRMET RxRury5CXaCeINgv4wsY9NWnPM Subject: [FFmpeg-devel] [PATCH v4 2/4] lavf/dashdec: Multithreaded DASH initialization 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: Lukas Fellechner Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: POSmfejgy7/Y This patch adds an "init_threads" option, specifying the max number of threads to use. Multiple worker threads are spun up to massively bring down init times. --- libavformat/dashdec.c | 286 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 285 insertions(+), 1 deletion(-) -- 2.28.0.windows.1 diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index e82da45e43..0532e2c918 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -24,6 +24,8 @@ #include "libavutil/opt.h" #include "libavutil/time.h" #include "libavutil/parseutils.h" +#include "libavutil/thread.h" +#include "libavutil/slicethread.h" #include "internal.h" #include "avio_internal.h" #include "dash.h" @@ -152,6 +154,8 @@ typedef struct DASHContext { int max_url_size; char *cenc_decryption_key; + int init_threads; + /* Flags for init section*/ int is_init_section_common_video; int is_init_section_common_audio; @@ -2033,6 +2037,265 @@ static void move_metadata(AVStream *st, const char *key, char **value) } } +#if HAVE_THREADS + +typedef struct WorkPoolData +{ + AVFormatContext *ctx; + struct representation *pls; + struct representation *common_pls; + pthread_mutex_t *common_mutex; + pthread_cond_t *common_condition; + int is_common; + int is_started; + int result; +} WorkPoolData; + +static void thread_worker(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads) +{ + WorkPoolData *work_pool = (WorkPoolData*)priv; + WorkPoolData *data = work_pool + jobnr; + int ret; + + // if we are common section provider, init and signal + if (data->is_common) { + data->pls->parent = data->ctx; + ret = update_init_section(data->pls); + if (ret < 0) { + pthread_cond_signal(data->common_condition); + goto end; + } + else + ret = AVERROR(pthread_cond_signal(data->common_condition)); + } + + // if we depend on common section provider, wait for signal and copy + if (data->common_pls) { + ret = AVERROR(pthread_cond_wait(data->common_condition, data->common_mutex)); + if (ret < 0) + goto end; + + if (!data->common_pls->init_sec_buf) { + goto end; + ret = AVERROR(EFAULT); + } + + ret = copy_init_section(data->pls, data->common_pls); + if (ret < 0) + goto end; + } + + ret = begin_open_demux_for_component(data->ctx, data->pls); + if (ret < 0) + goto end; + +end: + data->result = ret; +} + +static void create_work_pool_data(AVFormatContext *ctx, int *stream_index, + struct representation **streams, int num_streams, int is_init_section_common, + WorkPoolData *work_pool, pthread_mutex_t* common_mutex, + pthread_cond_t* common_condition) +{ + work_pool += *stream_index; + + for (int i = 0; i < num_streams; i++) { + work_pool->ctx = ctx; + work_pool->pls = streams[i]; + work_pool->pls->stream_index = *stream_index; + work_pool->common_condition = common_condition; + work_pool->common_mutex = common_mutex; + work_pool->result = -1; + + if (is_init_section_common) { + if (i == 0) + work_pool->is_common = 1; + else + work_pool->common_pls = streams[0]; + } + + work_pool++; + *stream_index = *stream_index + 1; + } +} + +static pthread_mutex_t* create_mutex() +{ + pthread_mutex_t* mutex = (pthread_mutex_t*)av_malloc(sizeof(pthread_mutex_t)); + if (!mutex) + return NULL; + + if (pthread_mutex_init(mutex, NULL)) { + av_free(mutex); + return NULL; + } + + return mutex; +} + +static int free_mutex(pthread_mutex_t **mutex) +{ + int ret = 0; + if (*mutex) { + ret = pthread_mutex_destroy(*mutex); + av_free(*mutex); + *mutex = NULL; + } + return ret; +} + +static pthread_cond_t* create_cond() +{ + pthread_cond_t* cond = (pthread_cond_t*)av_malloc(sizeof(pthread_cond_t)); + if (!cond) + return NULL; + + if (pthread_cond_init(cond, NULL)) { + av_free(cond); + return NULL; + } + + return cond; +} + +static int free_cond(pthread_cond_t **cond) +{ + int ret = 0; + if (*cond) { + ret = pthread_cond_destroy(*cond); + av_free(*cond); + *cond = NULL; + } + return ret; +} + +static int init_streams_multithreaded(AVFormatContext *s, int nstreams, int threads) +{ + DASHContext *c = s->priv_data; + int ret = 0; + int stream_index = 0; + AVSliceThread *slice_thread; + + // we need to cleanup even in case of errors, + // so we need to store results of run and cleanup phase + int initResult = 0; + int runResult = 0; + int cleanupResult = 0; + + // alloc data + WorkPoolData *work_pool = (WorkPoolData*)av_mallocz( + sizeof(WorkPoolData) * nstreams); + if (!work_pool) + return AVERROR(ENOMEM); + + if (!avpriv_slicethread_create(&slice_thread, (void*)work_pool, &thread_worker, NULL, threads)) { + av_free(work_pool); + return AVERROR(ENOMEM); +} + + // alloc mutex and conditions + c->init_mutex = create_mutex(); + + pthread_mutex_t *common_video_mutex = create_mutex(); + pthread_cond_t *common_video_cond = create_cond(); + + pthread_mutex_t *common_audio_mutex = create_mutex(); + pthread_cond_t *common_audio_cond = create_cond(); + + pthread_mutex_t *common_subtitle_mutex = create_mutex(); + pthread_cond_t *common_subtitle_cond = create_cond(); + + if (!(c->init_mutex && common_video_mutex && common_video_cond && common_audio_mutex && + common_audio_cond && common_subtitle_mutex && common_subtitle_cond)) { + initResult = AVERROR(ENOMEM); + goto cleanup; + } + + // set work pool data + create_work_pool_data(s, &stream_index, c->videos, c->n_videos, + c->is_init_section_common_video, work_pool, + common_video_mutex, common_video_cond); + + create_work_pool_data(s, &stream_index, c->audios, c->n_audios, + c->is_init_section_common_audio, work_pool, + common_audio_mutex, common_audio_cond); + + create_work_pool_data(s, &stream_index, c->subtitles, c->n_subtitles, + c->is_init_section_common_subtitle, work_pool, + common_subtitle_mutex, common_subtitle_cond); + + // run threads + avpriv_slicethread_execute(slice_thread, nstreams, 0); + + // finalize streams and collect results + WorkPoolData* current_data = work_pool; + for (int i = 0; i < nstreams; i++) { + if (current_data->result < 0) { + // thread ran into error: collect result and break + runResult = current_data->result; + break; + } + else { + // thread success: create streams on AVFormatContext + ret = end_open_demux_for_component(s, current_data->pls); + if (ret < 0) { + runResult = ret; + break; + } + } + current_data++; + } + +cleanup: + // cleanup mutex and conditions + ret = free_mutex(&c->init_mutex); + if (ret < 0) + cleanupResult = ret; + + ret = free_mutex(&common_video_mutex); + if (ret < 0) + cleanupResult = ret; + + ret = free_cond(&common_video_cond); + if (ret < 0) + cleanupResult = ret; + + ret = free_mutex(&common_audio_mutex); + if (ret < 0) + cleanupResult = ret; + + ret = free_cond(&common_audio_cond); + if (ret < 0) + cleanupResult = ret; + + ret = free_mutex(&common_subtitle_mutex); + if (ret < 0) + cleanupResult = ret; + + ret = free_cond(&common_subtitle_cond); + if (ret < 0) + cleanupResult = ret; + + // cleanup threads and workpool + av_free(work_pool); + avpriv_slicethread_free(&slice_thread); + + // return results if errors have occured in one of the phases + if (initResult < 0) + return initResult; + + if (runResult < 0) + return runResult; + + if (cleanupResult < 0) + return cleanupResult; + + return 0; +} + +#endif + static int dash_read_header(AVFormatContext *s) { DASHContext *c = s->priv_data; @@ -2067,6 +2330,23 @@ static int dash_read_header(AVFormatContext *s) if (c->n_subtitles) c->is_init_section_common_subtitle = is_common_init_section_exist(c->subtitles, c->n_subtitles); + int threads = 1; + int nstreams = c->n_videos + c->n_audios + c->n_subtitles; + +#if HAVE_THREADS + threads = FFMIN(nstreams, c->init_threads); +#endif + + if (threads > 1) + { +#if HAVE_THREADS + ret = init_streams_multithreaded(s, nstreams, threads); + if (ret < 0) + return ret; +#endif + } + else + { /* Open the demuxer for video and audio components if available */ for (i = 0; i < c->n_videos; i++) { rep = c->videos[i]; @@ -2115,6 +2395,7 @@ static int dash_read_header(AVFormatContext *s) if (!stream_index) return AVERROR_INVALIDDATA; + } /* Create a program */ program = av_new_program(s, 0); @@ -2366,7 +2647,10 @@ static const AVOption dash_options[] = { OFFSET(allowed_extensions), AV_OPT_TYPE_STRING, {.str = "aac,m4a,m4s,m4v,mov,mp4,webm,ts"}, INT_MIN, INT_MAX, FLAGS}, - { "cenc_decryption_key", "Media decryption key (hex)", OFFSET(cenc_decryption_key), AV_OPT_TYPE_STRING, {.str = NULL}, INT_MIN, INT_MAX, .flags = FLAGS }, + { "cenc_decryption_key", "Media decryption key (hex)", OFFSET(cenc_decryption_key), + AV_OPT_TYPE_STRING, {.str = NULL}, INT_MIN, INT_MAX, .flags = FLAGS }, + { "init_threads", "Number of threads to use for initializing the DASH stream", + OFFSET(init_threads), AV_OPT_TYPE_INT, {.i64 = 1}, 1, INT_MAX, FLAGS }, {NULL} }; From patchwork Mon Sep 5 21:16:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Fellechner X-Patchwork-Id: 37681 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp2868293pzh; Mon, 5 Sep 2022 14:17:19 -0700 (PDT) X-Google-Smtp-Source: AA6agR4FDwS4WYodatSJheDgwukn66zamt870MANuUQJjnewh7X8k5JhxL7klKMNmjkMnHJtFgZ5 X-Received: by 2002:a17:907:7d9e:b0:76f:612:3e01 with SMTP id oz30-20020a1709077d9e00b0076f06123e01mr414538ejc.167.1662412639365; Mon, 05 Sep 2022 14:17:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662412639; cv=none; d=google.com; s=arc-20160816; b=I4eNHgGsERMWvOXElef6h2rSaD3hWJCsgUF3Vnm7LecpIReziPZEGhScRtuPkCO6AE zPPVj+9BJsVyQHrUcCEis1ipkbaiCiYp/BldhdD+WZ3oPYLl0+fNtrtB61g2aFm4atlv f01yNEiNqK1aqvfoiO71Yrsk1UH5ECTygmIFCI+l2C9fICQZjcMcdtXXHJDSwI8sPt8b LSxBH0jvV1SnY3ogzgAWqkSuuy+tEiyL+SqWiGClOiZSL8GUiAAnRNjUGeVuutI3H0l3 X0Xgu/qPXTITHhMprJ6RX1sFaKV0O8gT+RU86l6gIcbWKW8KH8e5GJPytIICejioANAO nVMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=zy+px43YoW5RcM8BILkNn9N3fS9j7rPoK1gSFDP49cY=; b=DB3vNzu3RcGq0tKnGRrpO9I8FYvmni8YaSP8zBpVr8CL+jGoeIaSVX3w4UK5Qj8CAC YCP+cVCcvf0ln0qzR1+wb9PtUXa8HVtSISctGypqN86n42EmVAG0EYJJwZo/f3zfkvwd zMWiCujge3Xd6a43BHIT4DF6nvalKUn06TomqN2JesVcM8hftSMH8ljVkr8maipT2RiS KB9b+0PRX+7RtDBLVD8/JPGo8sVXIqIVFpy+r70f3X2d8fOgIjAHG6rGQdRiot7P3HZU C0ySemBqPiVaLkgdJb1JdCIDJ1JSqxC/gjMCwymYxUAgh0xIkgCLUBR7kvF1vKW0uAKr VGrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmx.net header.s=badeba3b8450 header.b=EXdYuiyv; 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=gmx.net Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id b10-20020a056402084a00b00447b2f52d55si9066591edz.627.2022.09.05.14.17.19; Mon, 05 Sep 2022 14:17:19 -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=@gmx.net header.s=badeba3b8450 header.b=EXdYuiyv; 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=gmx.net Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8F16768B9B2; Tue, 6 Sep 2022 00:17:05 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C763368B6D3 for ; Tue, 6 Sep 2022 00:16:58 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1662412618; bh=B2c36yrJlkmngHZKn8wTcAbKfriFuaj1RVY8Wg8kdKk=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=EXdYuiyvXXpoRS8wTi7jjhzb6kVDK4ydv2Mc1kyhkuLcNyntFIYIYVcdj/FSdJNsU 5jUIe0LDcTNOyfRIYC0iZmEtYE1uq6MPmm599e+G30W8UgR9pkX9IAiErof9nPk+8u 2RHbWC40rwkpLr0C4O230jVjZYTTDIbOJauwvZI8= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([94.134.107.163]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MNt0C-1okfWU0VBo-00OGx7; Mon, 05 Sep 2022 23:16:58 +0200 From: Lukas Fellechner To: ffmpeg-devel@ffmpeg.org Date: Mon, 5 Sep 2022 23:16:33 +0200 Message-Id: <20220905211634.1460-4-lukas.fellechner@gmx.net> X-Mailer: git-send-email 2.31.1.windows.1 In-Reply-To: <20220905211634.1460-1-lukas.fellechner@gmx.net> References: <20220905211634.1460-1-lukas.fellechner@gmx.net> MIME-Version: 1.0 X-Provags-ID: V03:K1:gzju6hxiRbuzpvn/xX4PQP2gPrcDW71zgUv5qVvgQtmjW7FvlXs Rzj6C0OmmKT6NIoofTBD4N+VxU+Z88cC7shRG7KPQN7TTvZHJ+/qUIKqeRCY2EzMt3yeETB h/X35Hpbg96kheu9LHFPvpPvLrBkp+vGN1sOGL1K31cza2fptfT5cstbQ6+yY6g4pZqSxJI RhxZX2Kk9PNQ2c/a2Wr9w== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:tky1qzbifCo=:J74Qnwv8aS6zaARYU+xbFs coeIbuVeVe7GSc/VHwxI88EpTzyfHmlxCeJyJHymtwMciisfniOP3sH8kwoiyRn2qPkxyfdd9 p/O4JWPSRLMBjk7GzCn/pLSCgw1iwMpy6IfDGEnFRXDdoAXKG3aujCp+VbxFFMy7M2miCTEKI bVeS5FlYNsbIRkt09TAEiF5ccUWP2rrKB6WhpQxYCMSdVX663d+fiHIZWe+cU4po7wgHDi6Ti Tn/KTAmfFjxfcNVLO0+rdPESNqsttxORqqjs8w4OCzGHXwRm7DLmmVJWzY5mc/kRcPLecFt9v 1CsK8WywrKK9TkihlyrBYcRdu3FwzyRL+ocGYRKz1CimXjxjIdQ3Q3gdw/ICqU3XWLXUio73N gnQCT0VPANn5DQIXPV4KIa+boVHeCwxmNVGsFE5ZXpLee5AaOOvMQ8sESF0ysJ2VWNt7V+DVV /lJ3TCgBydCxUJE0+zbNjgnABXnrcVsSK4w6WkcfcpSSw+BCnq/UG2MKvGD7NTkK4UKXRJzlb gilsTVsAmAaLQWiW8f36gukTzOwXacMpyVvcMQqqRf+i1m2G2VVqU6Eh5XpkVpIJ0iXEXSvqz ZXhlWzEan7KcEt2xNSqPN+mSYFCDzFpP0FX9fjQaDBG0mlmMTnbBHo4aCxJdknrAEnocjn3Bq 8sQEcJyfWk6HkBv4S5s+WBv1qgUQB+R6qADO+o3CUY0Hf/6ozVNDBZ9aO5tII+RdeQXJVwX+r YlC+0b/6RsQ+FIEbMiX4D+YUqKWC9g3xqKdzAJBNKgOEv69t9nefLfCIdq2VvF15DSYkDGzxr gV1VA+33sfJjbapwcFM3ZD+aUD5uigYAUJEwXgCpq5Y7xzgSjaLZqVC+ee9aS0SeBdiZs7VNG EJPuVwww3Rmw417S2wMPXgKF1QFG8TRhlQ2f9mX//LM9vAiYzTrmzgQPBIIHUWWCRkbxuqGev 8ZtgeXDNQw6U/aIxgZwT3rCkljYlVZa39xgQNM0akocO1kqwWycyKOFMVYsTKUAc7Powb21p+ hDo32n+SYzY/IAHe2OzSCgiAx/bEV2f5TulrNY4inVc9KES8vt/6A/gwbBHcPAG7b1Rk6ppH3 +2cAqoAntjm+y/Z7h2J1bFpdpuPvf2aeqBEpYYhN/5n96AMuDrW67VrGPPaJZLlNnaZ+oNa2H iB4e5ryc8dCTP7iqK7NaChxRb/ Subject: [FFmpeg-devel] [PATCH v4 3/4] lavf/dashdec: Prevent cross-thread avio_opts modification 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: Lukas Fellechner Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: sRNrntRkIIPh open_url modifies the shared avio_opts dict (update cookies). This can cause problems during multithreaded initialization. To prevent this, I take a copy of avio_opts, use that in open_url, and copy the updated dict back afterwards. --- libavformat/dashdec.c | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) -- 2.28.0.windows.1 diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 0532e2c918..19e657d836 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -156,6 +156,11 @@ typedef struct DASHContext { int init_threads; +#if HAVE_THREADS + /* Set during parallel initialization, to allow locking of avio_opts */ + pthread_mutex_t *init_mutex; +#endif + /* Flags for init section*/ int is_init_section_common_video; int is_init_section_common_audio; @@ -1699,7 +1704,32 @@ static int open_input(DASHContext *c, struct representation *pls, struct fragmen ff_make_absolute_url(url, c->max_url_size, c->base_url, seg->url); av_log(pls->parent, AV_LOG_VERBOSE, "DASH request for url '%s', offset %"PRId64"\n", url, seg->url_offset); - ret = open_url(pls->parent, &pls->input, url, &c->avio_opts, opts, NULL); + + AVDictionary *avio_opts = c->avio_opts; + +#if HAVE_THREADS + // If we are doing parallel initialization, take a snapshot of the avio_opts, + // and copy the modified dictionary ("cookies" updated) back, after the url is opened. + if (c->init_mutex) { + pthread_mutex_lock(c->init_mutex); + avio_opts = NULL; + ret = av_dict_copy(&avio_opts, c->avio_opts, 0); + pthread_mutex_unlock(c->init_mutex); + if (ret < 0) + goto cleanup; + } +#endif + + ret = open_url(pls->parent, &pls->input, url, &avio_opts, opts, NULL); + +#if HAVE_THREADS + if (c->init_mutex) { + pthread_mutex_lock(c->init_mutex); + av_dict_free(&c->avio_opts); + c->avio_opts = avio_opts; + pthread_mutex_unlock(c->init_mutex); + } +#endif cleanup: av_free(url); @@ -2192,7 +2222,7 @@ static int init_streams_multithreaded(AVFormatContext *s, int nstreams, int thre if (!avpriv_slicethread_create(&slice_thread, (void*)work_pool, &thread_worker, NULL, threads)) { av_free(work_pool); return AVERROR(ENOMEM); -} + } // alloc mutex and conditions c->init_mutex = create_mutex(); From patchwork Mon Sep 5 21:16:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Fellechner X-Patchwork-Id: 37684 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp2868474pzh; Mon, 5 Sep 2022 14:17:44 -0700 (PDT) X-Google-Smtp-Source: AA6agR5e6ccpNXBER4B34PKUix/9FQ5PUvKv9EAvbda3rTkUoi87DgyibyvJnFdhtkyDMsRiL4pK X-Received: by 2002:aa7:ce85:0:b0:44e:7f2f:134f with SMTP id y5-20020aa7ce85000000b0044e7f2f134fmr6165674edv.361.1662412664620; Mon, 05 Sep 2022 14:17:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662412664; cv=none; d=google.com; s=arc-20160816; b=UZkKp0IQ4Ti8rrFiwSHBwVU8HOMtXomv1DbB7DjQlL9IdL7OyBa0RV79Bvw9eptyin LDSKJ4QxOsbx2QKrtjsjI/5gvcx2G5v9UAsfF4BpFmHt3gJUnWnj3IR2mfqMcnJQ6/Qf TXYhp5vT27Wory6hrHA8yTPV6r7ZnK44UQNhto9paHV1V1Y0u4yJIIMZjBvhLrXzarvL WOOH3R/PXYvUW/wMMnU/3hTOHWGEp9zjCsw/M4slr01WhvtRZfMwdznk+Sh+JP8s9dck CT0m59v2GOL7zh5UsUXajh0dg/f5zzsD7QdaHImO2S3iOwd6AruONZxXAwSoQD6O2m+i YEAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=/voW2/z5qULLToFFVLFxgQVsAHphhPzu6V1rjjsY+mc=; b=yQGfWtdfifLTAHbmAUS3CsJdC6ZDFGrCdCWAhpZPwVVpjW6qvkMzEB9iZwSgVX69G+ PWHBy6P82ZI5+cUbOSQzynN4Wr3WvpUNU5eJPtWlKJ6WubEGywTRB9+Yup6FgHcD5xun kj/4H1BBXbRm4sVtb0gfqcUcD1R1rv7y6TNuMWVYOQl5vcP8pt9ADhhlbYHpe9tfCMRR GEmUhuTxR1ZtpPEyybs14oBnOiX4JeTI3lkMQPcFfWLsblHb5IVRDI00/9HSN+OuX9+Y IXdRQSabKnIRaBz0iY246465vtodRqWVUU1RA00sbk+mjJmcYGN8VtQ0f1eLWBxz5ocT ydbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmx.net header.s=badeba3b8450 header.b=fhtdquZ4; 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=gmx.net Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id k19-20020aa7d2d3000000b0044eb919cd29si1008678edr.161.2022.09.05.14.17.44; Mon, 05 Sep 2022 14:17:44 -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=@gmx.net header.s=badeba3b8450 header.b=fhtdquZ4; 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=gmx.net Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7FEEC68B9F1; Tue, 6 Sep 2022 00:17:08 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E453968B9B2 for ; Tue, 6 Sep 2022 00:16:58 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1662412618; bh=fvoOCewD9H2/nxNiZABzh6oBx5vEiBBHEGyezikooUs=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=fhtdquZ4AXK2/hPWOA22fnOuFmyu7rfpwosg0iX0kDkCOL6AMTReKYbYVmIzUtiw7 5zFQqxxfNelss8thWcjL2N+PvXcwoovSRR+Vtg9P7EsdIa9YIZlA8/10SAd2xhIov2 tSmzO2edt2g4vOr3yCqfWOlisttLrbNVgxmf9XH4= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([94.134.107.163]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N8ofO-1pOuAW16KE-015tiJ; Mon, 05 Sep 2022 23:16:58 +0200 From: Lukas Fellechner To: ffmpeg-devel@ffmpeg.org Date: Mon, 5 Sep 2022 23:16:34 +0200 Message-Id: <20220905211634.1460-5-lukas.fellechner@gmx.net> X-Mailer: git-send-email 2.31.1.windows.1 In-Reply-To: <20220905211634.1460-1-lukas.fellechner@gmx.net> References: <20220905211634.1460-1-lukas.fellechner@gmx.net> MIME-Version: 1.0 X-Provags-ID: V03:K1:8IKXfyYc4nXNRHSbbMpG2IftE2R6L5YfoBrLOUEH0wik5BH6XVW 42G5UHHkrDwNTQY3bMo0Zr5XVq88D3adjNUmc2fQ2XoSKgmn3EVNrmhanRYqZ/NlclW4B0q BAZifnRBfgRPcTpYFOsBVNFeIYCoFRSdsyLtyIIxhsoyI+iQE4sS0Q05Z6/mGljLpA38XpB JhuFGqa8Y5ug/RMWFeviQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:CkjHl/g75XM=:UI9HLCY9JOPZ9JEtLbEVdU zRjrWyXvrT6AMM212XepGhX0aaDK9OMhDyLgxP7q4t0nCJTePCpa81a5iFUmP9GKM1SxgsfCT jumbqN6geQxjAd87ILctLp6wHc6+JzRF+7k0+Ll3aNqT5hSyjez9xYifd2FrDVi5JpMU0Vem2 o3se9IXjfzmph7nrT3tpFUxOOxDYswYcAAlpKeNKfL1i4nIFRMI1SBtKY+g0aje8d8jQmRr7g yazPHhSSTGc8+OTEx46iOOD9XnJWkkq0vwTpWvWZeLRcXiK+059jsGgvCZllw5BwvY+pEA/e2 /z4vnN5IdbDnNE2i1DAuVhlEGnYXHNokEJ41mKIdemJPNmyNICUxdFJx6wxDO98dyA7499bmJ /bgGIO253JBpp6Mahz3UxEILjSvsylpldzcCIbbILW7eQ9IUfksA/3RsftEupdrciSVeJaZdI Q0RxTKoIBez9WIyGNg5C6hWsORYBjukbvS9f6mKE1dzGJQvN9nYiPtuYXxflqpDZQzHDgxNIj fKIrqNcY+4rDbr7fANjvIOm+jkWch0bmT9hQK/O6lpiyOaWQM+EBdSDABhYsJc5vuXX8Dg13+ c2uNLXBqrIXdBkAJctjXDw/eDB+QWWdaVLrlv2na6rvk+dR3x6NQEKwkrAIo+6Ua50ug1kckb +AYTCYAReKvjJnxXx7YMTNE8IGmhty9+ppZ0BD1UX0A88Ov3cqpsQR65FAvsq9rEqMm3D+mvi fzv2iyMOnZHBxRHdKpq8fpV75CGbMO/gy2fwszN/CZeCAi+De+I05L1IeXQWPp+OGFlgYqaWF QANo3zQWz30WO0bXTJ7hJCwwMFKISAG8LWviuLhBav0Su3K8/o0Z/QgCXhhr2iOb+6+U71NWN rTSYqWc4cfXZ1AEBDf+C6M1H0mEeUEd2CuQSl5l3AxOg76St5ZexXRbvJEN1LzvyrsQ3qcxiX PaEqpmkYPcwzM9FR5waAOy2bgVlsnB8dJAIZjbsmneM1po9Qn+nhzINAfoh+Eh+cFTfd+OLh1 0Pkid2iSSnC1QRaw1jWW8KFzlnhhRZzgnsiGdUhtS4zODt6OsC29CBGbpynZUyVzkvB4fIp8g yhcF1rbs1KpVpULjAgxLQSgAutt7HGe8WpZ1EDiZofH+dgNQPRrYSqvaheZD5IruK/L0bR9c9 DvmplJZz1jBcuWdCTQKH6zCux9 Subject: [FFmpeg-devel] [PATCH v4 4/4] lavf/dashdec: Fix indentation after adding multithreading 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: Lukas Fellechner Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: YyvVvQxmA552 Whitespace change only. No functional changes. --- libavformat/dashdec.c | 74 +++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 37 deletions(-) -- 2.28.0.windows.1 diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 19e657d836..22f727da3b 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -2377,54 +2377,54 @@ static int dash_read_header(AVFormatContext *s) } else { - /* Open the demuxer for video and audio components if available */ - for (i = 0; i < c->n_videos; i++) { - rep = c->videos[i]; - if (i > 0 && c->is_init_section_common_video) { - ret = copy_init_section(rep, c->videos[0]); - if (ret < 0) + /* Open the demuxer for video and audio components if available */ + for (i = 0; i < c->n_videos; i++) { + rep = c->videos[i]; + if (i > 0 && c->is_init_section_common_video) { + ret = copy_init_section(rep, c->videos[0]); + if (ret < 0) + return ret; + } + ret = open_demux_for_component(s, rep); + + if (ret) return ret; + rep->stream_index = stream_index; + ++stream_index; } - ret = open_demux_for_component(s, rep); - if (ret) - return ret; - rep->stream_index = stream_index; - ++stream_index; - } + for (i = 0; i < c->n_audios; i++) { + rep = c->audios[i]; + if (i > 0 && c->is_init_section_common_audio) { + ret = copy_init_section(rep, c->audios[0]); + if (ret < 0) + return ret; + } + ret = open_demux_for_component(s, rep); - for (i = 0; i < c->n_audios; i++) { - rep = c->audios[i]; - if (i > 0 && c->is_init_section_common_audio) { - ret = copy_init_section(rep, c->audios[0]); - if (ret < 0) + if (ret) return ret; + rep->stream_index = stream_index; + ++stream_index; } - ret = open_demux_for_component(s, rep); - if (ret) - return ret; - rep->stream_index = stream_index; - ++stream_index; - } + for (i = 0; i < c->n_subtitles; i++) { + rep = c->subtitles[i]; + if (i > 0 && c->is_init_section_common_subtitle) { + ret = copy_init_section(rep, c->subtitles[0]); + if (ret < 0) + return ret; + } + ret = open_demux_for_component(s, rep); - for (i = 0; i < c->n_subtitles; i++) { - rep = c->subtitles[i]; - if (i > 0 && c->is_init_section_common_subtitle) { - ret = copy_init_section(rep, c->subtitles[0]); - if (ret < 0) + if (ret) return ret; + rep->stream_index = stream_index; + ++stream_index; } - ret = open_demux_for_component(s, rep); - if (ret) - return ret; - rep->stream_index = stream_index; - ++stream_index; - } - - if (!stream_index) - return AVERROR_INVALIDDATA; + if (!stream_index) + return AVERROR_INVALIDDATA; } /* Create a program */