mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-13 13:30:05 -05:00
pipewiresrc: Fix renegotiation
Some downstream elements trigger re-negotiations when the stream is
running, e.g. due to output window resizing for the below pipeline.
gst-launch-1.0 pipewiresrc ! videoconvert ! video/x-raw ! gtk4paintablesink
This fails due to a side effect introduced by commit 77143e54 with
handle_format_change() setting `is_video` to `false` when param was
NULL. Fix this by explicitly tracking media type and not just video
using a boolean.
This commit is contained in:
parent
d3368ee0d5
commit
fa8b0ba018
2 changed files with 9 additions and 6 deletions
|
|
@ -769,7 +769,7 @@ static GstBuffer *dequeue_buffer(GstPipeWireSrc *pwsrc)
|
||||||
GST_BUFFER_DTS (buf) = b->time - pwsrc->delay;
|
GST_BUFFER_DTS (buf) = b->time - pwsrc->delay;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pwsrc->is_video) {
|
if (pwsrc->media_type == SPA_MEDIA_TYPE_video) {
|
||||||
if (pwsrc->video_info.fps_n) {
|
if (pwsrc->video_info.fps_n) {
|
||||||
GST_BUFFER_DURATION (buf) = gst_util_uint64_scale (GST_SECOND,
|
GST_BUFFER_DURATION (buf) = gst_util_uint64_scale (GST_SECOND,
|
||||||
pwsrc->video_info.fps_d, pwsrc->video_info.fps_n);
|
pwsrc->video_info.fps_d, pwsrc->video_info.fps_n);
|
||||||
|
|
@ -912,7 +912,7 @@ on_state_changed (void *data,
|
||||||
* must handle the clock lost message in it's bus handler by pausing
|
* must handle the clock lost message in it's bus handler by pausing
|
||||||
* the pipeline and then setting it back to playing.
|
* the pipeline and then setting it back to playing.
|
||||||
*/
|
*/
|
||||||
if (current_state == GST_STATE_PLAYING && !pwsrc->is_video)
|
if (current_state == GST_STATE_PLAYING && pwsrc->media_type == SPA_MEDIA_TYPE_audio)
|
||||||
gst_element_post_message (GST_ELEMENT_CAST (pwsrc),
|
gst_element_post_message (GST_ELEMENT_CAST (pwsrc),
|
||||||
gst_message_new_clock_lost (GST_OBJECT_CAST (pwsrc),
|
gst_message_new_clock_lost (GST_OBJECT_CAST (pwsrc),
|
||||||
GST_CLOCK_CAST (pwsrc->stream->clock)));
|
GST_CLOCK_CAST (pwsrc->stream->clock)));
|
||||||
|
|
@ -1265,7 +1265,7 @@ handle_format_change (GstPipeWireSrc *pwsrc,
|
||||||
if (param == NULL) {
|
if (param == NULL) {
|
||||||
GST_DEBUG_OBJECT (pwsrc, "clear format");
|
GST_DEBUG_OBJECT (pwsrc, "clear format");
|
||||||
pwsrc->negotiated = FALSE;
|
pwsrc->negotiated = FALSE;
|
||||||
pwsrc->is_video = FALSE;
|
pwsrc->media_type = SPA_MEDIA_TYPE_unknown;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1303,7 +1303,7 @@ handle_format_change (GstPipeWireSrc *pwsrc,
|
||||||
structure = gst_caps_get_structure (pwsrc->caps, 0);
|
structure = gst_caps_get_structure (pwsrc->caps, 0);
|
||||||
if (g_str_has_prefix (gst_structure_get_name (structure), "video/") ||
|
if (g_str_has_prefix (gst_structure_get_name (structure), "video/") ||
|
||||||
g_str_has_prefix (gst_structure_get_name (structure), "image/")) {
|
g_str_has_prefix (gst_structure_get_name (structure), "image/")) {
|
||||||
pwsrc->is_video = TRUE;
|
pwsrc->media_type = SPA_MEDIA_TYPE_video;
|
||||||
|
|
||||||
#ifdef HAVE_GSTREAMER_DMA_DRM
|
#ifdef HAVE_GSTREAMER_DMA_DRM
|
||||||
if (gst_video_is_dma_drm_caps (pwsrc->caps)) {
|
if (gst_video_is_dma_drm_caps (pwsrc->caps)) {
|
||||||
|
|
@ -1342,10 +1342,12 @@ handle_format_change (GstPipeWireSrc *pwsrc,
|
||||||
* application/user */
|
* application/user */
|
||||||
if (pwsrc->use_bufferpool != USE_BUFFERPOOL_YES)
|
if (pwsrc->use_bufferpool != USE_BUFFERPOOL_YES)
|
||||||
pwsrc->use_bufferpool = USE_BUFFERPOOL_NO;
|
pwsrc->use_bufferpool = USE_BUFFERPOOL_NO;
|
||||||
|
|
||||||
|
pwsrc->media_type = SPA_MEDIA_TYPE_audio;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pwsrc->negotiated = FALSE;
|
pwsrc->negotiated = FALSE;
|
||||||
pwsrc->is_video = FALSE;
|
pwsrc->media_type = SPA_MEDIA_TYPE_unknown;
|
||||||
pwsrc->is_rawvideo = FALSE;
|
pwsrc->is_rawvideo = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
#include <gst/video/video.h>
|
#include <gst/video/video.h>
|
||||||
|
|
||||||
#include <pipewire/pipewire.h>
|
#include <pipewire/pipewire.h>
|
||||||
|
#include <spa/param/format.h>
|
||||||
#include <gst/gstpipewirepool.h>
|
#include <gst/gstpipewirepool.h>
|
||||||
#include <gst/gstpipewirecore.h>
|
#include <gst/gstpipewirecore.h>
|
||||||
|
|
||||||
|
|
@ -63,7 +64,7 @@ struct _GstPipeWireSrc {
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
GstCaps *possible_caps;
|
GstCaps *possible_caps;
|
||||||
|
|
||||||
gboolean is_video;
|
enum spa_media_type media_type;
|
||||||
gboolean is_rawvideo;
|
gboolean is_rawvideo;
|
||||||
GstVideoInfo video_info;
|
GstVideoInfo video_info;
|
||||||
#ifdef HAVE_GSTREAMER_DMA_DRM
|
#ifdef HAVE_GSTREAMER_DMA_DRM
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue