From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 360B843FB4 for ; Tue, 23 Aug 2022 19:04:14 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 19C7368B9C3; Tue, 23 Aug 2022 22:04:13 +0300 (EEST) Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 55CA268B9B3 for ; Tue, 23 Aug 2022 22:04:06 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1661281445; bh=MMpaMgmJIGP+HIBWki62KsjwFXB6/7cxNdEqsL2Ggjs=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=MAIhSfHuO7D5BUT6k0kyXyoUWPzvf719IG5/Y4yXXG8IzAhHcfe2Xyys42nL3THTB fSZW6tRAjq7oM4CDU+ER12AyGov4L1+AYaEqRv4ZQijr/FRRA52zq537yqkkVpYy0A RIpH8e6U9uraHBOGi2KAprYNHplcv021/FLenL/Q= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([94.134.107.162]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MrhQ6-1pByl72VU4-00nfB6; Tue, 23 Aug 2022 21:04:05 +0200 From: Lukas Fellechner To: ffmpeg-devel@ffmpeg.org Date: Tue, 23 Aug 2022 21:03:24 +0200 Message-Id: <20220823190326.249-2-lukas.fellechner@gmx.net> X-Mailer: git-send-email 2.31.1.windows.1 In-Reply-To: <20220823190326.249-1-lukas.fellechner@gmx.net> References: <20220823190326.249-1-lukas.fellechner@gmx.net> MIME-Version: 1.0 X-Provags-ID: V03:K1:I90Y64tqy0MO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n BQKC5K0zPD+rDOQfY2LR+dAWP2QmUz+BhsjNQQ9N+OhZl7cME8Ierlk/YKRAw/G0Za6kB6YK1 O3y/F0w5lXcErWcQVP5jXX1FBjgIIVEgPvRrYKK1ll6nDQFWNA+BHhm0QnAWRKL7r0XfvXANo JOIHATcecqx3rkxFemxnheAXY87rj8hUNJcqTDgDgSfrtQTbVC3vlEWw/7PHSlk+ALuKaZKjJ IQl88BSnw7QqLzN1txtQOxgUckcXocL+f5y4jh/tYtoLX86j6I8xKc9JgTR9OusgGEAczk+Et FqIsGH5e/0WRqhDqty8cPis49KA3nZokXqw3PK0dAnJVNLLviE/dmMj5A== Subject: [FFmpeg-devel] [PATCH v3 1/3] 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: 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(-) 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) { -- 2.31.1.windows.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".