osxaudio: Share debug category in the internal coreaudio object

Make the internal coreaudio object output debug to the same
debug category by making it shared between code units.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5140>
This commit is contained in:
Jan Schmidt 2023-07-26 00:21:24 +10:00 committed by GStreamer Marge Bot
parent f5d2ea76b4
commit e22c7fb3e4
3 changed files with 28 additions and 29 deletions

View file

@ -24,8 +24,8 @@
#include "gstosxcoreaudio.h"
#include "gstosxcoreaudiocommon.h"
GST_DEBUG_CATEGORY_STATIC (osx_audio_debug);
#define GST_CAT_DEFAULT osx_audio_debug
GST_DEBUG_CATEGORY (osx_coreaudio_debug);
#define GST_CAT_DEFAULT osx_coreaudio_debug
G_DEFINE_TYPE (GstCoreAudio, gst_core_audio, G_TYPE_OBJECT);
@ -260,7 +260,7 @@ gst_core_audio_select_device (GstCoreAudio * core_audio)
void
gst_core_audio_init_debug (void)
{
GST_DEBUG_CATEGORY_INIT (osx_audio_debug, "osxaudio", 0,
GST_DEBUG_CATEGORY_INIT (osx_coreaudio_debug, "osxaudio", 0,
"OSX Audio Elements");
}

View file

@ -23,6 +23,9 @@
#include "gstosxcoreaudiocommon.h"
GST_DEBUG_CATEGORY_EXTERN (osx_coreaudio_debug);
#define GST_CAT_DEFAULT osx_coreaudio_debug
void
gst_core_audio_remove_render_callback (GstCoreAudio * core_audio)
{

View file

@ -1162,7 +1162,7 @@ gst_core_audio_initialize_impl (GstCoreAudio * core_audio,
_monitorize_spdif (core_audio);
} else {
OSStatus status;
UInt32 propertySize;
UInt32 propertySize = sizeof (*frame_size);
core_audio->stream_idx = 0;
if (!gst_core_audio_set_format (core_audio, format))
@ -1172,34 +1172,30 @@ gst_core_audio_initialize_impl (GstCoreAudio * core_audio,
format.mChannelsPerFrame, caps))
goto done;
if (core_audio->is_src) {
propertySize = sizeof (*frame_size);
// Attempt to configure the requested frame size if smaller than the device's
// This will apparently modify the size for all audio devices in the current process so should
// be done conservatively
if (frame_size != 0) {
guint32 cur_frame_size;
status = AudioUnitGetProperty (core_audio->audiounit, kAudioDevicePropertyBufferFrameSize, kAudioUnitScope_Global, 0, /* N/A for global */
&cur_frame_size, &propertySize);
if (!status && *frame_size < cur_frame_size) {
status = AudioUnitSetProperty (core_audio->audiounit, kAudioDevicePropertyBufferFrameSize, kAudioUnitScope_Global, 0, /* N/A for global */
frame_size, propertySize);
if (status) {
GST_WARNING_OBJECT (core_audio->osxbuf,
"Failed to set desired frame size of %u: %d", *frame_size,
(int) status);
}
// Attempt to configure the requested frame size if smaller than the device's
// This will apparently modify the size for all audio devices in the current process so should
// be done conservatively
if (frame_size != 0) {
guint32 cur_frame_size;
status = AudioUnitGetProperty (core_audio->audiounit, kAudioDevicePropertyBufferFrameSize, kAudioUnitScope_Global, 0, /* N/A for global */
&cur_frame_size, &propertySize);
if (!status && *frame_size < cur_frame_size) {
status = AudioUnitSetProperty (core_audio->audiounit, kAudioDevicePropertyBufferFrameSize, kAudioUnitScope_Global, 0, /* N/A for global */
frame_size, propertySize);
if (status) {
GST_WARNING_OBJECT (core_audio->osxbuf,
"Failed to set desired frame size of %u: %d", *frame_size,
(int) status);
}
}
status = AudioUnitGetProperty (core_audio->audiounit, kAudioDevicePropertyBufferFrameSize, kAudioUnitScope_Global, 0, /* N/A for global */
frame_size, &propertySize);
}
status = AudioUnitGetProperty (core_audio->audiounit, kAudioDevicePropertyBufferFrameSize, kAudioUnitScope_Global, 0, /* N/A for global */
frame_size, &propertySize);
if (status) {
GST_WARNING_OBJECT (core_audio->osxbuf, "Failed to get frame size: %d",
(int) status);
goto done;
}
if (status) {
GST_WARNING_OBJECT (core_audio->osxbuf, "Failed to get frame size: %d",
(int) status);
goto done;
}
}