Add malloc for pulseaudio buffer attributes

This commit is contained in:
Emmanuel Milou
2008-07-03 17:12:57 -04:00
parent 382883bbc5
commit 589aad478f

View File

@ -81,18 +81,18 @@ AudioStream::createStream( pa_context* c )
assert(pa_sample_spec_valid(&sample_spec));
assert(pa_channel_map_valid(&channel_map));
pa_buffer_attr* attributes = (pa_buffer_attr*)malloc( sizeof(pa_buffer_attr) );
if( !( s = pa_stream_new( c, _streamDescription.c_str() , &sample_spec, &channel_map ) ) )
_debug("%s: pa_stream_new() failed : %s\n" , _streamDescription.c_str(), pa_strerror( pa_context_errno( c)));
assert( s );
if( _streamType == PLAYBACK_STREAM ){
pa_buffer_attr* attributes;
//attributes->maxlength = 66500;
//attributes->tlength = 44100;
//attributes->prebuf = 10000;
//attributes->minreq = 882;
pa_stream_connect_playback( s , NULL , NULL ,
attributes->maxlength = 66500;
attributes->tlength = 44100;
attributes->prebuf = 10000;
attributes->minreq = 882;
pa_stream_connect_playback( s , NULL , attributes,
PA_STREAM_INTERPOLATE_TIMING,
&_volume, NULL);
//pa_cvolume_set(&cv, sample_spec.channels , PA_VOLUME_NORM) , NULL );
@ -109,6 +109,8 @@ AudioStream::createStream( pa_context* c )
pa_stream_set_state_callback( s , stream_state_callback, NULL);
free(attributes);
return s;
}