summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtem Dyomin <artem.dyomin@qt.io>2022-11-15 12:48:29 +0100
committerArtem Dyomin <artem.dyomin@qt.io>2022-11-16 13:52:07 +0100
commit77721ec69facafe3f3269bdd8a7fb6470587256d (patch)
tree183b1f6796d1cd1e158ab82f32a0769fb3c868d1
parent25813d5de887e94b4470f9d55297d9d3e645096a (diff)
Old decoder, 6.4, Define for Android only force creating hw frames ctx
In general case, force creating of the context is not correct since ffmpeg can use additional data fields if hw_frames_ctx exists. Ideally, the context should be created on ffmpeg side. The investigation should be done under QTBUG-108446 (fix ffmpeg side or this code). Read more in the task description. We encounter the problem after fixing of HWAccel::createFramesContext, see codereview.qt-project.org/c/qt/qtmultimedia/+/442644, force creation of the context didn't work before anyway. This commit is required in order to integrate codereview.qt-project.org/c/qt/qtmultimedia/+/442644 Task-number: QTBUG-108446 Pick-to: 6.4 Change-Id: I71c520fabbbdd80d227db4412c8541639b0baf18 Reviewed-by: Lars Knoll <lars@knoll.priv.no>
-rw-r--r--src/plugins/multimedia/ffmpeg/qffmpegdecoder.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/plugins/multimedia/ffmpeg/qffmpegdecoder.cpp b/src/plugins/multimedia/ffmpeg/qffmpegdecoder.cpp
index 7bfc8b31d..399501c41 100644
--- a/src/plugins/multimedia/ffmpeg/qffmpegdecoder.cpp
+++ b/src/plugins/multimedia/ffmpeg/qffmpegdecoder.cpp
@@ -663,6 +663,12 @@ void VideoRenderer::loop()
// qCDebug(qLcVideoRenderer) << "RHI:" << accel.isNull() << accel.rhi() << sink->rhi();
// in practice this only happens with mediacodec
+#ifdef Q_OS_ANDROID
+ // QTBUG-108446
+ // In general case, just creation of frames context is not correct since
+ // frames may require additional specific data for hw contexts, so
+ // just setting of hw_frames_ctx is not enough.
+ // TODO: investigate the case in order to remove or fix the code.
if (frame.codec()->hwAccel() && !frame.avFrame()->hw_frames_ctx) {
HWAccel *hwaccel = frame.codec()->hwAccel();
AVFrame *avframe = frame.avFrame();
@@ -672,6 +678,7 @@ void VideoRenderer::loop()
avframe->hw_frames_ctx = av_buffer_ref(hwaccel->hwFramesContextAsBuffer());
}
+#endif
QFFmpegVideoBuffer *buffer = new QFFmpegVideoBuffer(frame.takeAVFrame());
QVideoFrameFormat format(buffer->size(), buffer->pixelFormat());