Skip to content

Commit

Permalink
FFmpeg: Add QT_FFMPEG_PROTOCOL_WHITELIST environment variable
Browse files Browse the repository at this point in the history
FFmpeg AV format context has a protocol whitelist option, which is
populated on avformat_open_input() call. This usually ends up correct,
but for example when opening an .sdp file for playing an rtp stream, the
whitelist doesn't include "rtp" and "udp".

This patch adds a check for the QT_FFMPEG_PROTOCOL_WHITELIST environment
variable, which the user can set to override the whitelist with their
own.

Fixes: QTBUG-125006
Pick-to: 6.7 6.5
Change-Id: I7ddb53f879af909fb8b38c639c571822542d6638
Reviewed-by: Jøger Hansegård <[email protected]>
Reviewed-by: Artem Dyomin <[email protected]>
  • Loading branch information
Mikko Hallamaa committed May 14, 2024
1 parent 0dafe69 commit 2b4c9cf
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ loadMedia(const QUrl &mediaUrl, QIODevice *stream, const std::shared_ptr<ICancel
constexpr auto NetworkTimeoutUs = "5000000";
av_dict_set(dict, "timeout", NetworkTimeoutUs, 0);

const QByteArray protocolWhitelist = qgetenv("QT_FFMPEG_PROTOCOL_WHITELIST");
if (!protocolWhitelist.isNull())
av_dict_set(dict, "protocol_whitelist", protocolWhitelist.data(), 0);

context->interrupt_callback.opaque = cancelToken.get();
context->interrupt_callback.callback = [](void *opaque) {
const auto *cancelToken = static_cast<const ICancelToken *>(opaque);
Expand Down

0 comments on commit 2b4c9cf

Please sign in to comment.