<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:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
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;}
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;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
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-AU link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal>Dear all,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I am trying to get an appsrc working for a sparse stream using GAP events between buffers with Gstreamer 1.16.1. Unfortunately I am hitting a brick wall whatever I try, so any help would be greatly appreciated.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>The pipeline comprises of a standard audio file replay chain in combination with a simple appsrc to appsink chain for a sparse stream of metadata related to the audio.<o:p></o:p></p><p class=MsoNormal>The latter is very much like a captions stream. Both chains are in in single pipeline. For example:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>filesrc ... ! audio/x-mulaw,rate=8000,channels=1 ! mulawdec ! audioconvert ! audioresample ! autoaudiosink<o:p></o:p></p><p class=MsoNormal>appsrc | appsink<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>The audio is 10sec long and plays fine (in all scenarios that I list below) for 10 sec, however I cannot get the metadata part (appsrc to appsink) to work. The metadata comprises if 2 packets of text, one at 500ms and one at 9500ms. The metadata is 200 to 300 bytes.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I am using the “need data” signal in the appsrc to either create a GAP event or a Buffer with data. This is what I have tried and the results:-<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Scenario 1:<o:p></o:p></p><p class=MsoNormal>On the first “need data” signal in appsrc I create a GAP event with PTS=0 and duration of 500000000 (500ms as ns) and send the event on the src pad of the appsrc. The idea is to tell the pipeline that there will not be any Buffers for 500ms.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>In this case the appsrc does not get another “need data” signal so the code does not do anything else and the appsink does not get any Buffers with data. I was expecting a “need data” signal when the pipeline reaches PTS of 500ms.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Scenario 2:<o:p></o:p></p><p class=MsoNormal>On the first “need data” signal in appsrc I create a Buffer with data and with PTS=500000000 (500ms as ns) and duration 0 and send it.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>This buffer is delivered to the appsink at about the right time (some 500ms after the audio starts playing).<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>On the second “need data” signal (which arrives around after 500ms) in appsrc I create a GAP event with PTS=500000000 (500ms as ns) and duration of 9000000000 (9000ms as ns) and send the event on the src pad of the appsrc. The idea is to tell the pipeline that there will not be any Buffers for 9000ms.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>From this point on the appsrc does not get a “need data” signal any more so the 2nd metadata buffer is never created and sent.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Scenario 3:<o:p></o:p></p><p class=MsoNormal>On the first “need data” signal in appsrc I create a Buffer with data with PTS=500000000 (500ms as ns) and duration 1000000 (1ms as ns) and send it. Unlike scenario 2, note that this buffer has duration of 1ms instead of 0ms.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>This buffer is delivered to the appsink at about the right time (some 500ms after the audio starts playing).<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>On the second “need data” signal (which arrives around after 500ms) in appsrc I create a GAP event with PTS=501000000 (501ms as ns) and duration of 8999000000 (8999ms as ns) and send the event on the src pad of the appsrc. The idea is to tell the pipeline that there will not be any Buffers for 8999ms (9000 – 1).<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>From this point on the appsrc does not get a “need data” signal any more so the 2nd metadata buffer is never created and sent.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>The appsrc configuration is as follows (default values used for the properties that are not listed):<o:p></o:p></p><p class=MsoNormal>stream-type = 1 (seekable)<o:p></o:p></p><p class=MsoNormal>format = 3 (time)<o:p></o:p></p><p class=MsoNormal>is-live = false<o:p></o:p></p><p class=MsoNormal>duration = (10sec as ns)<o:p></o:p></p><p class=MsoNormal>emit-signals = true<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>It appears that appsrc stops getting “need data” signals once I send the first GAP event!?<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Any help with the issues that I am facing would be greatly appreciated. Also examples on how to use GAP events correctly would be greatly appreciated. I have already looked at suggestions posted to the list to use GAP events with 1sec duration, however none work for me.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Thank you<o:p></o:p></p><p class=MsoNormal>Emil<o:p></o:p></p><p class=MsoNormal><b><span lang=EN-CA style='font-size:9.0pt;color:#1F497D;mso-fareast-language:EN-GB'>--<o:p></o:p></span></b></p><p class=MsoNormal><b><span lang=EN-CA style='font-size:9.0pt;color:#1F497D;mso-fareast-language:EN-GB'>Emil Andonov<o:p></o:p></span></b></p><p class=MsoNormal><b><span lang=EN-CA style='font-size:9.0pt;color:#1F497D;mso-fareast-language:EN-GB'>Prolancer Pty Ltd<o:p></o:p></span></b></p></div></body></html>