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

sebechlebskyjan at gmail.com sebechlebskyjan at gmail.com
Tue Aug 16 13:53:46 EEST 2016


From: Jan Sebechlebsky <sebechlebskyjan at 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 at gmail.com>
---
 libavformat/avformat.h | 2 +-
 libavformat/avio.h     | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

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.
-- 
1.9.1



More information about the ffmpeg-devel mailing list