mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-26 07:00:13 -05:00
gst-source: fix state changes
Only go to READY in setup_pipeline, this is enough to get the caps. We don't want to go to PAUSED yet because we don't want to negotiate a format. Mark the source busy after we configured the capsfilter so that we can let the source negotiate correctly.
This commit is contained in:
parent
b86eb22922
commit
5c7447fb4d
3 changed files with 57 additions and 47 deletions
|
|
@ -416,8 +416,6 @@ gst_pinos_socket_sink_open (GstPinosSocketSink * this)
|
|||
{
|
||||
GError *error = NULL;
|
||||
|
||||
this->cache = gst_burst_cache_new (sizeof (MyReader));
|
||||
|
||||
this->context = g_main_context_new ();
|
||||
this->loop = g_main_loop_new (this->context, TRUE);
|
||||
GST_DEBUG ("context %p, loop %p", this->context, this->loop);
|
||||
|
|
@ -453,7 +451,6 @@ gst_pinos_socket_sink_close (GstPinosSocketSink * this)
|
|||
g_clear_pointer (&this->loop, g_main_loop_unref);
|
||||
g_clear_pointer (&this->context, g_main_context_unref);
|
||||
g_hash_table_remove_all (this->hash);
|
||||
g_clear_pointer (&this->cache, g_object_unref);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -799,6 +796,7 @@ gst_pinos_socket_sink_finalize (GObject * object)
|
|||
GstPinosSocketSink *this = GST_PINOS_SOCKET_SINK (object);
|
||||
|
||||
g_clear_pointer (&this->hash, g_hash_table_unref);
|
||||
g_clear_pointer (&this->cache, g_object_unref);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
|
@ -879,6 +877,7 @@ static void
|
|||
gst_pinos_socket_sink_init (GstPinosSocketSink * this)
|
||||
{
|
||||
this->hash = g_hash_table_new (g_direct_hash, g_direct_equal);
|
||||
this->cache = gst_burst_cache_new (sizeof (MyReader));
|
||||
this->allocator = gst_tmpfile_allocator_new ();
|
||||
this->fdmanager = pinos_fd_manager_get (PINOS_FD_MANAGER_DEFAULT);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -379,7 +379,7 @@ on_new_buffer (GObject *gobject,
|
|||
if (buf == NULL)
|
||||
buf = gst_buffer_new ();
|
||||
|
||||
GST_INFO ("pts %" G_GUINT64_FORMAT ", dts_offset %"G_GUINT64_FORMAT "\n", hdr.pts, hdr.dts_offset);
|
||||
GST_INFO ("pts %" G_GUINT64_FORMAT ", dts_offset %"G_GUINT64_FORMAT, hdr.pts, hdr.dts_offset);
|
||||
|
||||
if (GST_CLOCK_TIME_IS_VALID (hdr.pts)) {
|
||||
GST_BUFFER_PTS (buf) = hdr.pts;
|
||||
|
|
@ -495,6 +495,16 @@ parse_stream_properties (GstPinosSrc *pinossrc, PinosProperties *props)
|
|||
{
|
||||
const gchar *var;
|
||||
|
||||
var = pinos_properties_get (props, "pinos.latency.is-live");
|
||||
pinossrc->is_live = var ? (atoi (var) == 1) : FALSE;
|
||||
gst_base_src_set_live (GST_BASE_SRC (pinossrc), pinossrc->is_live);
|
||||
|
||||
var = pinos_properties_get (props, "pinos.latency.min");
|
||||
pinossrc->min_latency = var ? (GstClockTime) atoi (var) : 0;
|
||||
|
||||
var = pinos_properties_get (props, "pinos.latency.max");
|
||||
pinossrc->max_latency = var ? (GstClockTime) atoi (var) : GST_CLOCK_TIME_NONE;
|
||||
|
||||
var = pinos_properties_get (props, "pinos.clock.type");
|
||||
if (var != NULL) {
|
||||
GST_DEBUG_OBJECT (pinossrc, "got clock type %s", var);
|
||||
|
|
@ -517,15 +527,6 @@ parse_stream_properties (GstPinosSrc *pinossrc, PinosProperties *props)
|
|||
pinossrc->clock, TRUE));
|
||||
}
|
||||
}
|
||||
var = pinos_properties_get (props, "pinos.latency.is-live");
|
||||
pinossrc->is_live = var ? (atoi (var) == 1) : FALSE;
|
||||
gst_base_src_set_live (GST_BASE_SRC (pinossrc), pinossrc->is_live);
|
||||
|
||||
var = pinos_properties_get (props, "pinos.latency.max");
|
||||
pinossrc->max_latency = var ? (GstClockTime) atoi (var) : GST_CLOCK_TIME_NONE;
|
||||
|
||||
var = pinos_properties_get (props, "pinos.latency.min");
|
||||
pinossrc->min_latency = var ? (GstClockTime) atoi (var) : 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -829,7 +830,7 @@ static GstFlowReturn
|
|||
gst_pinos_src_create (GstPushSrc * psrc, GstBuffer ** buffer)
|
||||
{
|
||||
GstPinosSrc *pinossrc;
|
||||
GstClockTime base_time;
|
||||
GstClockTime pts, dts, base_time;
|
||||
|
||||
pinossrc = GST_PINOS_SRC (psrc);
|
||||
|
||||
|
|
@ -856,20 +857,25 @@ gst_pinos_src_create (GstPushSrc * psrc, GstBuffer ** buffer)
|
|||
|
||||
pinos_main_loop_wait (pinossrc->loop);
|
||||
}
|
||||
base_time = GST_ELEMENT_CAST (psrc)->base_time;
|
||||
|
||||
if (GST_BUFFER_PTS_IS_VALID (*buffer) && GST_BUFFER_PTS (*buffer) >= base_time)
|
||||
GST_BUFFER_PTS (*buffer) -= base_time;
|
||||
else
|
||||
GST_BUFFER_PTS (*buffer) = 0;
|
||||
|
||||
if (GST_BUFFER_DTS_IS_VALID (*buffer) && GST_BUFFER_DTS (*buffer) >= base_time)
|
||||
GST_BUFFER_DTS (*buffer) -= base_time;
|
||||
else
|
||||
GST_BUFFER_DTS (*buffer) = 0;
|
||||
|
||||
pinos_main_loop_unlock (pinossrc->loop);
|
||||
|
||||
base_time = GST_ELEMENT_CAST (psrc)->base_time;
|
||||
pts = GST_BUFFER_PTS (*buffer);
|
||||
dts = GST_BUFFER_DTS (*buffer);
|
||||
|
||||
if (GST_CLOCK_TIME_IS_VALID (pts))
|
||||
pts = (pts >= base_time ? pts - base_time : 0);
|
||||
if (GST_CLOCK_TIME_IS_VALID (dts))
|
||||
dts = (dts >= base_time ? dts - base_time : 0);
|
||||
|
||||
GST_INFO ("pts %" G_GUINT64_FORMAT ", dts %"G_GUINT64_FORMAT
|
||||
", base-time %"GST_TIME_FORMAT" -> %"GST_TIME_FORMAT", %"GST_TIME_FORMAT,
|
||||
GST_BUFFER_PTS (*buffer), GST_BUFFER_DTS (*buffer), GST_TIME_ARGS (base_time),
|
||||
GST_TIME_ARGS (pts), GST_TIME_ARGS (dts));
|
||||
|
||||
GST_BUFFER_PTS (*buffer) = pts;
|
||||
GST_BUFFER_DTS (*buffer) = dts;
|
||||
|
||||
return GST_FLOW_OK;
|
||||
|
||||
not_negotiated:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue