<div dir="auto"><div><br><div class="gmail_extra"><br><div class="gmail_quote">Le 14 juin 2017 4:13 AM, "alcosar" <<a href="mailto:alkhozar@gmail.com">alkhozar@gmail.com</a>> a écrit :<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
I have an application that has to send audio stream to 2 different<br>
addresses, but not at the same time. So only one channel can be active at a<br>
time.<br>
I thought that I can use tee element to split 2 streams before sending them<br>
to udpsink. I would register 2 callbacks on 2 queue pads and will drop<br></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">Yes, but you'll probably need to set your udpsink to async=1 to get your pipeline into playing state.</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
buffers on one of them. Here is my pipeline and code:<br>
constexpr char kSenderPipeline[] =<br>
    "filesrc location=temple_of_love-<wbr>sisters_of_mercy.wav ! "<br>
    "wavparse ! "<br>
    "audioresample ! "<br>
    "audio/x-raw,format=S16LE ! "<br>
    "opusenc bandwidth=narrowband bitrate=16000 ! "<br>
    "rtpopuspay ! "<br>
    "tee name=t "<br>
    "t. ! "<br>
    "queue name=q0 ! "<br>
    "udpsink name=usink0 "<br>
    "t. !"<br>
    "queue name=q1 ! "<br>
    "udpsink name=usink1";<br>
<br>
void AudioSender::Initialize(<wbr>GSocket *gsocket) {<br>
  // Build the pipeline.<br>
  GstElement *pipebin =  CHECK_NOTNULL(gst_parse_<wbr>launch(pipeline_string(),<br>
nullptr));<br>
  set_pipebin(pipebin);<br>
  GstElement *udpsink = CHECK_NOTNULL(gst_bin_get_by_<wbr>name(GST_BIN(pipebin),<br>
"usink0"));<br>
  g_object_set(udpsink, "host", ip_address_.c_str(), "port", kPort,<br>
nullptr);<br>
  GstElement *queue =  CHECK_NOTNULL(gst_bin_get_by_<wbr>name(GST_BIN(pipebin),<br>
"q0"));<br>
  GstPad *pad = CHECK_NOTNULL(gst_element_get_<wbr>static_pad(queue, "src"));<br>
  gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER,<br>
                    reinterpret_cast<<wbr>GstPadProbeCallback>(Queue0_<wbr>cb),<br>
                    this, nullptr);<br>
  udpsink = CHECK_NOTNULL(gst_bin_get_by_<wbr>name(GST_BIN(pipebin), "usink1"));<br>
  g_object_set(udpsink, "host", ip_address_lte_.c_str(), "port", kPort,<br>
nullptr);<br>
  g_object_set(udpsink, "socket", gsocket, nullptr);<br>
  queue = CHECK_NOTNULL(gst_bin_get_by_<wbr>name(GST_BIN(pipebin), "q1"));<br>
  pad = CHECK_NOTNULL(gst_element_get_<wbr>static_pad(queue, "src"));<br>
  gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER,<br>
                    reinterpret_cast<<wbr>GstPadProbeCallback>(Queue1_<wbr>cb),<br>
                    this, nullptr);<br>
  gst_object_unref(udpsink);<br>
  gst_object_unref(queue);<br>
  gst_object_unref(pad);<br>
  // start playing<br>
  CHECK_NE(GST_STATE_CHANGE_<wbr>FAILURE,  gst_element_set_state(pipebin_<wbr>,<br>
GST_STATE_PLAYING));<br>
}<br>
<br>
GstPadProbeReturn AudioSender::Queue0_cb(<br>
    GstPad * /*pad*/, GstPadProbeInfo * /*info*/,<br>
    AudioSender *const audio_sender) {<br>
  if (audio_sender->state() == State::kInactive ||<br>
      audio_sender->mode_ == CommunicationMode::kLte) {<br>
    return GST_PAD_PROBE_DROP;<br>
  }<br>
  return GST_PAD_PROBE_OK;<br>
}<br>
<br>
GstPadProbeReturn AudioSender::Queue1_cb(<br>
    GstPad * /*pad*/, GstPadProbeInfo * /*info*/,<br>
    AudioSender *const audio_sender) {<br>
  if (audio_sender->state() == State::kInactive ||<br>
      audio_sender->mode_ == CommunicationMode::kHost) {<br>
    return GST_PAD_PROBE_DROP;<br>
  }<br>
  return GST_PAD_PROBE_OK;<br>
}<br>
<br>
Queue1_cb is called only once and GST_DEBUG says that it changed state to<br>
PAUSED.<br>
I tested pipeline with gst-launch and it seems does what I want.<br>
gstreamer-1.0<br>
How do I make all callbacks to be called?<br>
<br>
Thanks!<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://gstreamer-devel.966125.n4.nabble.com/probes-on-a-queue-element-pads-after-tee-elements-tp4683366.html" rel="noreferrer" target="_blank">http://gstreamer-devel.966125.<wbr>n4.nabble.com/probes-on-a-<wbr>queue-element-pads-after-tee-<wbr>elements-tp4683366.html</a><br>
Sent from the GStreamer-devel mailing list archive at Nabble.com.<br>
______________________________<wbr>_________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.<wbr>freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/gstreamer-<wbr>devel</a><br>
</blockquote></div><br></div></div></div>