diff options
author | Bartlomiej Moskal <bartlomiej.moskal@qt.io> | 2024-03-21 09:18:45 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2024-03-21 21:27:33 +0000 |
commit | 00f882e58d25c103924831f04f877e4a735c4d43 (patch) | |
tree | 0703c344de5fad628b6789a5b6a442d4a4f0ccfb | |
parent | e19b386c4d49f2e725c21f8db7b69917a7fb22c0 (diff) |
FFmpegVideoEncoder: Process frames also in pause state
Remove the pause flag check from processOne() method in
QVideoEncoder.
When pause flag is set, no more frames will be added to the queue in
addFrame method anyway. That is why additional check in processOne
method is not needed and we can allow to handle already delivered
frames.
This removal fixes a possible infinity loop that occurs when recording
is stopped in the pause state. This will happen when m_videoFrameQueue
is not empty. In the cleanup method we will try to process all frames,
but we will not process frames due to the pause state.
Pick-to: 6.5
Fixes: QTBUG-122184
Change-Id: I1cc307bb140b934d130bae08a59fd61f08111b84
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
(cherry picked from commit 653d196a1c77aba2f80566c114f4646af676f69e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit f56950898be94445859c16c92374c8ebc3d2dcdb)
-rw-r--r-- | src/plugins/multimedia/ffmpeg/qffmpegencoder.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/plugins/multimedia/ffmpeg/qffmpegencoder.cpp b/src/plugins/multimedia/ffmpeg/qffmpegencoder.cpp index 361b5673c..1e0c13495 100644 --- a/src/plugins/multimedia/ffmpeg/qffmpegencoder.cpp +++ b/src/plugins/multimedia/ffmpeg/qffmpegencoder.cpp @@ -388,7 +388,7 @@ void AudioEncoder::retrievePackets() void AudioEncoder::processOne() { QAudioBuffer buffer = takeBuffer(); - if (!buffer.isValid() || m_paused.loadAcquire()) + if (!buffer.isValid()) return; if (buffer.format() != m_format) { @@ -541,9 +541,6 @@ static void freeQVideoFrame(void *opaque, uint8_t *) void VideoEncoder::processOne() { - if (m_paused.loadAcquire()) - return; - retrievePackets(); auto frame = takeFrame(); |