diff mbox

[FFmpeg-devel] avformat: Document thread-safety requirement for interrupt callback

Message ID 1471344826-25138-1-git-send-email-sebechlebskyjan@gmail.com
State Rejected
Headers show

Commit Message

sebechlebskyjan@gmail.com Aug. 16, 2016, 10:53 a.m. UTC
From: Jan Sebechlebsky <sebechlebskyjan@gmail.com>

Muxing might be running in a separate thread if actual muxer is
run inside of fifo pseudo-muxer. Callback should be therefore
thread-safe.

Signed-off-by: Jan Sebechlebsky <sebechlebskyjan@gmail.com>
---
 libavformat/avformat.h | 2 +-
 libavformat/avio.h     | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

Comments

Nicolas George Aug. 16, 2016, 11:41 a.m. UTC | #1
Le decadi 30 thermidor, an CCXXIV, sebechlebskyjan@gmail.com a écrit :
> From: Jan Sebechlebsky <sebechlebskyjan@gmail.com>
> 
> Muxing might be running in a separate thread if actual muxer is
> run inside of fifo pseudo-muxer. Callback should be therefore
> thread-safe.

This is an incompatible API change, and therefore not acceptable.

Regards,
Marton Balint Aug. 16, 2016, 4:11 p.m. UTC | #2
On Tue, 16 Aug 2016, Nicolas George wrote:

> Le decadi 30 thermidor, an CCXXIV, sebechlebskyjan@gmail.com a écrit :
>> From: Jan Sebechlebsky <sebechlebskyjan@gmail.com>
>>
>> Muxing might be running in a separate thread if actual muxer is
>> run inside of fifo pseudo-muxer. Callback should be therefore
>> thread-safe.
>
> This is an incompatible API change, and therefore not acceptable.
>

I think the idea was to document this limitation to the fifo muxer only.

Regards,
Marton
Nicolas George Aug. 16, 2016, 4:42 p.m. UTC | #3
Le decadi 30 thermidor, an CCXXIV, Marton Balint a écrit :
> I think the idea was to document this limitation to the fifo muxer only.

That would be acceptable, although I still think it would be preferable to
avoid that requirement altogether.

Regards,
sebechlebskyjan@gmail.com Aug. 16, 2016, 5:14 p.m. UTC | #4
On 08/16/2016 06:42 PM, Nicolas George wrote:

> Le decadi 30 thermidor, an CCXXIV, Marton Balint a écrit :
>> I think the idea was to document this limitation to the fifo muxer only.
> That would be acceptable, although I still think it would be preferable to
> avoid that requirement altogether.
>
> Regards,
>
Is it OK, if I leave the comment only in avformat.h in AVFormatContext 
and change it to
"Callback must be thread safe when fifo muxer is used"?

Regards,
Jan
diff mbox

Patch

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 79c2511..8550dca 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1564,7 +1564,7 @@  typedef struct AVFormatContext {
      * muxing: set by the user before avformat_write_header()
      * (mainly useful for AVFMT_NOFILE formats). The callback
      * should also be passed to avio_open2() if it's used to
-     * open the file.
+     * open the file. The callback must be thread-safe.
      */
     AVIOInterruptCB interrupt_callback;
 
diff --git a/libavformat/avio.h b/libavformat/avio.h
index b1ce1d1..b5d1396 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -43,6 +43,8 @@ 
  * opaque as parameter. If the callback returns 1, the
  * blocking operation will be aborted.
  *
+ * If the callback is used in muxing context, it has to be thread-safe.
+ *
  * No members can be added to this struct without a major bump, if
  * new elements have been added after this struct in AVFormatContext
  * or AVIOContext.