Граф коммитов

1057 Коммитов

Автор SHA1 Сообщение Дата
Chun-Min Chang 92e2e116cf minor style fix 2019-10-21 15:51:54 -07:00
Chun-Min Chang 5163960234 Update authors 2019-10-21 15:38:42 -07:00
Chun-Min Chang fdb0b1d54c
Make utf8_from_cfstringref work with empty CFStringRef (#20)
* Make utf8_from_cfstringref work with empty CFStringRef

Passing a CFStringRef whose internal string is ""(empty) to
utf8_from_cfstringref will hit an assertion that asserts the passed
CFStringRef cannot be empty. Instead of using the assertion, an empty u8
vec should be returned directly when the passed CFStringRef is empty,
which will yeild an empty String or CString in to_string or to_cstring.

* Move the static strings to their corresponding tests
2019-10-21 14:08:57 -07:00
Chun-Min Chang a39bf5f71f Remove a fixed issue 2019-10-15 14:30:36 -07:00
Chun-Min Chang fd242eabb9 Remove done tasks 2019-10-10 10:22:29 -07:00
Chun-Min Chang a74cbea19f
Merge property_address to device_property (#19)
* Store value instead of reference of property address in device_property_listener

* Remove {INPUT, OUTPUT}_DATA_SOURCE_PROPERTY_ADDRESS

The {INPUT, OUTPUT}_DATA_SOURCE_PROPERTY_ADDRESS values can be generated
by get_property_address so they can be removed.

* Remove DEVICE_IS_ALIVE_PROPERTY_ADDRESS

The value of DEVICE_IS_ALIVE_PROPERTY_ADDRESS can be generated by
get_property_address with propery parameters

* Remove DEVICES_PROPERTY_ADDRESS

The value of DEVICES_PROPERTY_ADDRESS can be generated by
get_property_address with proper parameters

* Remove DEFAULT_{INPUT, OUTPUT}_DEVICE_PROPERTY_ADDRESS

The valus of DEFAULT_{INPUT, OUTPUT}_DEVICE_PROPERTY_ADDRESS can be
generated by get_property_address with proper parameters
2019-10-10 09:44:34 -07:00
Chun-Min Chang 4cc1f77f1b
Avoid forming the deadlock (#18)
* Stop input AudioUnit in input callback

Stopping the input AudioUnit in output callback may cause a deadlock
(see BMO 1574632 for more details). To avoid forming the deadlock, the
input AudioUnit should be stopped in input callback.
Stopping the AudioUnit requires locking the mutex inside AudioUnit
framework for the AudioUnit that we want to stop. When input callback is
called, the mutex for the input AudioUnit (inside the AudioUnit
framework) must be held in the input callback thread, so it's safe to
stop the input AudioUnit in the input callback thread.

* Allow stream draining be set for input-only stream

A side effect comes with this change: For a input-only stream, the
state-changed callback notifying the draining state will be fired in the
next callback after the stream is drained, instead of firing immediately
upon the stream is drained.

* Remove the state callback in the handler

* Notify drained-state upon input-only stream is drained

In the previous changes, for an input-only stream, the notification of
drained-state is fired in the next input callback rather than fired upon
the stream is drained in the current callback. This patch correct the
timing for state-changed callback so the state-changed callback can be
fired upon the stream is drained. Just like what we did before the
previous changes.
2019-10-10 09:44:16 -07:00
Chun-Min Chang da708eecc1
Change the policy of aggregate usage (#13)
* Add a function to check if a device is an input or output

* Update the policy to use aggregate device

* Remove the unnecessary parameters

The parameters, {input, output}_device in should_use_aggregate_device
are same as self.{input, output}_device so there is no need to pass
those data.

* TODO: test case

* Explain why instead of what of the new aggregate device policy

* Update todo: Using ringbuf maybe
2019-10-04 09:23:59 -07:00
Paul Adenot f9085b4734
Merge pull request #15 from padenot/fix-draining
Fix draining
2019-10-03 10:08:08 +02:00
Chun-Min Chang 3f2512bf49
Update dependencies (#17)
* Use official coreaudio-sys

* Remove duplicate tests

`cargo test --verbose` will be called in run_test.sh so there is no need
to call `cargo test --verbose` in the .travis.yml
2019-10-02 14:26:04 -07:00
Paul Adenot 36fab5d2e1 Use the number of channels of the stream 2019-10-02 13:20:21 +02:00
Paul Adenot f221fb369d Fix draining 2019-09-30 18:11:17 +02:00
Chun-Min Chang 98d670dceb
Replace io_side by DeviceType (#12)
* Replace io_side by DeviceType

* Revise error message for audiounit_set_channel_layout

* Revise error message for get_buffer_size

* Revise error message for set_buffer_size

* Rephrase the error messages in set_buffer_size_sync
2019-09-26 16:29:07 -07:00
Chun-Min Chang 3cf148f341 TODO: Update the policy to use aggregate device 2019-08-30 12:36:37 -07:00
Chun-Min Chang 521538a6ad Remove test_device_channels_in_scope import 2019-08-26 12:46:08 -07:00
Paul Adenot 7f04be4c1e Remove panning utilities from cubeb (#10)
* Remove panning utilities from cubeb

* Use cubeb-rs 0.6 where the panning code has been removed
2019-08-23 11:24:36 -07:00
Paul Adenot 1fea5b298e Protect against integer underflow in latency computation. (#11) 2019-08-22 13:44:26 -07:00
Chun-Min Chang 4225ab9f27 Update README and TODOs 2019-08-19 15:05:32 -07:00
Chun-Min Chang 81d005d3fe
Simplify the APIs for querying device information (#8)
* Replace audiounit_get_default_datasource by get_device_source

* Prevent memory leak in current_device

Memory will leak when the macOS device only has input device. In that
case, the ownership of the CString for the input source will be
transferred and never be retaken. The changes make sure the
current_device call is always successful hence the ownership of the
memory can always be retaken by calling device_destroy.

* Replace audiounit_get_acceptable_latency_range by get_device_buffer_frame_size_range

Most code in audiounit_get_acceptable_latency_range is duplicate of the
get_device_buffer_frame_size_range.

* Create get_device_latency

* Create get_device_streams

* Create get_stream_latency

* Create get_device_sample_rate

With the new introduced API, the nominal sample rate of the device can
be queried wihtout using audiounit_get_available_samplerate, which gives
additional information but it's not often useful.

* Replace audiounit_get_available_samplerate by get_range_of_sample_rates

* Replace audiounit_get_device_presentation_latency by get_presentation_latency

Add logs when the API calls fail before returning the default latency

* Move APIs for AudioDeviceID together

* Create get_device_stream_format

* Simplify preferred_sample_rate

* Simplify get_channel_count

* Shorten the variable name
2019-08-19 08:48:38 -07:00
Chun-Min Chang 71faddb88a Update to Rust 1.37 2019-08-16 08:46:59 -07:00
Chun-Min Chang dec166394c Remove done task 2019-08-15 16:46:35 -07:00
Chun-Min Chang 420b2c779d Update README 2019-08-14 16:24:18 -07:00
Chun-Min Chang 4c462097e3 Add more info to the device source tests 2019-08-12 16:51:24 -07:00
Chun-Min Chang 8d5ee7f254 Move tests for device APIs from tests/api.rs to tests/device_property.rs 2019-08-12 16:28:38 -07:00
Chun-Min Chang 9f48feefab Update todo 2019-08-12 16:25:42 -07:00
Chun-Min Chang 29aabffddc Re-organize the tests for the aggregate device 2019-08-12 11:35:06 -07:00
Chun-Min Chang 8336ace6bb Revise the comments about tests for aggregate device 2019-08-12 11:35:00 -07:00
Chun-Min Chang ed29d9bf44 Remove unused functions 2019-08-12 11:34:57 -07:00
Chun-Min Chang 534bd2dd47 Add missing AggregateDevice::destroy_device in the tests 2019-08-12 11:34:52 -07:00
Chun-Min Chang 25149a0bf5 Revise the tests for AggregateDevice::destroy_device 2019-08-12 11:34:48 -07:00
Chun-Min Chang bdf5649004 Revise the tests for AggregateDevice::activate_clock_drift_compensation 2019-08-12 11:34:16 -07:00
Chun-Min Chang b03b23a61c Revise the tests for AggregateDevice::set_master_device 2019-08-12 11:34:11 -07:00
Chun-Min Chang 630bd25807 Revice the tests for AggregateDevice::set_sub_devices 2019-08-12 11:34:07 -07:00
Chun-Min Chang 684950ef82 Revise the tests for AggregateDevice::get_sub_devices 2019-08-12 11:34:00 -07:00
Chun-Min Chang 84557c337f Move lines of the test for AggregateDevice::create_blank_device_sync 2019-08-12 11:33:56 -07:00
Chun-Min Chang ac069624d4 Clean the test for AggregateDevice::create_blank_device_sync 2019-08-12 11:33:50 -07:00
Chun-Min Chang b132620728
Simplify the APIs to get the device info from hardware (#6)
* Replace audiounit_create_device_from_hwdev by create_cubeb_device_info

* Replace get_device_name by get_device_uid

* Replace audiounit_get_channel_count by get_channel_count

* Set the devid of cubeb_device_info anyway

* Rewrite get_device_uid to get device info by scope

* Create get_device_source to get device info

* Create get_device_source_name to get device info

* Create get_property_address to generate property address

* Create get_device_name to get device info

* Create get_device_label to get device info

* Implement StringRef

* Apply StringRef in device property utils

* Create get_device_manufacturer to get device info

* Move audiounit_strref_to_cstr_utf8 to test-only file

* Make device_type more type-sensible

* Move the position of the max_channels assignment

* Create get_device_buffer_frame_size_range to get device info

* Use DeviceType in audiounit_get_available_samplerate

* Use DeviceType in audiounit_get_device_presentation_latency

* Remove unnecessary code

* Add tests for device property utils

* Return OSStatus when failing to get device info

* update todo list

* Print error directly when failing to get device vendor info
2019-08-12 11:17:32 -07:00
Chun-Min Chang 47d77c1193 Remove the duplicate tests
The device change callback triggered by input alive status change will
be tested in the tests that simulate unplugging the alive input devices
on the running streams.
2019-08-05 17:26:49 -07:00
Chun-Min Chang 4b948c1ea5 Revice comments for tests in device_change.rs 2019-08-05 17:26:45 -07:00
Chun-Min Chang fba64b2899 Add tests that simulate uplugging devices on active streams
Create bunch of tests that can simulate uplugging the running devices on
the active streams. The device uplugged could be default device or not.
There is a time setting in those test to wait for the stream
reinitialization. If it's 0, then the stream is likely to be destroyed
before being reinitialized.
2019-08-05 17:26:41 -07:00
Chun-Min Chang 09d466823c Set default callbacks in the tests for checking device_changed_callback
- Enable the tests based on test_get_stream_with_device_changed_callback
to start playing the stream
- Correct the error that using differnt stream format on input and
output side. They must be same, which is a requirement when using the
resampler.
2019-08-05 17:26:36 -07:00
Chun-Min Chang 50458ddd14 Remove unnecessary parentheses 2019-08-01 16:46:27 -07:00
Chun-Min Chang 4ca0a1ca49 Rename the tests for AggregateDevice::get_sub_devices 2019-08-01 16:14:38 -07:00
Paul Adenot ee0f981423 Port of the fix made in the C++ backend to the Rust backend (#5)
* Port the output latency fix from the C++ backend to the Rust backend

A direct port of this: c64d242bec

* Port of the minimum latency fix from the C++ backend to the Rust backend.

A port of this: abbdaa2f8e

* Address review comments

* rustfmt
2019-08-01 10:57:48 -07:00
Chun-Min Chang 7a25242c30 Update todo list 2019-07-31 09:53:46 -07:00
Chun-Min Chang 728b366c28 Add device info in log when initializing AudioUnit 2019-07-31 09:53:46 -07:00
Chun-Min Chang cec587b72f Save the input device settings before closing the stream
The input device setting for reinitializing the stream should be saved
before closing the stream, or the settings will be gone after stream
closing.
2019-07-31 09:53:46 -07:00
Chun-Min Chang 313603c065 Return error from get_sub_devices if the device doesn't exist 2019-07-31 09:53:46 -07:00
Chun-Min Chang 367aab8ec7 Move get_sub_devices to aggregate_device module
get_sub_devices is only called in aggregate_device module.
2019-07-31 09:53:46 -07:00
Chun-Min Chang 14de8f154e
Merge pull request #3 from ChunMinChang/bmo1570077
Calculate input_frames of duplex stream after counting missing frames
2019-07-31 09:30:44 -07:00