[haiku-commits] haiku: hrev53395 - src/kits/game

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 22 Aug 2019 23:22:54 -0400 (EDT)

hrev53395 adds 1 changeset to branch 'master'
old head: 478ea251528764ed0c8e1a968734f62b6bba6ef2
new head: 759ee24c4c1722813609c3b7c77fabef275b02bf
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=759ee24c4c17+%5E478ea2515287

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

759ee24c4c17: Game Kit: do not allocate BBuffers before initializing the Media 
Kit
  
  The port pool now being created in BMediaRoster init, we must make sure
  the media roster is initialized before doing anything else.
  
  Change-Id: I5a3cc61c993e9be4078772bbf341b637d951d239
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/1734
  Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

                             [ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]

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

Revision:    hrev53395
Commit:      759ee24c4c1722813609c3b7c77fabef275b02bf
URL:         https://git.haiku-os.org/haiku/commit/?id=759ee24c4c17
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Thu Aug 22 16:18:59 2019 UTC
Committer:   waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Fri Aug 23 03:22:49 2019 UTC

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

1 file changed, 8 insertions(+), 2 deletions(-)
src/kits/game/GameSoundDevice.cpp | 10 ++++++++--

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

diff --git a/src/kits/game/GameSoundDevice.cpp 
b/src/kits/game/GameSoundDevice.cpp
index edfdafc23b..63188bb791 100644
--- a/src/kits/game/GameSoundDevice.cpp
+++ b/src/kits/game/GameSoundDevice.cpp
@@ -146,6 +146,9 @@ BGameSoundDevice::CreateBuffer(gs_id* sound, const 
gs_audio_format* format,
        if (frames <= 0 || !sound)
                return B_BAD_VALUE;
 
+       // Make sure BMediaRoster is created before we AllocateSound()
+       BMediaRoster* roster = BMediaRoster::Roster();
+
        status_t err = B_MEDIA_TOO_MANY_BUFFERS;
        int32 position = AllocateSound();
 
@@ -153,7 +156,7 @@ BGameSoundDevice::CreateBuffer(gs_id* sound, const 
gs_audio_format* format,
                fSounds[position] = new SimpleSoundBuffer(format, data, frames);
 
                media_node systemMixer;
-               BMediaRoster::Roster()->GetAudioMixer(&systemMixer);
+               roster->GetAudioMixer(&systemMixer);
                err = fSounds[position]->Connect(&systemMixer);
        }
 
@@ -171,6 +174,9 @@ BGameSoundDevice::CreateBuffer(gs_id* sound, const void* 
object,
        if (!object || !sound)
                return B_BAD_VALUE;
 
+       // Make sure BMediaRoster is created before we AllocateSound()
+       BMediaRoster* roster = BMediaRoster::Roster();
+
        status_t err = B_MEDIA_TOO_MANY_BUFFERS;
        int32 position = AllocateSound();
 
@@ -179,7 +185,7 @@ BGameSoundDevice::CreateBuffer(gs_id* sound, const void* 
object,
                        inBufferFrameCount, inBufferCount);
 
                media_node systemMixer;
-               BMediaRoster::Roster()->GetAudioMixer(&systemMixer);
+               roster->GetAudioMixer(&systemMixer);
                err = fSounds[position]->Connect(&systemMixer);
        }
 


Other related posts: