openframeworks / openframeworks/openFrameworks
Heap Corruption using ofSoundStream on Windows
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 9
Description
Hello,
I’ve noticed that setting the ofSoundStream bufferSize above 128 causes a heap corruption on some Windows systems, while it works fine on other Windows systems. All other platforms work fine.
I did not find any similarities on the system where the heap corruption occurs.
Sample code to reproduce:
#include "ofApp.h"
ofSoundStream soundStream;
//--------------------------------------------------------------
void ofApp::setup(){
// crashes on some systems if > 128)
int bufferSize = 129;
soundStream.setup(this, 2, 0, 44100, bufferSize, 4);
}
//--------------------------------------------------------------
void ofApp::update(){
}
//--------------------------------------------------------------
void ofApp::draw(){
static int i = 0;
// wait a little bit, dont stop instantly after setup
if (i == 200) {
soundStream.stop(); //heap corruption!
}
i++;
}
//--------------------------------------------------------------
void ofApp::keyPressed (int key){
}
//--------------------------------------------------------------
void ofApp::keyReleased (int key){
}
//--------------------------------------------------------------
void ofApp::mouseMoved(int x, int y ){
}
//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mouseReleased(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mouseEntered(int x, int y){
}
//--------------------------------------------------------------
void ofApp::mouseExited(int x, int y){
}
//--------------------------------------------------------------
void ofApp::windowResized(int w, int h){
}
//--------------------------------------------------------------
void ofApp::gotMessage(ofMessage msg){
}
//--------------------------------------------------------------
void ofApp::dragEvent(ofDragInfo dragInfo){
}
Is this an openFrameworks bug?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Use the provided C++ sample as the reproduction entry point: call ofSoundStream::setup with bufferSize 129 on affected Windows systems, wait, then call stop(). Trace the Windows audio-stream setup and shutdown path; done means reproducing and preventing heap corruption for buffer sizes above 128 without breaking other platforms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- audio-video-rtc, desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100