From 19f6faf671438dc9c5165733a1b060fe2dfe1956 Mon Sep 17 00:00:00 2001 From: Stef Boerrigter Date: Mon, 16 Mar 2020 09:09:46 +0100 Subject: GSTVideoRender: Update viewport on gst video buffer crop metadata If the video buffer contains crop metadata update a viewport for the video frame format. Fixes: QTBUG-82448 Change-Id: Iace150c6c03b48662cc9f0112b45fbe6401d6061 Reviewed-by: VaL Doroshchuk --- src/gsttools/qgstvideorenderersink.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/gsttools/qgstvideorenderersink.cpp b/src/gsttools/qgstvideorenderersink.cpp index 3b458a978..13edcb820 100644 --- a/src/gsttools/qgstvideorenderersink.cpp +++ b/src/gsttools/qgstvideorenderersink.cpp @@ -141,6 +141,19 @@ bool QGstDefaultVideoRenderer::present(QAbstractVideoSurface *surface, GstBuffer if (!videoBuffer) videoBuffer = new QGstVideoBuffer(buffer, m_videoInfo); + auto meta = gst_buffer_get_video_crop_meta (buffer); + if (meta) { + QRect vp(meta->x, meta->y, meta->width, meta->height); + if (m_format.viewport() != vp) { +#ifdef DEBUG_VIDEO_SURFACE_SINK + qDebug() << Q_FUNC_INFO << " Update viewport on Metadata: [" << meta->height << "x" << meta->width << " | " << meta->x << "x" << meta->y << "]"; +#endif + //Update viewport if data is not the same + m_format.setViewport(vp); + surface->start(m_format); + } + } + QVideoFrame frame( videoBuffer, m_format.frameSize(), -- cgit v1.2.3 From b8525df9434d34f24c488848e320d1bc77de49cd Mon Sep 17 00:00:00 2001 From: VaL Doroshchuk Date: Thu, 2 Apr 2020 14:34:50 +0200 Subject: GStreamer: Remove file when CaptureToBuffer is used Capturing the image is handled by camerabin and it saves the image to a file. And we wanted to remove the file if capturing to buffer is requested, but the file is kept and not removed. Change-Id: I21404fc160bf275325deebf0f00b588de3493ee1 Fixes: QTBUG-82572 Reviewed-by: Andy Shaw --- src/plugins/gstreamer/camerabin/camerabinimagecapture.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/plugins/gstreamer/camerabin/camerabinimagecapture.cpp b/src/plugins/gstreamer/camerabin/camerabinimagecapture.cpp index 52ec75f44..b164bc31a 100644 --- a/src/plugins/gstreamer/camerabin/camerabinimagecapture.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinimagecapture.cpp @@ -366,12 +366,9 @@ bool CameraBinImageCapture::processBusMessage(const QGstreamerMessage &message) #ifdef DEBUG_CAPTURE qDebug() << Q_FUNC_INFO << "Dropped saving file" << fileName; #endif - //camerabin creates an empty file when captured buffer is dropped, - //let's remove it QFileInfo info(QString::fromUtf8(fileName)); - if (info.exists() && info.isFile() && info.size() == 0) { + if (info.exists() && info.isFile()) QFile(info.absoluteFilePath()).remove(); - } } } } -- cgit v1.2.3 From d8d072417b08dd75734b3f0aa86c3a49db934770 Mon Sep 17 00:00:00 2001 From: Roman Valov Date: Mon, 13 Apr 2020 12:54:09 +0000 Subject: Gstreamer: fix stream buffering Gstreamer client should handle GST_MESSAGE_BUFFERING to play and pause streams based on buffer-percent value and Qt does it properly. However `updateSessionState` of QGstreamerPlayerControl was implemented to go back into playing state each time session state becomes paused. That behavior resulted into choppy stream playback. Fix with condition to un-pause playback only if it's already buffered. Fixes: QTBUG-83417 Change-Id: Ida4a9e2e196de00050bdc64725fa818c7e939785 Reviewed-by: VaL Doroshchuk --- src/gsttools/qgstreamerplayercontrol.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gsttools/qgstreamerplayercontrol.cpp b/src/gsttools/qgstreamerplayercontrol.cpp index 165978288..d65102e2f 100644 --- a/src/gsttools/qgstreamerplayercontrol.cpp +++ b/src/gsttools/qgstreamerplayercontrol.cpp @@ -439,8 +439,10 @@ void QGstreamerPlayerControl::updateSessionState(QMediaPlayer::State state) } m_pendingSeekPosition = -1; - if (m_currentState == QMediaPlayer::PlayingState) - m_session->play(); + if (m_currentState == QMediaPlayer::PlayingState) { + if (m_mediaStatus == QMediaPlayer::BufferedMedia) + m_session->play(); + } } updateMediaStatus(); -- cgit v1.2.3