<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin-top:0in;
        margin-right:0in;
        margin-bottom:8.0pt;
        margin-left:0in;
        line-height:106%;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:8.0pt;
        margin-left:.5in;
        mso-add-space:auto;
        line-height:106%;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst
        {mso-style-priority:34;
        mso-style-type:export-only;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        mso-add-space:auto;
        line-height:106%;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle
        {mso-style-priority:34;
        mso-style-type:export-only;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        mso-add-space:auto;
        line-height:106%;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast
        {mso-style-priority:34;
        mso-style-type:export-only;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:8.0pt;
        margin-left:.5in;
        mso-add-space:auto;
        line-height:106%;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">I am using the following C code pipeline to receive audio and video using rtpbin and to create an mp4 recording file. I have a pad-added callback attached to the rtpbin where I link the new dynamic pads as they are created.
<o:p></o:p></p>
<p class="MsoNormal">My development machine is windows 7 and I’m using GStreamer 1.10.4 with your windows pre-built binaries.
<o:p></o:p></p>
<p class="MsoListParagraphCxSpFirst" style="margin-left:0in;mso-add-space:auto"><o:p> </o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-left:27.0pt;mso-add-space:auto">
mp4mux name=mux ! filesink location=C:/my_dir/my_file.mp4 <o:p></o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-left:27.0pt;mso-add-space:auto">
sync=true <o:p></o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-left:27.0pt;mso-add-space:auto">
<o:p> </o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-left:27.0pt;mso-add-space:auto">
rtpbin latency=6000 name=rtpbin_A <o:p></o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-left:27.0pt;mso-add-space:auto">
<o:p> </o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-left:27.0pt;mso-add-space:auto">
udpsrc address="192.168.1.101" port=5018 <o:p></o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-left:27.0pt;mso-add-space:auto">
caps="application/x-rtp,media=video,clock-rate=90000,payload=97,encoding-name=VP8" !
<o:p></o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-left:27.0pt;mso-add-space:auto">
<o:p> </o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-left:27.0pt;mso-add-space:auto">
rtpbin_A.recv_rtp_sink_0 <o:p></o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-left:27.0pt;mso-add-space:auto">
rtpbin_A. ! rtpvp8depay ! avdec_vp8 output-corrupt=true ! videoconvert ! videorate ! videoscale !
<o:p></o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-left:27.0pt;mso-add-space:auto">
capsfilter caps="video/x-raw,height=288,width=352,framerate=30/1" ! <o:p></o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-left:27.0pt;mso-add-space:auto">
openh264enc ! h264parse ! queue ! mux. <o:p></o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-left:27.0pt;mso-add-space:auto">
<o:p> </o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-left:27.0pt;mso-add-space:auto">
<o:p> </o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-left:27.0pt;mso-add-space:auto">
udpsrc address="192.168.1.101" port=5020 <o:p></o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-left:27.0pt;mso-add-space:auto">
caps="application/x-rtp,media=audio,clock-rate=48000,encoding-name=OPUS,payload=96" !
<o:p></o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-left:27.0pt;mso-add-space:auto">
<o:p> </o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-left:27.0pt;mso-add-space:auto">
rtpbin_A.recv_rtp_sink_1 <o:p></o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-left:27.0pt;mso-add-space:auto">
rtpbin_A. ! rtpopusdepay ! opusdec ! audiorate ! <o:p></o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-left:27.0pt;mso-add-space:auto">
capsfilter caps="audio/x-raw,format=S16LE,rate=8000,channels=1" ! <o:p></o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-left:27.0pt;mso-add-space:auto">
voaacenc ! queue ! mux.<o:p></o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-left:27.0pt;mso-add-space:auto">
<o:p> </o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-left:0in;mso-add-space:auto">
<o:p> </o:p></p>
<p class="MsoListParagraphCxSpLast" style="margin-left:0in;mso-add-space:auto">The pipeline runs without errors under normal conditions and I can play the resulting mp4 recording just fine using the standard Windows media player. So far so good.
<o:p></o:p></p>
<p class="MsoNormal">However, here is the problem I’m having. The sender side that generates the audio and video for a recording session occasionally stops sending data for the original rtp streams and creates new rtp streams instead [same destination ip address
 and ports] to continue the recording session. The old stream is dead, no more packets from there. There’s a short gap in the data on the receiving side of about 3 seconds.
<o:p></o:p></p>
<p class="MsoNormal">From your documentation for the rtpbin element, I see that each rtp stream is demuxed based on the SSRC [sync source] id in the rtp packet header. Each data stream [audio and video] must have a unique SSRC id. A new pad is created using
 the rtp session number, SSRC id and payload type respectively as the pad name. <o:p>
</o:p></p>
<p class="MsoNormal">I see the first set of two dynamic pads for the original rtp streams come through ok in my pad-added callback. The new changed rtp streams will have different SSRC id numbers. When the rtpbin detects the new changed rtp streams, I also
 see the dynamic pads for the new streams in my pad-added callback. I take the following actions in my pad-added callback for the pads for the new changed rtp streams:
<o:p></o:p></p>
<p class="MsoListParagraphCxSpFirst">- Set pipeline to paused when the first new pad is received.
<o:p></o:p></p>
<p class="MsoListParagraphCxSpMiddle">- Unlink the old dynamic pads for the old rtp streams.
<o:p></o:p></p>
<p class="MsoListParagraphCxSpMiddle">- Re-link the new dynamic pads for the new changed rtp streams.
<o:p></o:p></p>
<p class="MsoListParagraphCxSpMiddle">- Set pipeline to playing after both new pads are re-linked.
<o:p></o:p></p>
<p class="MsoListParagraphCxSpLast"><o:p> </o:p></p>
<p class="MsoNormal">The pipeline appears to continue running ok in the playing state using the new pads for the new changed rtp streams. At the end of the recording session I try to stop the pipeline the in usual way [gst_element_send_event (pipeline, gst_event_new_eos());]
 but the pipeline never stops, it hangs. I see that the recording file has data but it’s unreadable, probably because the EOS didn’t go all the way through for some reason so the file does not finalize properly.
<o:p></o:p></p>
<p class="MsoNormal">I’m at a loss as to what to do next. Can anyone shed some more light on this problem? Do I have to do something more with the old pads either before or after unlinking them? Do I have to do anything for the downstream sink pads to which
 the new dynamic pads are being linked? <o:p></o:p></p>
<p class="MsoNormal">Thanks so much for your help, <o:p></o:p></p>
<p class="MsoNormal">Bill <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>