<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" 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 11 (filtered medium)">
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="country-region"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="City"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="PlaceType"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="PlaceName"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="place"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
pre
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:Arial;
        color:windowtext;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Hello,<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Sorry for this not being in a thread. I have officially
turned off digest to allow individual replies, so this should be the last time
a new thread is opened for the same question.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Ross, I read the suggested archived response and it did
explain slightly what is required to be done, however I am still a little
unsure of how I can achieve this. I will explain a little more detail about how
I have things setup and maybe this will help you to point me in the right
direction.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>I have a filter design where information is captured from a
camera, processed and then streamed out to the network using RTSP and
multicast. We are trying to use multiple cameras as well as multiple streams.
With one stream our while loop which constantly polls inside the
doGetNextFrame() function worked fine, however with two streams running, one of
the streams gets a distorted which we believe is due to our polling (high CPU
usage). Our class which is a subclass of both FramedSource and our own Filter
class, which implements threading, has an input queue associated with it. The queue
is designed such that if nothing is present it will return null. In all the
classes implementing filter, we have a wait() call to our pthread wrapper
class. Where the problem occurs is live is not using our threading model and
therefore this design will not work. How we did set it up was to just not call
our start() and allow live to take care of everything with a simple:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>while(pkt != null)<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pkt
= buffer-&gt;getPacket();<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>deliverFrame();<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>within the doGetNextFrame. As you can see this is a serious
polling problem. So we attempted to just read the packet test if null and if so
return. However this does not reschedule the calling of doGetNextFrame. What I can
do and think may work is implement the run() function of our threading model,
have a wait, which will be signaled when something is added to the buffer.
However I do not know how to schedule the calling of the next doGetNextFrame. I
am assuming the code is something similar to:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>next() = envir.taskScheduler().scheduleDelayedTask(0,
(TaskFunc*)afterGetting,this);<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>No mater what I try it does not seem to work. Is there a
simple way my run function can schedule the calling of doGetNextFrame? As well
would it be an issue in the code if I call the scheduling more then once when
one is already scheduled? For instance if I get two frames, I schedule the
doGetNextFrame for the first frame and schedule the second before the first is completed
or even started? Also should the frame be processed and a afterGetting be
scheduled and my code schedule a doGetNextFrame, would any problems ensue?<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Hope this gives you a little more insight into my
requirements and what I hope to accomplish. I am sure it is something small I am
missing, or looking over to schedule it. Once again thanks for all your help
and timely reply to my queries.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<div>

<p class=MsoNormal><strong><b><font size=3 face=Arial><span style='font-size:
12.0pt;font-family:Arial'>______________________________________</span></font></b></strong><o:p></o:p></p>

<p class=MsoNormal><b><font size=3 face=Arial><span lang=EN-CA
style='font-size:12.0pt;font-family:Arial;font-weight:bold'>Drew Ostheimer</span></font></b><o:p></o:p></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-CA style='font-size:
10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><i><font size=2 face=Arial><span lang=EN-CA
style='font-size:10.0pt;font-family:Arial;font-style:italic'>Computer
Engineering Undergraduate Student,</span></font></i><o:p></o:p></p>

<p class=MsoNormal><st1:place w:st="on"><st1:PlaceName w:st="on"><i><font
  size=2 face=Arial><span lang=EN-CA style='font-size:10.0pt;font-family:Arial;
  font-style:italic'>Concordia</span></font></i></st1:PlaceName><i><font
 size=2 face=Arial><span lang=EN-CA style='font-size:10.0pt;font-family:Arial;
 font-style:italic'> <st1:PlaceType w:st="on">University</st1:PlaceType></span></font></i></st1:place><i><font
size=2 face=Arial><span lang=EN-CA style='font-size:10.0pt;font-family:Arial;
font-style:italic'>,</span></font></i><o:p></o:p></p>

<p class=MsoNormal><st1:City w:st="on"><i><font size=2 face=Arial><span
 lang=EN-CA style='font-size:10.0pt;font-family:Arial;font-style:italic'>Montreal</span></font></i></st1:City><i><font
size=2 face=Arial><span lang=EN-CA style='font-size:10.0pt;font-family:Arial;
font-style:italic'> <st1:country-region w:st="on"><st1:place w:st="on">Canada</st1:place></st1:country-region>.</span></font></i><o:p></o:p></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>&nbsp;<o:p></o:p></span></font></p>

<p class=MsoNormal><i><font size=2 face=Arial><span lang=EN-CA
style='font-size:10.0pt;font-family:Arial;font-style:italic'>Quote: &quot;I've
seen recently on a software package: Requires</span></font></i><o:p></o:p></p>

<p class=MsoNormal><i><font size=2 face=Arial><span lang=EN-CA
style='font-size:10.0pt;font-family:Arial;font-style:italic'>Windows 2000 or
better. So I installed Linux.&#8221;</span></font></i><o:p></o:p></p>

<p class=MsoNormal><strong><b><font size=3 face=Arial><span lang=EN-CA
style='font-size:12.0pt;font-family:Arial'>______________________________________</span></font></b></strong><o:p></o:p></p>

</div>

<div style='mso-element:para-border-div;border:none;border-bottom:solid windowtext 1.0pt;
padding:0in 0in 1.0pt 0in'>

<p class=MsoNormal style='border:none;padding:0in'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><o:p>&nbsp;</o:p></span></font></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<pre><font size=2 face="Courier New"><span style='font-size:10.0pt'>&gt;<i><span
style='font-style:italic'>In a current school project I am using FFMPEG and LIVE to stream an<o:p></o:p></span></i></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'>&gt;<i><span
style='font-style:italic'>MPEG-4 stream. As each component is connected with Buffers, the<o:p></o:p></span></i></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'>&gt;<i><span
style='font-style:italic'>doGetNextFrame retrieves the next frame to send from there. If no frame<o:p></o:p></span></i></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'>&gt;<i><span
style='font-style:italic'>exists NULL is returned.<o:p></o:p></span></i></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'>&gt;<i><span
style='font-style:italic'><o:p>&nbsp;</o:p></span></i></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'>&gt;<i><span
style='font-style:italic'>If within the doGetNextFrame function there is a loop such that it<o:p></o:p></span></i></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'>&gt;<i><span
style='font-style:italic'>waits for a non null value (Polling the buffer), everything streams<o:p></o:p></span></i></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'>&gt;<i><span
style='font-style:italic'>okay with high CPU loads. What I would like to do is make this a non<o:p></o:p></span></i></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'>&gt;<i><span
style='font-style:italic'>Blocking piece of code as is suggested by the comments in FramedSource.<o:p></o:p></span></i></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'>Basically, you need to make the arrival of new data an 'event', and <o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'>process it within the event loop.<o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'>Without knowing more about how your data arrives, it's hard to say <o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'>more.&nbsp; But the following answer (from last November) should help you:<o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'><a
href="http://lists.live555.com/pipermail/live-devel/2005-November/003543.html">http://lists.live555.com/pipermail/live-devel/2005-November/003543.html</a><o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Ross Finlayson<o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Live Networks, Inc. (LIVE555.COM)<o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<a
href="http://www.live555.com/">http://www.live555.com/</a>&gt;<o:p></o:p></span></font></pre>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

</div>

</body>

</html>