<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:0in;
margin-bottom:.0001pt;
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;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@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">Hi everyone,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I am using the Windows build of Gstreamer 1.4.5 to add media player capabilities to an application. I am using an appsrc in my pipeline to take in audio data from my application. I am using the appsrc in push mode with the “need-data”,
“enough-data” and “seek-data” signals.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The issue I am currently experiencing happens when the pipeline is playing and I try to seek to a certain time. When the seek completes and playback resumes, the pipeline will be playing audio from several seconds past the timestamp that
I told the pipeline to seek to. <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I am using the following call to initiate the seek on the pipeline:
<o:p></o:p></p>
<p class="MsoNormal"><i>gboolean seek_result = gst_element_seek(m_Pipeline, 1.0, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET, gst_util_uint64_scale_int(time, GST_SECOND, FILETIME_SECOND), GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);<o:p></o:p></i></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">After this I see the following happen:<o:p></o:p></p>
<p class="MsoNormal">The appsrc emits the “seek-data” signal and triggers my callback.<o:p></o:p></p>
<p class="MsoNormal">The pipeline goes to the PAUSED state.<o:p></o:p></p>
<p class="MsoNormal">I see a “reset-time” message posted to the bus.<o:p></o:p></p>
<p class="MsoNormal">The appsrc emits the “need-data” signal and triggers my callback.<o:p></o:p></p>
<p class="MsoNormal">Once the “need-data” callback has been triggered I begin pushing data in from the new time that I tried to seek to.<o:p></o:p></p>
<p class="MsoNormal">I am pushing the data in 1 second chunks as that is how I receive it in my application.<o:p></o:p></p>
<p class="MsoNormal">After pushing in about 8 seconds worth of data I see an “async-done” message posted to the bus.<o:p></o:p></p>
<p class="MsoNormal">The pipeline then goes to the PLAYING state and I can hear audio being played back.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The problem is that when playback resumes the audio that is being played starts from that last 8<sup>th</sup> second that was pushed in. However, the playback time reported back to me by :
<o:p></o:p></p>
<p class="MsoNormal"><i>gst_element_query_position(m_Pipeline, fmt, ¤t);<o:p></o:p></i></p>
<p class="MsoNormal">shows the timestamp that I tried to seek to.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">For example, to put some numbers with it. I am playing a file and at the 4 second mark I tell it to seek ahead by 5 seconds to the 9 second mark. The above series of events happen and I can see the audio chunks for the 9, 10, 11, 12,
13, 14, 15 and 16 second marks being pushed into the appsrc. When the pipeline goes back to the playing state, it reports that it is playing back from the 9 second mark, but I am hearing the audio from the 16 second mark.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thinking that perhaps the data is somehow being discarded while the pipeline is in the middle of seeking, I have tried holding off on pushing data to the appsrc until after I receive the “async-done” message on the bus, but if I do not
push any data to the appsrc I never receive that message and never enter a PLAYING state. (Which I suppose makes sense since it has no data to play.)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">For the record my pipeline looks like the following:<o:p></o:p></p>
<p class="MsoNormal">A bin containing (appsrc ! decodebin ! queue) ! audiomixer ! audioconvert ! audioresample ! autoaudiosink<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The purpose of the bin containing the (appsrc ! decodebin ! queue) is so that if I have multiple audio channels I can create several of these bins and input them into the audiomixer. However, for the purposes of debugging this seeking
issue I am only using a single audio source and therefore a single bin.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">If anyone can provide any insight into why I am seeing the behavior that I am it would be greatly appreciated.<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">Matt Zawojski<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>