jack: allocate ring buffers before connecting
If the ring buffers are allocated after jack_activate(), mpd_jack_process() might segfault because it attempts to access them.
This commit is contained in:
parent
bbf0453709
commit
3a070d3d23
2
NEWS
2
NEWS
|
@ -34,6 +34,8 @@ ver 0.15 - (200?/??/??)
|
||||||
|
|
||||||
|
|
||||||
ver 0.14.2 (2009/??/??)
|
ver 0.14.2 (2009/??/??)
|
||||||
|
* audio outputs:
|
||||||
|
- jack: allocate ring buffers before connecting
|
||||||
|
|
||||||
|
|
||||||
ver 0.14.1 (2009/01/17)
|
ver 0.14.1 (2009/01/17)
|
||||||
|
|
|
@ -217,6 +217,9 @@ mpd_jack_connect(struct jack_data *jd, struct audio_format *audio_format)
|
||||||
|
|
||||||
jd->audio_format = audio_format;
|
jd->audio_format = audio_format;
|
||||||
|
|
||||||
|
jd->ringbuffer[0] = jack_ringbuffer_create(jd->ringbuffer_size);
|
||||||
|
jd->ringbuffer[1] = jack_ringbuffer_create(jd->ringbuffer_size);
|
||||||
|
|
||||||
if ((jd->client = jack_client_new(mpd_jack_name(jd))) == NULL) {
|
if ((jd->client = jack_client_new(mpd_jack_name(jd))) == NULL) {
|
||||||
g_warning("jack server not running?");
|
g_warning("jack server not running?");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -263,11 +266,6 @@ mpd_jack_connect(struct jack_data *jd, struct audio_format *audio_format)
|
||||||
if ( jd->output_ports[1] ) {
|
if ( jd->output_ports[1] ) {
|
||||||
const char *name = mpd_jack_name(jd);
|
const char *name = mpd_jack_name(jd);
|
||||||
|
|
||||||
jd->ringbuffer[0] = jack_ringbuffer_create(jd->ringbuffer_size);
|
|
||||||
jd->ringbuffer[1] = jack_ringbuffer_create(jd->ringbuffer_size);
|
|
||||||
memset(jd->ringbuffer[0]->buf, 0, jd->ringbuffer[0]->size);
|
|
||||||
memset(jd->ringbuffer[1]->buf, 0, jd->ringbuffer[1]->size);
|
|
||||||
|
|
||||||
port_name = g_malloc(sizeof(port_name[0]) * (7 + strlen(name)));
|
port_name = g_malloc(sizeof(port_name[0]) * (7 + strlen(name)));
|
||||||
|
|
||||||
sprintf(port_name, "%s:left", name);
|
sprintf(port_name, "%s:left", name);
|
||||||
|
|
Loading…
Reference in New Issue