# Odd behaviour

**URL:** <https://discourse.libsdl.org/t/odd-behaviour/5917>\
**Category:** SDL Development\
**Created:** [January 28, 2002, 4:38am UTC](https://discourse.libsdl.org/t/odd-behaviour/5917 "2002-01-28T04:38:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peter\_Surda](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/p/958977/32.png) [@Peter\_Surda](https://discourse.libsdl.org/u/Peter_Surda)\
**Post date:** [January 28, 2002, 4:38am UTC](https://discourse.libsdl.org/t/odd-behaviour/5917/1 "2002-01-28T04:38:10Z")

</div>

Hi guys!

I have encountered a very strange problem. When I watch videos with avifile, X  
eats too much CPU (up to 25%). I thought this was because DMA wasn’t working,  
but it IS working.

What’s strange, when watching the SAME file with mplayer (either with -vo xv  
or -vo sdl:x11), X only eats about 1%. And when watching a DVD with gvlc  
(which is even more data per second), X eats even less, like 0.3%.

I tried disabling dri, but that only worsens the problem: gvlc -\> X eats 30%,  
aviplay -\> X eats 50%.

I thought it was a problem with SDL so I upgraded to 1.2.2 and recompiled  
avifile (I’m using the 20011220 snapshot), with no change.

So I dug deeper. It seems that calling SDL\_DisplayYUVOverlay is causing this  
(if I comment it in renderer.cpp, X eats 0% but of course nothing gets  
displayed). But mplayer ALSO calls it and X is behaving normally. I’m  
completely puzzled. I tried current CVS aviplay as well, situation unchanged.

Could it perhaps be the O(1) scheduler? I don’t wanna reboot to older kernel,  
I need my box up…

I have a 2.4.18-pre4+O(1)+preempt, RH 7.1, duron 900, ATI AIW 128, XF86  
4.1.99.1, current CVS gatos and gatos’ drm. mtrr is on.

WTF is happening?

Bye,

Peter Surda (Shurdeek) \<@Peter\_Surda\>, ICQ 10236103, +436505122023–  
Give a man a fish and you feed him for a day;  
teach him to use the Net and he won’t bother you for weeks.  
-------------- next part --------------  
A non-text attachment was scrubbed…  
Name: not available  
Type: application/pgp-signature  
Size: 232 bytes  
Desc: not available  
URL: [http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20020128/87fd8b8a/attachment.pgp](http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20020128/87fd8b8a/attachment.pgp)

---

<div class="post-metadata">

**Author:** ![Vladimir\_Dergachev](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/v/b9e5f3/32.png) [@Vladimir\_Dergachev](https://discourse.libsdl.org/u/Vladimir_Dergachev)\
**Post date:** [January 28, 2002, 4:38am UTC](https://discourse.libsdl.org/t/odd-behaviour/5917/2 "2002-01-28T04:38:01Z")

</div>

> Hi guys!
> 
> I have encountered a very strange problem. When I watch videos with avifile, X  
> eats too much CPU (up to 25%). I thought this was because DMA wasn’t working,  
> but it IS working.
> 
> What’s strange, when watching the SAME file with mplayer (either with -vo xv  
> or -vo sdl:x11), X only eats about 1%. And when watching a DVD with gvlc  
> (which is even more data per second), X eats even less, like 0.3%.
> 
> I tried disabling dri, but that only worsens the problem: gvlc → X eats 30%,  
> aviplay → X eats 50%.
> 
> I thought it was a problem with SDL so I upgraded to 1.2.2 and recompiled  
> avifile (I’m using the 20011220 snapshot), with no change.
> 
> So I dug deeper. It seems that calling SDL\_DisplayYUVOverlay is causing this  
> (if I comment it in renderer.cpp, X eats 0% but of course nothing gets  
> displayed). But mplayer ALSO calls it and X is behaving normally. I’m  
> completely puzzled. I tried current CVS aviplay as well, situation unchanged.
> 
> Could it perhaps be the O(1) scheduler? I don’t wanna reboot to older kernel,  
> I need my box up…
> 
> I have a 2.4.18-pre4+O(1)+preempt, RH 7.1, duron 900, ATI AIW 128, XF86  
> 4.1.99.1, current CVS gatos and gatos’ drm. mtrr is on.
> 
> WTF is happening?

Can you check thread usage in both apps ? It could be bogus cpu time  
counting again.

```
                   Vladimir DergachevOn Mon, 28 Jan 2002, Peter Surda wrote:

```

> Bye,
> 
> Peter Surda (Shurdeek) , ICQ 10236103, +436505122023
> 
> –  
> Give a man a fish and you feed him for a day;  
> teach him to use the Net and he won’t bother you for weeks.

---

<div class="post-metadata">

**Author:** ![deek](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/d/eb9ed0/32.png) [@deek](https://discourse.libsdl.org/u/deek)\
**Post date:** [January 28, 2002, 4:38am UTC](https://discourse.libsdl.org/t/odd-behaviour/5917/3 "2002-01-28T04:38:18Z")

</div>

This seems to be application dependant, vice, a driver [GATOS]  
implementation. Applications are historically notorious  
for substantially different performance depending  
upon how they interact with different aspects  
of the supporting libraries.

Peter Surda scribbled:

> Hi guys!
> 
> I have encountered a very strange problem. When I watch videos with avifile, X  
> eats too much CPU (up to 25%). I thought this was because DMA wasn’t working,  
> but it IS working.
> 
> What’s strange, when watching the SAME file with mplayer (either with -vo xv  
> or -vo sdl:x11), X only eats about 1%. And when watching a DVD with gvlc  
> (which is even more data per second), X eats even less, like 0.3%.
> 
> I tried disabling dri, but that only worsens the problem: gvlc → X eats 30%,  
> aviplay → X eats 50%.
> 
> I thought it was a problem with SDL so I upgraded to 1.2.2 and recompiled  
> avifile (I’m using the 20011220 snapshot), with no change.
> 
> So I dug deeper. It seems that calling SDL\_DisplayYUVOverlay is causing this  
> (if I comment it in renderer.cpp, X eats 0% but of course nothing gets  
> displayed). But mplayer ALSO calls it and X is behaving normally. I’m  
> completely puzzled. I tried current CVS aviplay as well, situation unchanged.
> 
> Could it perhaps be the O(1) scheduler? I don’t wanna reboot to older kernel,  
> I need my box up…
> 
> I have a 2.4.18-pre4+O(1)+preempt, RH 7.1, duron 900, ATI AIW 128, XF86  
> 4.1.99.1, current CVS gatos and gatos’ drm. mtrr is on.
> 
> WTF is happening?
> 
> Bye,
> 
> Peter Surda (Shurdeek) , ICQ 10236103, +436505122023
> 
> –  
> Give a man a fish and you feed him for a day;  
> teach him to use the Net and he won’t bother you for weeks.

Interesting stats though…–  
Issued as is without warranty of any kind; without even the  
implied warranty of merchantability or fitness for a  
particular purpose - GNU General Public License

## the unofficial official GATOS irc at: [irc.openprojects.net](http://irc.openprojects.net) #gatos-ati # Ross Coleman

---

<div class="post-metadata">

**Author:** ![Eugene\_Kuznetsov](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/e/958977/32.png) [@Eugene\_Kuznetsov](https://discourse.libsdl.org/u/Eugene_Kuznetsov)\
**Post date:** [January 28, 2002, 4:39am UTC](https://discourse.libsdl.org/t/odd-behaviour/5917/4 "2002-01-28T04:39:00Z")

</div>

Hello Peter,

Sunday, January 27, 2002, 3:36:14 PM, you wrote:

PS\> Hi guys!

PS\> I have encountered a very strange problem. When I watch videos with avifile, X  
PS\> eats too much CPU (up to 25%). I thought this was because DMA wasn’t working,  
PS\> but it IS working.

PS\> So I dug deeper. It seems that calling SDL\_DisplayYUVOverlay is causing this  
PS\> (if I comment it in renderer.cpp, X eats 0% but of course nothing gets  
PS\> displayed). But mplayer ALSO calls it and X is behaving normally. I’m  
PS\> completely puzzled. I tried current CVS aviplay as well, situation unchanged.

Do mplayer and aviplay work in the same color space?–  
Best regards,  
Eugene mailto:@Eugene_Kuznetsov

---

<div class="post-metadata">

**Author:** ![Herbert\_Ayers](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/h/ea5d25/32.png) [@Herbert\_Ayers](https://discourse.libsdl.org/u/Herbert_Ayers)\
**Post date:** [January 28, 2002, 11:19am UTC](https://discourse.libsdl.org/t/odd-behaviour/5917/5 "2002-01-28T11:19:01Z")

</div>

Does sdl support playing avi’s? If so, what do I need  
to do it?

Herbert  
— Eugene Kuznetsov   
wrote:\> Hello Peter,

> Sunday, January 27, 2002, 3:36:14 PM, you wrote:
> 
> PS\> Hi guys!
> 
> PS\> I have encountered a very strange problem. When  
> I watch videos with avifile, X  
> PS\> eats too much CPU (up to 25%). I thought this  
> was because DMA wasn’t working,  
> PS\> but it IS working.
> 
> PS\> So I dug deeper. It seems that calling  
> SDL\_DisplayYUVOverlay is causing this  
> PS\> (if I comment it in renderer.cpp, X eats 0% but  
> of course nothing gets  
> PS\> displayed). But mplayer ALSO calls it and X is  
> behaving normally. I’m  
> PS\> completely puzzled. I tried current CVS aviplay  
> as well, situation unchanged.
> 
> Do mplayer and aviplay work in the same color space?
> 
> –  
> Best regards,  
> Eugene  
> mailto:ekuznetsov at [divxnetworks.com](http://divxnetworks.com)
> 
> * * *
> 
> SDL mailing list  
> SDL at [libsdl.org](http://libsdl.org)  
> [http://www.libsdl.org/mailman/listinfo/sdl](http://www.libsdl.org/mailman/listinfo/sdl)

* * *

Do You Yahoo!?  
Great stuff seeking new owners in Yahoo! Auctions!

> **[Yahoo Shopping - We'll track the prices for you!](https://shopping.yahoo.com/)**
>
> Discover deals, product reviews, and compare prices on your favorite items. Plus, shop stores like Walmart, Nordstrom Rack, Amazon and more.

---

<div class="post-metadata">

**Author:** ![chris.2.dobbs\_at\_bt](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@chris.2.dobbs\_at\_bt](https://discourse.libsdl.org/u/chris.2.dobbs_at_bt)\
**Post date:** [August 6, 2007, 2:33pm UTC](https://discourse.libsdl.org/t/odd-behaviour/5917/6 "2007-08-06T14:33:07Z")

</div>

All,  
I have a strange issue with SDL 1.2.11 coupled with SDL\_audioin.

I have an app which uses SDL to handle DSP output and input. For ages I  
used portAudio to deal with the input as previous versions of SDL did  
not support microphone so I ended up using SDL for output and potrAudio  
for input, no problems there apart from the obvious. Sometime ago I  
discovered the SDL\_audioin project and decided to use that for the mic  
and it seemed to work ok apart from some very odd behaviour;  
Occasionally I don’t seem to be able to open the microphone using the  
function (from the SDL\_audioin API)

rtnCode=SDL\_OpenAudioIn(fmt,&fmtAct);

Where I am requesting

Frequency:8000  
Sample rate:256

which seems to work fine for portAudio everytime. Using SDL I notice  
that approx. 1 in 5 times the code above fails stating the requested  
spec. is not available but offers the following spec:

Frequency:8000  
Sample rate:170

My machine is running Debian etch on a Dell 6000 using ALSA sound  
drivers.

Any ideas anyone as I am out of ideas - I have checked that nothing else  
is interferring with the dsp but I have noticed the problem is more  
apparent when I have previously used portAudio - maby it’s locking the  
device and timeing out…?

Regards,  
-Chris
