Ticket #64 (closed defect: fixed)

Opened 8 months ago

Last modified 7 months ago

error opening multiple streams on the same device

Reported by: bjornroche Owned by: bjornroche
Priority: major Milestone: V19-PREVIEW1
Component: host-api-coreaudio Version: 1.0
Keywords: xrun multiple streams Cc:

Description (last modified by bjornroche) (diff)

When I try to open multiple output streams simultaneously with the same device, I get an error in this call:

#if 0

/* -- add listener for dropouts -- */ ERR_WRAP( AudioDeviceAddPropertyListener?( *audioDevice,

0, outStreamParams ? false : true, kAudioDeviceProcessorOverload, xrunCallback, (void *)stream) );

#endif

which apparently was a fairly recent addition. With that code commented out, I can open multiple simultaneous streams and they mix perfectly.

Attachments

ticket64.patch (8.8 kB) - added by bjornroche 7 months ago.
possible patch for this issue

Change History

Changed 8 months ago by bjornroche

  • status changed from new to assigned
  • description modified (diff)

The issue here is probably that coreAudio doesn't like having the same listener applied multiple times to the same device. A check will have to be added for that and some sort of multiplexing will be needed so each stream can be notified of xrun conditions when they are detected.

Changed 7 months ago by bjornroche

Brenton Partridge asked:

More long-term, not knowing that much about the CoreAudio? code, could we just add the dropout listener for the first stream opened to the device, and automatically not listen for dropouts on subsequent streams to the device?

To which I replied:

If you think about it for a moment the problem is a bit more complex. Say the user opens a stream on device 1. Okay, so PortAudio puts a listener on device 1. Next, say the user opens another stream on device 1. At this point, we can't add another listener to device 1, because the OS will get upset (That's the error everyone's seeing). We have to keep track ourselves. Now if the user closes a stream, we have to know how many streams are left on a given device, so that when the last stream on a given device is closed we can stop listening, so we don't get spurious messages about a device under/overrunning. Also, we need to make sure that our one listener per device manages to distribute xrun messages to all streams that are using the device, because that is what the API calls for. A simple linked list or resizable array will solve the issue, I think, but it'll take time to write it and test it. This is not a feature that seems critical to anyone -- especially with an easy workaround when it causes real problems -- so I haven't made it a priority. Again, I'm happy to accept patches.

Changed 7 months ago by bjornroche

possible patch for this issue

Changed 7 months ago by bjornroche

  • status changed from assigned to closed
  • resolution set to fixed

Should be fixed in revision 1316, though still needs thorough testing.

Note: See TracTickets for help on using tickets.