diff options
author | Mikko Hallamaa <mikko.hallamaa@qt.io> | 2024-03-15 17:22:27 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2024-03-20 22:25:01 +0000 |
commit | 0f7d4fd67916ffad407536883390f9cbe0261049 (patch) | |
tree | 1b0bc90e0f771bba12da1c9414a2748c17714349 | |
parent | e598ecab5473d74ee875b80ec6624018f8c2d429 (diff) |
Name IO device writing lambda in MediaCaptureSession
The lambda used to push data to the audio sink in MediaCaptureSession
was unnamed. This patch gives it a descriptive name.
Pick-to: 6.5
Change-Id: I86bd85836cb65503d25b849522526637e09f0c6a
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
(cherry picked from commit 6289bb03401224f3139d43add0cda166ba23e3eb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit a7baacccae71c7175825d2cc01d7c64f93972f57)
-rw-r--r-- | src/plugins/multimedia/ffmpeg/qffmpegmediacapturesession.cpp | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/src/plugins/multimedia/ffmpeg/qffmpegmediacapturesession.cpp b/src/plugins/multimedia/ffmpeg/qffmpegmediacapturesession.cpp index f2b1889ed..f02593d16 100644 --- a/src/plugins/multimedia/ffmpeg/qffmpegmediacapturesession.cpp +++ b/src/plugins/multimedia/ffmpeg/qffmpegmediacapturesession.cpp @@ -162,24 +162,22 @@ void QFFmpegMediaCaptureSession::updateAudioSink() m_audioIODevice = m_audioSink->start(); if (m_audioIODevice) { - connect(m_audioInput, &QFFmpegAudioInput::newAudioBuffer, m_audioSink.get(), - [this](const QAudioBuffer &buffer) { - if (m_audioBufferSize < preferredAudioSinkBufferSize(*m_audioInput)) { - qCDebug(qLcFFmpegMediaCaptureSession) - << "Recreate audiosink due to small buffer size:" - << m_audioBufferSize; - - updateAudioSink(); - } - - const auto written = - m_audioIODevice->write(buffer.data<const char>(), buffer.byteCount()); - - if (written < buffer.byteCount()) - qCWarning(qLcFFmpegMediaCaptureSession) - << "Not all bytes written:" << written << "vs" - << buffer.byteCount(); - }); + auto writeToDevice = [this](const QAudioBuffer &buffer) { + if (m_audioBufferSize < preferredAudioSinkBufferSize(*m_audioInput)) { + qCDebug(qLcFFmpegMediaCaptureSession) + << "Recreate audiosink due to small buffer size:" << m_audioBufferSize; + + updateAudioSink(); + } + + const auto written = + m_audioIODevice->write(buffer.data<const char>(), buffer.byteCount()); + + if (written < buffer.byteCount()) + qCWarning(qLcFFmpegMediaCaptureSession) + << "Not all bytes written:" << written << "vs" << buffer.byteCount(); + }; + connect(m_audioInput, &QFFmpegAudioInput::newAudioBuffer, m_audioSink.get(), writeToDevice); } else { qWarning() << "Failed to start audiosink push mode"; } |