From: Steven Liu <lingjiujianke@gmail.com>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Cc: Lukas Fellechner <lukas.fellechner@gmx.net>
Subject: Re: [FFmpeg-devel] [PATCH v3 1/3] lavf/dashdec: Prepare DASH decoder for multithreading
Date: Wed, 31 Aug 2022 10:09:16 +0800
Message-ID: <CADxeRwn=8k6Y+9EC1qVW=nLhD3=xBHLGS2Fmu1H3BcgasZ79pA@mail.gmail.com> (raw)
In-Reply-To: <20220823190326.249-2-lukas.fellechner@gmx.net>
Lukas Fellechner <lukas.fellechner@gmx.net> 于2022年8月24日周三 03:04写道:
>
> 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".
Patchset looks ok and test passed here. Any comments?
Thanks
Steven
_______________________________________________
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".
next prev parent reply other threads:[~2022-08-31 2:09 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-20 21:35 [FFmpeg-devel] [PATCH 1/1] lavf/dashdec: Multithreaded DASH initialization Lukas Fellechner
2022-08-20 21:53 ` Lukas Fellechner
2022-08-21 4:10 ` Steven Liu
2022-08-21 12:47 ` Lukas Fellechner
2022-08-21 19:26 ` [FFmpeg-devel] [PATCH v2] " Lukas Fellechner
2022-08-23 3:19 ` Steven Liu
2022-08-23 19:09 ` Lukas Fellechner
2022-08-23 19:03 ` [FFmpeg-devel] [PATCH v3 0/3] " Lukas Fellechner
2022-08-23 19:03 ` [FFmpeg-devel] [PATCH v3 1/3] lavf/dashdec: Prepare DASH decoder for multithreading Lukas Fellechner
2022-08-31 2:09 ` Steven Liu [this message]
2022-08-23 19:03 ` [FFmpeg-devel] [PATCH v3 2/3] lavf/dashdec: Multithreaded DASH initialization Lukas Fellechner
2022-08-31 2:54 ` Andreas Rheinhardt
2022-08-31 7:25 ` Steven Liu
2022-08-31 12:17 ` Andreas Rheinhardt
2022-09-04 21:29 ` Lukas Fellechner
2022-09-04 22:50 ` Andreas Rheinhardt
2022-09-05 10:15 ` Lukas Fellechner
2022-09-05 10:45 ` Andreas Rheinhardt
2022-09-05 14:28 ` Lukas Fellechner
2022-09-11 20:35 ` Lukas Fellechner
2022-08-23 19:03 ` [FFmpeg-devel] [PATCH v3 3/3] lavf/dashdec: Fix indentation after multithreading Lukas Fellechner
2022-09-05 21:16 ` [FFmpeg-devel] [PATCH v4 0/4] lavf/dashdec: Multithreaded DASH initialization Lukas Fellechner
2022-09-05 21:16 ` [FFmpeg-devel] [PATCH v4 1/4] lavf/dashdec: Prepare DASH decoder for multithreading Lukas Fellechner
2022-09-05 21:16 ` [FFmpeg-devel] [PATCH v4 2/4] lavf/dashdec: Multithreaded DASH initialization Lukas Fellechner
2022-09-05 21:16 ` [FFmpeg-devel] [PATCH v4 3/4] lavf/dashdec: Prevent cross-thread avio_opts modification Lukas Fellechner
2022-09-05 21:16 ` [FFmpeg-devel] [PATCH v4 4/4] lavf/dashdec: Fix indentation after adding multithreading Lukas Fellechner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CADxeRwn=8k6Y+9EC1qVW=nLhD3=xBHLGS2Fmu1H3BcgasZ79pA@mail.gmail.com' \
--to=lingjiujianke@gmail.com \
--cc=ffmpeg-devel@ffmpeg.org \
--cc=lukas.fellechner@gmx.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git