[mythtv] Patch: Fix segfault in bio2jack
Ed Wildgoose
lists at wildgooses.com
Sat Feb 19 03:50:54 UTC 2005
This fixes a (long standing) segfault when the JACK device is invalid or
just not available.
Could someone please commit to CVS
[Chris, could you please consider committing this upstream as well (if
you are happy)]
Thanks
Ed W
-------------- next part --------------
Index: libs/libmyth/bio2jack.c
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/bio2jack.c,v
retrieving revision 1.4
diff -u -r1.4 bio2jack.c
--- libs/libmyth/bio2jack.c 5 Feb 2005 07:45:50 -0000 1.4
+++ libs/libmyth/bio2jack.c 19 Feb 2005 03:44:20 -0000
@@ -864,13 +915,18 @@
}
/* display a trace of the output ports we found */
- for(i = 0; ports[i]; i++)
+ if(ports) {
+ for(i = 0; ports[i]; i++)
TRACE("ports[%d] = '%s'\n", i, ports[i]);
+ } else {
+ i = 0; // No ports found
+ }
/* see if we have enough ports */
if(i < drv->num_output_channels)
{
TRACE("ERR: jack_get_ports() failed to find ports with jack port flags of 0x%lX'\n", drv->jack_port_flags);
+ JACK_CloseDevice(drv, TRUE);
return ERR_PORT_NOT_FOUND;
}
@@ -893,13 +949,13 @@
{
TRACE("jack_get_ports() portname %d of '%s\n", i, drv->jack_port_name[i]);
ports = jack_get_ports(drv->client, drv->jack_port_name[i], NULL, drv->jack_port_flags);
- TRACE("ports[%d] = '%s'\n", 0, ports[0]); /* display a trace of the output port we found */
if(!ports)
{
ERR("jack_get_ports() failed to find ports with jack port flags of 0x%lX'\n", drv->jack_port_flags);
return ERR_PORT_NOT_FOUND;
}
+ TRACE("ports[%d] = '%s'\n", 0, ports[0]); /* display a trace of the output port we found */
/* connect the port */
TRACE("jack_connect() to port %d('%p')\n", i, drv->output_port[i]);
Index: libs/libmyth/audiooutputjack.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/audiooutputjack.cpp,v
retrieving revision 1.3
diff -u -r1.3 audiooutputjack.cpp
--- libs/libmyth/audiooutputjack.cpp 26 Jan 2005 05:54:05 -0000 1.3
+++ libs/libmyth/audiooutputjack.cpp 19 Feb 2005 03:48:10 -0000
@@ -70,7 +70,11 @@
VERBOSE(VB_AUDIO, QString("Failed to open device at requested samplerate. Retrying"));
err = JACK_OpenEx(&audioid, 16, (unsigned long *) &audio_samplerate, audio_channels, audio_channels,
&jack_port_name, jack_port_name_count, jack_port_flags);
- }
+ } else if (err == ERR_PORT_NOT_FOUND) {
+ VERBOSE(VB_IMPORTANT, QString("Error opening audio device (%1), "
+ " Port not found.").arg(audiodevice));
+ perror(audiodevice.ascii());
+ }
if (err != 0)
{
More information about the mythtv-dev
mailing list