From: Lukas Fellechner <Lukas.Fellechner@gmx.net>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH v3 2/3] lavf/dashdec: Multithreaded DASH initialization
Date: Sun, 11 Sep 2022 22:35:55 +0200
Message-ID: <trinity-e4dbbe20-3279-4a9f-8504-c4c1bc61afcb-1662928555363@3c-app-gmx-bs18> (raw)
In-Reply-To: <GV1P250MB0737771C24448A13C0CCD5D48F7F9@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM>
Gesendet: Montag, 05. September 2022 um 12:45 Uhr
Von: "Andreas Rheinhardt" <andreas.rheinhardt@outlook.com>
An: ffmpeg-devel@ffmpeg.org
Betreff: Re: [FFmpeg-devel] [PATCH v3 2/3] lavf/dashdec: Multithreaded DASH initialization
Lukas Fellechner:
>>> Moreover, older pthread standards did not allow to use
>>> PTHREAD_MUTEX_INITIALIZER with non-static mutexes, so I don't know
>>> whether we can use that. Also our pthreads-wrapper on top of
>>> OS/2-threads does not provide PTHREAD_COND_INITIALIZER (which is used
>>> nowhere in the codebase).
>>
>> I missed that detail about the initializer macro. Thank you for clearing
>> that up.
>>
>> After looking more into threads implementation in ffmpeg, I wonder if I
>> really need to check any results of init/destroy or other functions.
>> In slicethreads.c, there is zero checking on any of the lock functions.
>> The pthreads-based implementation does internally check the results of all
>> function calls and calls abort() in case of errors ("strict_" wrappers).
>> The Win32 implementation uses SRW locks which cannot even return errors.
>> And the OS2 implementation returns 0 on all calls as well.
>>
>> So right now, I think that I should continue with normal _init() calls
>> (no macros) and drop all error checking, just like slicethread does.
>> Are you fine with that approach?
>
> Zero checking is our old approach; the new approach checks for errors
> and ensures that only mutexes/condition variables that have been
> properly initialized are destroyed. See ff_pthread_init/free in
> libavcodec/pthread.c (you can't use this in libavformat, because these
> functions are local to libavcodec).
>
> - Andreas
I was able to switch to using the slicethread implementation. It has a
very minor delay on init, because it waits for all threads to fully start
up before continueing. But it is only few ms and not worth adding a new
implementation just for that.
I also changed the initialization and release of mutex and conds, with
full return code checking and safe release.
There was one cross-thread issue I needed to address.
A multi hour duration test (connecting in endless loop) did not show
any issues after fixing the avio_opts cross thread access.
Please see the v4 patch for all the changes.
- Lukas
_______________________________________________
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-09-11 20:36 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-20 21:35 [FFmpeg-devel] [PATCH 1/1] " 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
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 [this message]
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=trinity-e4dbbe20-3279-4a9f-8504-c4c1bc61afcb-1662928555363@3c-app-gmx-bs18 \
--to=lukas.fellechner@gmx.net \
--cc=ffmpeg-devel@ffmpeg.org \
/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