Skip to content

"ofSoundStream::stop()" causes error if "ofSoundStream::start()" was called atleast 2 times in a row before #6246

@CertainCube

Description

@CertainCube

There is a way to crash the application by calling ofSoundStream::stop(), after calling ofSounStream::start() atleast two times in a row.

If you call the ofSoundStream::start(), after the soundstream is alreading running, it displays a console message saying:

RtApiWasapi::startStream: The stream is already running

Wich in my eyes is the right response. but if you then try to stop it by calling ofSoundStream::stop()
it crashes. This is something I could reproduce everytime I tried it this way.

Here is the simple code I used and how I tested it.

void ofApp::setup(){
	stream1.setup(this, 2, 0, 44100, 512, 4);
}
void ofApp::audioOut(float * buffer, int bufferSize, int nChannels)
{
	for (int i = 0; i < bufferSize; i++) {
	}
}
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
	switch (key)
	{
	case 's':
		stream1.start(); 
		break; 
	case 'p':
		stream1.stop(); 
		break;

	default:
		break;
	}
}

If I press ‘p’ after Startup, the soundstream will stop without error.
From this point i can start it again, pressing ‘s’.
I can repeat this procedure over and over again without errors.
Until I press ‘s’ when the soundstream is already running. Then I get an console output: RtApiWasapi::startStream: The stream is already running.
If I now press ‘p’ again, it will crash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions