Opened 15 years ago

Closed 15 years ago

#4825 closed bug (fixed)

BSoundPlayer segv

Reported by: Adek336 Owned by: nobody
Priority: normal Milestone: R1
Component: Kits/Media Kit Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

#include <Sound.h>
#include <SoundPlayer.h>
#include <Entry.h>


void playsound(const char *path) {
   BSound *sound;
   BSoundPlayer player;
   entry_ref ref;
   BEntry entry(path, true);
   BSoundPlayer::play_id id;

   if (entry.InitCheck() == B_OK) {
      if (entry.GetRef(&ref) == B_OK) {
         sound = new BSound(&ref);
         if (sound->InitCheck() == B_OK) {
            player.Start();
            player.SetVolume(1.0);
            id = player.StartPlaying(sound);
            sound->ReleaseRef();
            player.WaitForSound(id);
         }
      }
   }
}

int main()
{
    playsound("/boot/home/sample.wav");
    return 0;
}

Put a wave file as /boot/home/sample.wav, compile and run.

It either crashes or prints

...
WavReader::GetNextChunk: LAST BUFFER ERROR at time   1000000
...
Abort
...

and hangs.

Reproduced on Alpha 1, also on gcc4+2 hybrid hrev33542.

The playsound function comes from the Be Book http://www.haikudev.com/bebookpl/The%20Media%20Kit/SoundPlayer.html#BSoundPlayer

Change History (2)

comment:1 by marcusoverhagen, 15 years ago

Owner: changed from marcusoverhagen to nobody

comment:2 by mmlr, 15 years ago

Resolution: fixed
Status: newclosed

Fixed in hrev33705.

Note: See TracTickets for help on using tickets.