mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
gst: src: Reset transform on stream stop
When a stream is stopped, chances are high that downstream elements change or get reset, i.e. don't remember a previously send rotation event. Thus reset the transform value in order to ensure we create a new one on the next stream start. In order to not regress the case when downstream *does* remember the orientation and the buffer orientation changes from e.g. `TRANSFORMATION_90` to `TRANSFORMATION_None` between stream stop and restart, initialize the remembered transform to an invalid value and ensure we always send a rotation event, even for `TRANSFORMATION_None`.
This commit is contained in:
parent
015a367e30
commit
226440382b
1 changed files with 16 additions and 15 deletions
|
|
@ -435,6 +435,8 @@ gst_pipewire_src_init (GstPipeWireSrc * src)
|
||||||
src->autoconnect = DEFAULT_AUTOCONNECT;
|
src->autoconnect = DEFAULT_AUTOCONNECT;
|
||||||
src->min_latency = 0;
|
src->min_latency = 0;
|
||||||
src->max_latency = GST_CLOCK_TIME_NONE;
|
src->max_latency = GST_CLOCK_TIME_NONE;
|
||||||
|
|
||||||
|
src->transform_value = UINT32_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
@ -538,7 +540,7 @@ static GstBuffer *dequeue_buffer(GstPipeWireSrc *pwsrc)
|
||||||
GstPipeWirePoolData *data;
|
GstPipeWirePoolData *data;
|
||||||
struct spa_meta_header *h;
|
struct spa_meta_header *h;
|
||||||
struct spa_meta_region *crop;
|
struct spa_meta_region *crop;
|
||||||
struct spa_meta_videotransform *videotransform;
|
enum spa_meta_videotransform_value transform_value;
|
||||||
struct pw_time time;
|
struct pw_time time;
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
|
|
@ -613,24 +615,22 @@ static GstBuffer *dequeue_buffer(GstPipeWireSrc *pwsrc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
videotransform = data->videotransform;
|
transform_value = data->videotransform ? data->videotransform->transform :
|
||||||
if (videotransform) {
|
SPA_META_TRANSFORMATION_None;
|
||||||
if (pwsrc->transform_value != videotransform->transform) {
|
if (transform_value != pwsrc->transform_value) {
|
||||||
GstEvent *tag_event;
|
GstEvent *tag_event;
|
||||||
const char* tag_string;
|
const char* tag_string;
|
||||||
|
|
||||||
tag_string =
|
tag_string = spa_transform_value_to_gst_image_orientation(transform_value);
|
||||||
spa_transform_value_to_gst_image_orientation(videotransform->transform);
|
|
||||||
|
|
||||||
GST_LOG_OBJECT (pwsrc, "got new videotransform: %u / %s",
|
GST_LOG_OBJECT (pwsrc, "got new videotransform: %u / %s",
|
||||||
videotransform->transform, tag_string);
|
transform_value, tag_string);
|
||||||
|
|
||||||
tag_event = gst_event_new_tag(gst_tag_list_new(GST_TAG_IMAGE_ORIENTATION,
|
tag_event = gst_event_new_tag(gst_tag_list_new(GST_TAG_IMAGE_ORIENTATION,
|
||||||
tag_string, NULL));
|
tag_string, NULL));
|
||||||
gst_pad_push_event (GST_BASE_SRC_PAD (pwsrc), tag_event);
|
gst_pad_push_event (GST_BASE_SRC_PAD (pwsrc), tag_event);
|
||||||
|
|
||||||
pwsrc->transform_value = videotransform->transform;
|
pwsrc->transform_value = transform_value;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pwsrc->is_video) {
|
if (pwsrc->is_video) {
|
||||||
|
|
@ -1391,6 +1391,7 @@ gst_pipewire_src_stop (GstBaseSrc * basesrc)
|
||||||
pwsrc->eos = false;
|
pwsrc->eos = false;
|
||||||
gst_buffer_replace (&pwsrc->last_buffer, NULL);
|
gst_buffer_replace (&pwsrc->last_buffer, NULL);
|
||||||
gst_caps_replace(&pwsrc->caps, NULL);
|
gst_caps_replace(&pwsrc->caps, NULL);
|
||||||
|
pwsrc->transform_value = UINT32_MAX;
|
||||||
pw_thread_loop_unlock (pwsrc->stream->core->loop);
|
pw_thread_loop_unlock (pwsrc->stream->core->loop);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue