6

i am trying to add a udp src dynamically to a running pipeline. e.g

  void addAudioSource(std::string const ip, int const port, int const payloadtype)
  {
    std::string description = "autoaudiosrc ! queue ! audioconvert !  audio/x-raw,rate=16000 ! avenc_g722 ! rtpg722pay";

    audiosrc = Gst::Parse::create_bin(description, true);

    pipeline->add(audiosrc);
    {
      auto srcpad = audiosrc->get_static_pad("src");
      auto sinkpad = rtpbin->get_request_pad("send_rtp_sink_1");
      srcpad->link(sinkpad);
    }

    rtpudpsinkAudio->set_property("host", ip);
    rtpudpsinkAudio->set_property("port", port);
    rtpudpsinkAudio->set_property("sync",true);
    rtpudpsinkAudio->set_property("async",false);
    pipeline->add(rtpudpsinkAudio);
    {
      auto srcpad = rtpbin->get_static_pad("send_rtp_src_1");
      auto sinkpad = rtpudpsinkAudio->get_static_pad("sink");
      srcpad->link(sinkpad);
    }
    pipeline->set_state(Gst::State::STATE_PLAYING);  
}

--- and ---

  void addAudioSink(std::string const ip, int const port, int const payloadtype)
  {
    char const caps[] = "application/x-rtp,media=(string)audio,clock-rate=(int)8000,payload=(int)%d";
    char buffer[128] = {0};
    sprintf(buffer,caps,payloadtype);
    pipeline->add(rtpudpsrcAudio);
    rtpudpsrcAudio->set_property("caps",
        Gst::Caps::create_from_string(buffer));
    {
      auto srcpad = rtpudpsrcAudio->get_static_pad("src");
      auto sinkpad = rtpbin->get_request_pad("recv_rtp_sink_1");
      srcpad->link(sinkpad);
    }
    pipeline->set_state(Gst::State::STATE_PLAYING);
  }

individually when i am not calling the other function the pipeline works fine.

if i try to call addAudioSink some time after addAudioSource , i always get this error when i debug through the application

0:00:18.190302584 [334m 6945 [00m 0x555556669450 [36mINFO   [00m [00;01;34m           GST_EVENT gstevent.c:814:gst_event_new_caps: [00m creating caps event application/x-rtp, media=(string)audio, clock-rate=(int)8000, payload=(int)9, ssrc=(uint)1388635048
0:00:18.190323116 [334m 6945 [00m 0x555556669450 [36mINFO   [00m [00m             basesrc gstbasesrc.c:2965:gst_base_src_loop:<rtpudpsrcaudio-AVP-d80367f9-8361-458d-a52d-23db4d185996> [00m pausing after gst_pad_push() = not-linked
0:00:18.190333169 [334m 6945 [00m 0x555556669450 [33;01mWARN   [00m [00m             basesrc gstbasesrc.c:3055:gst_base_src_loop:<rtpudpsrcaudio-AVP-d80367f9-8361-458d-a52d-23db4d185996> [00m error: Internal data stream error.
0:00:18.190337616 [334m 6945 [00m 0x555556669450 [33;01mWARN   [00m [00m             basesrc gstbasesrc.c:3055:gst_base_src_loop:<rtpudpsrcaudio-AVP-d80367f9-8361-458d-a52d-23db4d185996> [00m error: streaming stopped, reason not-linked (-1)
0:00:18.190350252 [334m 6945 [00m 0x555556669450 [36mINFO   [00m [00;01;31;47m    GST_ERROR_SYSTEM gstelement.c:2145:gst_element_message_full_with_details:<rtpudpsrcaudio-AVP-d80367f9-8361-458d-a52d-23db4d185996> [00m posting message: Internal data stream error.
0:00:18.190358717 [334m 6945 [00m 0x555556669450 [36mINFO   [00m [00;01;31;47m    GST_ERROR_SYSTEM gstelement.c:2172:gst_element_message_full_with_details:<rtpudpsrcaudio-AVP-d80367f9-8361-458d-a52d-23db4d185996> [00m posted error message: Internal data stream error.

the other thing is that this pipeline works most of the time. i am only hit by this error when i debug through the application and sometimes when on release build.

The only issue that i have been able to find out is. sometimes it says rtpssrcdemux0:src_2345243 not linked, and then udpsrc fails with gst_pad_push() = not-linked. there is this issue that i dont understand, that the pipeline works most of the time, it fails for 25 % of time.

please help

gst
  • 1,251
  • 1
  • 14
  • 32
Ankur
  • 205
  • 4
  • 15
  • did you check if the caps are compatible, before linking them? Also `individually when i am not calling the other function the pipeline works fine.`, this is not clear. Which function are you talking about? – gst Aug 08 '18 at 15:38
  • Yes caps are compatible. If i call addAudioSrc after addAudiosink. Everything works fine. If i call addAudiosink sometime after addAudiosrc , the link always succeeds. But not-linked is fired after receiving firstpacket. This only happens 25% of time when i run the executable. But almost always if i run it under gdb – Ankur Aug 09 '18 at 17:18

0 Answers0