[haiku-commits] haiku: hrev50081 - in src: add-ons/media/media-add-ons/tone_producer_demo kits/media

  • From: b.vitruvio@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 11 Feb 2016 19:24:35 +0100 (CET)

hrev50081 adds 2 changesets to branch 'master'
old head: b25d4dd1419dd7c1a6cd3bcbf576cb3b80cf85e0
new head: b1d006d7f83b94afe737c16304edb045671578ac
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=b1d006d7f83b+%5Eb25d4dd1419d

----------------------------------------------------------------------------

4666afbf4158: BMediaEventLooper: Revert recent timeout rework
  
  * While on my system it looked like to run well, it introduced
  a regression on some hardware. I'm reverting it as I don't have
  a better solution, with the difference that we will do that only
  for perfomance time events.
  * Fixes #12624.

b1d006d7f83b: ToneProducer: Try to don't force a framerate if possible

                                [ Dario Casalinuovo <b.vitruvio@xxxxxxxxx> ]

----------------------------------------------------------------------------

2 files changed, 8 insertions(+), 11 deletions(-)
.../media-add-ons/tone_producer_demo/ToneProducer.cpp   |  6 +++---
src/kits/media/MediaEventLooper.cpp                     | 13 +++++--------

############################################################################

Commit:      4666afbf4158537318134374e2230619249424e4
URL:         http://cgit.haiku-os.org/haiku/commit/?id=4666afbf4158
Author:      Dario Casalinuovo <b.vitruvio@xxxxxxxxx>
Date:        Thu Feb 11 17:26:39 2016 UTC

Ticket:      https://dev.haiku-os.org/ticket/12624

BMediaEventLooper: Revert recent timeout rework

* While on my system it looked like to run well, it introduced
a regression on some hardware. I'm reverting it as I don't have
a better solution, with the difference that we will do that only
for perfomance time events.
* Fixes #12624.

----------------------------------------------------------------------------

diff --git a/src/kits/media/MediaEventLooper.cpp 
b/src/kits/media/MediaEventLooper.cpp
index 0af1a72..dd6e430 100644
--- a/src/kits/media/MediaEventLooper.cpp
+++ b/src/kits/media/MediaEventLooper.cpp
@@ -217,7 +217,6 @@ BMediaEventLooper::ControlLoop()
        bigtime_t waitUntil = B_INFINITE_TIMEOUT;
        bool hasRealtime = false;
        bool hasEvent = false;
-       bool hasBooted = false;
 
        // While there are no events or it is not time for the earliest event,
        // process messages using WaitForMessages. Whenever this funtion times 
out,
@@ -274,14 +273,12 @@ BMediaEventLooper::ControlLoop()
                                fEventQueue.FirstEventTime(),
                                fEventLatency + fSchedulingLatency);
 
-                       // The first event we handle will have
-                       // a negative startup wait. In this case
-                       // we just check the port and let the
-                       // first event to be executed just now.
-                       if (!hasBooted && waitUntil < 0) {
+                       // TODO: At boot the wait time go
+                       // to negative depending on the system
+                       // speed, this should be fixed.
+                       if (waitUntil < 0)
                                waitUntil = 0;
-                               hasBooted = true;
-                       }
+
                } else if (!hasRealtime)
                        waitUntil = B_INFINITE_TIMEOUT;
 

############################################################################

Revision:    hrev50081
Commit:      b1d006d7f83b94afe737c16304edb045671578ac
URL:         http://cgit.haiku-os.org/haiku/commit/?id=b1d006d7f83b
Author:      Dario Casalinuovo <b.vitruvio@xxxxxxxxx>
Date:        Thu Feb 11 18:14:25 2016 UTC

ToneProducer: Try to don't force a framerate if possible

----------------------------------------------------------------------------

diff --git 
a/src/add-ons/media/media-add-ons/tone_producer_demo/ToneProducer.cpp 
b/src/add-ons/media/media-add-ons/tone_producer_demo/ToneProducer.cpp
index e4c8a0d..5fec579 100644
--- a/src/add-ons/media/media-add-ons/tone_producer_demo/ToneProducer.cpp
+++ b/src/add-ons/media/media-add-ons/tone_producer_demo/ToneProducer.cpp
@@ -68,10 +68,10 @@ ToneProducer::ToneProducer(BMediaAddOn* pAddOn)
        // initialize our preferred format object
        mPreferredFormat.type = B_MEDIA_RAW_AUDIO;
        mPreferredFormat.u.raw_audio.format = 
media_raw_audio_format::B_AUDIO_FLOAT;
-       mPreferredFormat.u.raw_audio.frame_rate = 44100;                // 
measured in Hertz
        mPreferredFormat.u.raw_audio.byte_order = (B_HOST_IS_BENDIAN) ? 
B_MEDIA_BIG_ENDIAN : B_MEDIA_LITTLE_ENDIAN;
 
-       // we'll use the consumer's preferred buffer size, if any
+       // we'll use the consumer's preferred buffer size and framerate, if any
+       mPreferredFormat.u.raw_audio.frame_rate = 
media_raw_audio_format::wildcard.frame_rate;
        mPreferredFormat.u.raw_audio.buffer_size = 
media_raw_audio_format::wildcard.buffer_size;
 
        // 20sep99: multiple-channel support
@@ -375,7 +375,7 @@ ToneProducer::PrepareToConnect(const media_source& what, 
const media_destination
        //       Connect() doesn't take kindly to a frame_rate of 0.
 
        if(format->u.raw_audio.frame_rate == 
media_raw_audio_format::wildcard.frame_rate) {
-               format->u.raw_audio.frame_rate = 
mPreferredFormat.u.raw_audio.frame_rate;
+               format->u.raw_audio.frame_rate = 44100.0f;
                FPRINTF(stderr, "\tno frame rate provided, suggesting %.1f\n", 
format->u.raw_audio.frame_rate);
        }
        if(format->u.raw_audio.channel_count == 
media_raw_audio_format::wildcard.channel_count) {


Other related posts:

  • » [haiku-commits] haiku: hrev50081 - in src: add-ons/media/media-add-ons/tone_producer_demo kits/media - b . vitruvio