Dynamic AudioMixer Pipelines

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Dynamic AudioMixer Pipelines

wunwunforever
Hi All,

I'm writing an application which dynamically adds and removes app_sources
from an audiomixer element.

I'm currently stuck on:
audioaggregator
gstaudioaggregator.c:1188:gst_audio_aggregator_sink_event:<mix> Segment of
type bytes are not supported, only TIME segments are supported

Followed by repeating lines of:

** (<unknown>:49832): CRITICAL **: 15:56:06.488: gst_audio_buffer_clip:
assertion 'segment->format == GST_FORMAT_TIME || segment->format ==
GST_FORMAT_DEFAULT' failed
(<unknown>:49832): GStreamer-CRITICAL **: 15:56:06.488:
gst_segment_to_running_time: assertion 'segment->format == format' failed
(<unknown>:49832): GStreamer-CRITICAL **: 15:56:06.488:
gst_segment_to_running_time: assertion 'segment->format == format' failed

The function that adds the elements is:

GstElement *
gst_custom_add_audio_appsrc (GstElement * pipe)
{
  GstPad *sinkpad, *convpad;
  GstElement *src, *conv, *sink;
  GstPadLinkReturn ret;

  src = gst_element_factory_make ("appsrc", "audio_src");
  g_object_set(src, "is-live", TRUE, "do-timestamp",TRUE, NULL);
  conv = gst_element_factory_make ("audiorate", NULL);
  sink = gst_bin_get_by_name (GST_BIN(pipe), "mix");
 
  gst_bin_add_many (GST_BIN (pipe), src, conv, NULL);
  gboolean r;
  r = gst_element_sync_state_with_parent (src);
  if (!r) {
    g_print("Couldn't sync src, with parent\n");
  }
  r = gst_element_sync_state_with_parent (conv);
  if (!r) {
    g_print("Couldn't sync conv, with parent\n");
  }
  r = gst_element_link_many (src, conv, NULL);
  if (!r) {
    g_print("Couldn't link many\n");
  }
  convpad = gst_element_get_static_pad(conv, "src");
  sinkpad = gst_element_get_request_pad (sink, "sink_%u");
  if (gst_pad_link (convpad, sinkpad) != GST_PAD_LINK_OK) {
    g_printerr ("mixer could not be linked.\n");
    return NULL;
  }
  gst_object_unref (convpad);

  return src;
}

This is called after the pipeline is already playing.

From reading the documentation, it looks like the elements that are added,
have not received a SEGMENT Event, so are unaware of the current segment, so
fail to assign the current segment to the new buffers.

How should I go about resolving this? Do I need to trigger a new Segment
event, to propagate the current value to the new elements? If so, how do I
best generate one to not interrupt playback of the pipeline?

Thanks in advance,





--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic AudioMixer Pipelines

Mathieu Duponchelle
appsrc has a "format" property, its default is "bytes". You probably want to use "time"?

On 3/5/20 4:15 AM, wunwunforever wrote:

> Hi All,
>
> I'm writing an application which dynamically adds and removes app_sources
> from an audiomixer element.
>
> I'm currently stuck on:
> audioaggregator
> gstaudioaggregator.c:1188:gst_audio_aggregator_sink_event:<mix> Segment of
> type bytes are not supported, only TIME segments are supported
>
> Followed by repeating lines of:
>
> ** (<unknown>:49832): CRITICAL **: 15:56:06.488: gst_audio_buffer_clip:
> assertion 'segment->format == GST_FORMAT_TIME || segment->format ==
> GST_FORMAT_DEFAULT' failed
> (<unknown>:49832): GStreamer-CRITICAL **: 15:56:06.488:
> gst_segment_to_running_time: assertion 'segment->format == format' failed
> (<unknown>:49832): GStreamer-CRITICAL **: 15:56:06.488:
> gst_segment_to_running_time: assertion 'segment->format == format' failed
>
> The function that adds the elements is:
>
> GstElement *
> gst_custom_add_audio_appsrc (GstElement * pipe)
> {
>   GstPad *sinkpad, *convpad;
>   GstElement *src, *conv, *sink;
>   GstPadLinkReturn ret;
>
>   src = gst_element_factory_make ("appsrc", "audio_src");
>   g_object_set(src, "is-live", TRUE, "do-timestamp",TRUE, NULL);
>   conv = gst_element_factory_make ("audiorate", NULL);
>   sink = gst_bin_get_by_name (GST_BIN(pipe), "mix");
>  
>   gst_bin_add_many (GST_BIN (pipe), src, conv, NULL);
>   gboolean r;
>   r = gst_element_sync_state_with_parent (src);
>   if (!r) {
>     g_print("Couldn't sync src, with parent\n");
>   }
>   r = gst_element_sync_state_with_parent (conv);
>   if (!r) {
>     g_print("Couldn't sync conv, with parent\n");
>   }
>   r = gst_element_link_many (src, conv, NULL);
>   if (!r) {
>     g_print("Couldn't link many\n");
>   }
>   convpad = gst_element_get_static_pad(conv, "src");
>   sinkpad = gst_element_get_request_pad (sink, "sink_%u");
>   if (gst_pad_link (convpad, sinkpad) != GST_PAD_LINK_OK) {
>     g_printerr ("mixer could not be linked.\n");
>     return NULL;
>   }
>   gst_object_unref (convpad);
>
>   return src;
> }
>
> This is called after the pipeline is already playing.
>
> From reading the documentation, it looks like the elements that are added,
> have not received a SEGMENT Event, so are unaware of the current segment, so
> fail to assign the current segment to the new buffers.
>
> How should I go about resolving this? Do I need to trigger a new Segment
> event, to propagate the current value to the new elements? If so, how do I
> best generate one to not interrupt playback of the pipeline?
>
> Thanks in advance,
>
>
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic AudioMixer Pipelines

wunwunforever
That solved it, thanks!



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel