fedora 24
obsolete weakness #261

1

Weakness Breakdown


Definition:

An obsolete weakness occurs when someone uses deprecated or obsolete functions when building a system. As a programming language evolves, some functions occasionally become obsolete.

Warning code(s):

This C routine is considered obsolete.

File Name:

Ardour-5.10.0/libs/backends/coreaudio/coreaudio_pcmio.cc

Context:

The highlighted line of code below is the trigger point of this particular Fedora 24 obsolete weakness.

 CoreAudioPCM::set_device_sample_rate_id (AudioDeviceID id, float rate, bool input)
{
	std::vector<int>::iterator intIter;
	OSStatus err;
	UInt32 size = 0;

	if (current_sample_rate_id(id, input) == rate) {
		return 0;
	}

	Float64 newNominalRate = rate;
	size = sizeof (Float64);

	err = SetPropertyWrapper(id, NULL, 0, input, kAudioDevicePropertyNominalSampleRate, size, &newNominalRate);
	if (err != noErr) {
		fprintf(stderr, "CoreAudioPCM: failed to set samplerate\n");
		return 0;
	}

	int timeout = 3000; // 3 sec
	while (--timeout > 0) {
		if (current_sample_rate_id(id, input) == rate) {
			break;
		}
		Glib::usleep (1000);
	}
	fprintf(stderr, "CoreAudioPCM: CoreAudio: Setting SampleRate took %d ms.\n", (3000 - timeout));

	if (timeout == 0) {
		fprintf(stderr, "CoreAudioPCM: CoreAudio: Setting SampleRate timed out.\n");
		return -1;
	}

	return 0;
}

int
CoreAudioPCM::set_device_sample_rate (uint32_t device_id, float rate, bool input)
{
	if (device_id >= _n_devices) {
		return 0;
	}
	return set_device_sample_rate_id(_device_ids[device_id], rate, input);
}

void
CoreAudioPCM::discover()
{
	OSStatus err;
	UInt32 size = 0; 

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.