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

615 Коммитов

Автор SHA1 Сообщение Дата
Matthew Gregan 239b521c98 Bug 1612139 - Unship libcubeb's obsolete AudioTrack backend. r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D61399

--HG--
extra : moz-landing-system : lando
2020-02-03 10:04:53 +00:00
Matthew Gregan a362a200e2 Bug 1611658 - Unship libcubeb's C PulseAudio backend in favour of Rust. r=achronop
Differential Revision: https://phabricator.services.mozilla.com/D61080

--HG--
extra : moz-landing-system : lando
2020-01-26 11:09:27 +00:00
Alex Chronopoulos 513727e5d9 Bug 1610527 - Update cubeb from upstream to d4b23d1. r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D60518

--HG--
extra : moz-landing-system : lando
2020-01-22 13:59:51 +00:00
Alex Chronopoulos c75f44d0cb Bug 1610527 - Remove unnecessary patches from import script. r=padenot
`disable-assert.patch` is nor needed because the change has been merged upstream.
`revert-optimization.patch` is not needed because we want to undo the revert since this import attemptts to fix the crash.

Differential Revision: https://phabricator.services.mozilla.com/D60517

--HG--
extra : moz-landing-system : lando
2020-01-22 13:59:44 +00:00
Noemi Erli 6d247d8611 Backed out 2 changesets (bug 1610527) for causinf Linux debug and opt bustages in test_resampler.cpp a=backout
Backed out changeset 850bc97c56ab (bug 1610527)
Backed out changeset 71299532eee6 (bug 1610527)
2020-01-22 00:31:11 +02:00
Alex Chronopoulos cf314b852f Bug 1610527 - Update cubeb from upstream to 6cdf2fd. r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D60518

--HG--
extra : moz-landing-system : lando
2020-01-21 15:32:54 +00:00
Alex Chronopoulos d46188be61 Bug 1610527 - Remove unnecessary patches from import script. r=padenot
`disable-assert.patch` is nor needed because the change has been merged upstream.
`revert-optimization.patch` is not needed because we want to undo the revert since this import attemptts to fix the crash.

Differential Revision: https://phabricator.services.mozilla.com/D60517

--HG--
extra : moz-landing-system : lando
2020-01-21 15:33:02 +00:00
Alex Chronopoulos 236f6c237f Bug 1604117 - Backout cubeb commit aa63601. r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D59674

--HG--
extra : moz-landing-system : lando
2020-01-13 13:09:39 +00:00
Alex Chronopoulos c7942e4cd7 Bug 1603384 - Update cubeb from upstream to aa63601. r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D56872

--HG--
extra : moz-landing-system : lando
2019-12-12 15:24:23 +00:00
Mike Hommey 7f4fff1db4 Bug 1601859 - Vendor cubeb-pulse-rs. r=kinetik
This technically breaks mach vendor rust because of the missing
licenses, but this will be fixed subsequently.

Differential Revision: https://phabricator.services.mozilla.com/D56161

--HG--
rename : media/libcubeb/cubeb-pulse-rs/AUTHORS => third_party/rust/cubeb-pulse/AUTHORS
rename : media/libcubeb/cubeb-pulse-rs/Cargo.toml => third_party/rust/cubeb-pulse/Cargo.toml
rename : media/libcubeb/cubeb-pulse-rs/LICENSE => third_party/rust/cubeb-pulse/LICENSE
rename : media/libcubeb/cubeb-pulse-rs/README.md => third_party/rust/cubeb-pulse/README.md
rename : media/libcubeb/cubeb-pulse-rs/src/backend/context.rs => third_party/rust/cubeb-pulse/src/backend/context.rs
rename : media/libcubeb/cubeb-pulse-rs/src/backend/cork_state.rs => third_party/rust/cubeb-pulse/src/backend/cork_state.rs
rename : media/libcubeb/cubeb-pulse-rs/src/backend/intern.rs => third_party/rust/cubeb-pulse/src/backend/intern.rs
rename : media/libcubeb/cubeb-pulse-rs/src/backend/mod.rs => third_party/rust/cubeb-pulse/src/backend/mod.rs
rename : media/libcubeb/cubeb-pulse-rs/src/backend/stream.rs => third_party/rust/cubeb-pulse/src/backend/stream.rs
rename : media/libcubeb/cubeb-pulse-rs/src/capi.rs => third_party/rust/cubeb-pulse/src/capi.rs
rename : media/libcubeb/cubeb-pulse-rs/src/lib.rs => third_party/rust/cubeb-pulse/src/lib.rs
rename : media/libcubeb/cubeb-pulse-rs/pulse-ffi/Cargo.toml => third_party/rust/pulse-ffi/Cargo.toml
rename : media/libcubeb/cubeb-pulse-rs/pulse-ffi/src/ffi_funcs.rs => third_party/rust/pulse-ffi/src/ffi_funcs.rs
rename : media/libcubeb/cubeb-pulse-rs/pulse-ffi/src/ffi_types.rs => third_party/rust/pulse-ffi/src/ffi_types.rs
rename : media/libcubeb/cubeb-pulse-rs/pulse-ffi/src/lib.rs => third_party/rust/pulse-ffi/src/lib.rs
rename : media/libcubeb/cubeb-pulse-rs/pulse-rs/Cargo.toml => third_party/rust/pulse/Cargo.toml
rename : media/libcubeb/cubeb-pulse-rs/pulse-rs/src/context.rs => third_party/rust/pulse/src/context.rs
rename : media/libcubeb/cubeb-pulse-rs/pulse-rs/src/error.rs => third_party/rust/pulse/src/error.rs
rename : media/libcubeb/cubeb-pulse-rs/pulse-rs/src/lib.rs => third_party/rust/pulse/src/lib.rs
rename : media/libcubeb/cubeb-pulse-rs/pulse-rs/src/mainloop_api.rs => third_party/rust/pulse/src/mainloop_api.rs
rename : media/libcubeb/cubeb-pulse-rs/pulse-rs/src/operation.rs => third_party/rust/pulse/src/operation.rs
rename : media/libcubeb/cubeb-pulse-rs/pulse-rs/src/proplist.rs => third_party/rust/pulse/src/proplist.rs
rename : media/libcubeb/cubeb-pulse-rs/pulse-rs/src/stream.rs => third_party/rust/pulse/src/stream.rs
rename : media/libcubeb/cubeb-pulse-rs/pulse-rs/src/threaded_mainloop.rs => third_party/rust/pulse/src/threaded_mainloop.rs
rename : media/libcubeb/cubeb-pulse-rs/pulse-rs/src/util.rs => third_party/rust/pulse/src/util.rs
extra : moz-landing-system : lando
2019-12-11 20:57:35 +00:00
Mike Hommey 1c4ef0191c Bug 1601859 - Vendor cubeb-coreaudio. r=padenot
This technically breaks mach vendor rust because of the missing
licenses, but this will be fixed subsequently.

Differential Revision: https://phabricator.services.mozilla.com/D56160

--HG--
rename : media/libcubeb/cubeb-coreaudio-rs/coreaudio-sys-utils/Cargo.toml => third_party/rust/coreaudio-sys-utils/Cargo.toml
rename : media/libcubeb/cubeb-coreaudio-rs/coreaudio-sys-utils/src/aggregate_device.rs => third_party/rust/coreaudio-sys-utils/src/aggregate_device.rs
rename : media/libcubeb/cubeb-coreaudio-rs/coreaudio-sys-utils/src/audio_object.rs => third_party/rust/coreaudio-sys-utils/src/audio_object.rs
rename : media/libcubeb/cubeb-coreaudio-rs/coreaudio-sys-utils/src/audio_unit.rs => third_party/rust/coreaudio-sys-utils/src/audio_unit.rs
rename : media/libcubeb/cubeb-coreaudio-rs/coreaudio-sys-utils/src/cf_mutable_dict.rs => third_party/rust/coreaudio-sys-utils/src/cf_mutable_dict.rs
rename : media/libcubeb/cubeb-coreaudio-rs/coreaudio-sys-utils/src/dispatch.rs => third_party/rust/coreaudio-sys-utils/src/dispatch.rs
rename : media/libcubeb/cubeb-coreaudio-rs/coreaudio-sys-utils/src/lib.rs => third_party/rust/coreaudio-sys-utils/src/lib.rs
rename : media/libcubeb/cubeb-coreaudio-rs/coreaudio-sys-utils/src/string.rs => third_party/rust/coreaudio-sys-utils/src/string.rs
rename : media/libcubeb/cubeb-coreaudio-rs/Cargo.toml => third_party/rust/cubeb-coreaudio/Cargo.toml
rename : media/libcubeb/cubeb-coreaudio-rs/LICENSE => third_party/rust/cubeb-coreaudio/LICENSE
rename : media/libcubeb/cubeb-coreaudio-rs/src/backend/aggregate_device.rs => third_party/rust/cubeb-coreaudio/src/backend/aggregate_device.rs
rename : media/libcubeb/cubeb-coreaudio-rs/src/backend/auto_array.rs => third_party/rust/cubeb-coreaudio/src/backend/auto_array.rs
rename : media/libcubeb/cubeb-coreaudio-rs/src/backend/auto_release.rs => third_party/rust/cubeb-coreaudio/src/backend/auto_release.rs
rename : media/libcubeb/cubeb-coreaudio-rs/src/backend/device_property.rs => third_party/rust/cubeb-coreaudio/src/backend/device_property.rs
rename : media/libcubeb/cubeb-coreaudio-rs/src/backend/mixer.rs => third_party/rust/cubeb-coreaudio/src/backend/mixer.rs
rename : media/libcubeb/cubeb-coreaudio-rs/src/backend/mod.rs => third_party/rust/cubeb-coreaudio/src/backend/mod.rs
rename : media/libcubeb/cubeb-coreaudio-rs/src/backend/resampler.rs => third_party/rust/cubeb-coreaudio/src/backend/resampler.rs
rename : media/libcubeb/cubeb-coreaudio-rs/src/backend/utils.rs => third_party/rust/cubeb-coreaudio/src/backend/utils.rs
rename : media/libcubeb/cubeb-coreaudio-rs/src/capi.rs => third_party/rust/cubeb-coreaudio/src/capi.rs
rename : media/libcubeb/cubeb-coreaudio-rs/src/lib.rs => third_party/rust/cubeb-coreaudio/src/lib.rs
extra : moz-landing-system : lando
2019-12-10 15:43:17 +00:00
Landry Breuil 6cd8db12f6 Bug 1596546: disable sndio lazy loading on OpenBSD, and directly link with it r=kinetik
unveil() work in bug #1580271 broke sound playback

Differential Revision: https://phabricator.services.mozilla.com/D53079

--HG--
extra : moz-landing-system : lando
2019-11-15 06:33:19 +00:00
Chun-Min Chang b98337f5cd Bug 1589931 - P2: Update cubeb-audiounit-rs to 0920240. r=padenot
Pick commits:
0920240 - Always return null-terminated strings from current_device (#25)

Differential Revision: https://phabricator.services.mozilla.com/D52880

--HG--
extra : moz-landing-system : lando
2019-11-14 21:00:16 +00:00
Chun-Min Chang bb5b523cb0 Bug 1590151 - Update cubeb-coreaudio-rs to cd954ca. r=padenot
Pick commits:
cd954ca - Update dependencies (#22)
7043a0c - Make audiounit_get_devices_of_type infallible (#21)

Differential Revision: https://phabricator.services.mozilla.com/D51725

--HG--
extra : moz-landing-system : lando
2019-11-07 16:41:44 +00:00
Chun-Min Chang 7f26e8dfa4 Bug 1591249 - Bump coreaudio-sys to 0.2.3. r=glandium
The current coreaudio-sys in gecko is a custom 0.2.2 version that used
to avoid the cross-compiling issue mentioned in bug 1569003. The issue
has been fixed in the coreaudio-sys 0.2.3, so we should follow the
upstream instead of using a custom version. As a result, the
coreaudio-sys would generate API bindings based on the MacOS SDK defined
in the build settings.

Differential Revision: https://phabricator.services.mozilla.com/D50531

--HG--
extra : moz-landing-system : lando
2019-10-31 20:14:00 +00:00
Chun-Min Chang 97ec12425c Bug 1590890 - Disable bindgen when building coreaudio-sys. r=glandium
Revert the coreaudio-sys dependency changed in bug 1589514, which causes
a trouble when compiling with sccache

Differential Revision: https://phabricator.services.mozilla.com/D50529

--HG--
extra : moz-landing-system : lando
2019-10-28 22:04:16 +00:00
Paul Adenot 12cabe50dd Bug 1590652 - Temporarily revert to using IAudioClient on Windows 10. r=kinetik
Differential Revision: https://phabricator.services.mozilla.com/D50242

--HG--
extra : moz-landing-system : lando
2019-10-23 21:19:36 +00:00
Chun-Min Chang d7aacc3bc4 Bug 1589514 - P2: Update cubeb-coreaudio-rs to 92e2e11. r=padenot
Depends on D50002

Differential Revision: https://phabricator.services.mozilla.com/D50003

--HG--
extra : moz-landing-system : lando
2019-10-22 11:46:55 +00:00
Chun-Min Chang d8668b05bc Bug 1589514 - P1: Update script importing cubeb-coreaudio-rs. r=padenot
Pick commits:
92e2e11 - minor style fix
5163960 - Update authors
fdb0b1d - Make utf8_from_cfstringref work with empty CFStringRef (#20)
a39bf5f - Remove a fixed issue

Differential Revision: https://phabricator.services.mozilla.com/D50002

--HG--
extra : moz-landing-system : lando
2019-10-22 11:46:32 +00:00
Jan Beich d354b5e3a2 Bug 1588669 - Allow ALSA/SNDIO lazy bindings after 81926b0c0d8c. r=kinetik
Differential Revision: https://phabricator.services.mozilla.com/D49258

--HG--
extra : moz-landing-system : lando
2019-10-15 09:33:33 +00:00
Paul Adenot c9cbd16860 Bug 1575883 - Update cubeb-pulse-rs to f9eb50b8. r=kinetik
Differential Revision: https://phabricator.services.mozilla.com/D47281

--HG--
extra : moz-landing-system : lando
2019-10-11 16:00:41 +00:00
Paul Adenot 1f614d2cd1 Bug 1575883 - Update cubeb-coreaudio-rs to fd242ea. r=kinetik
Differential Revision: https://phabricator.services.mozilla.com/D47278

--HG--
extra : moz-landing-system : lando
2019-10-11 15:44:18 +00:00
Paul Adenot 8088048155 Bug 1575883 - Update cubeb to a1200c34. r=kinetik
Differential Revision: https://phabricator.services.mozilla.com/D47277

--HG--
extra : moz-landing-system : lando
2019-10-11 16:05:55 +00:00
Paul Adenot 6571cd8b7b Bug 1575883 - Remove cubeb_panner.{cpp,h} from the cubeb update script. r=kinetik
Those files have been removed upstream.

Differential Revision: https://phabricator.services.mozilla.com/D47276

--HG--
extra : moz-landing-system : lando
2019-10-11 15:50:18 +00:00
Matthew Gregan 25b3f4cfbc Bug 1575131 - Update libcubeb for IAudioClient3 support on Win10. r=padenot
This picks up the work contributed by @ligfx in https://github.com/kinetiknz/cubeb/pull/530.

Differential Revision: https://phabricator.services.mozilla.com/D42590

--HG--
extra : moz-landing-system : lando
2019-08-26 07:52:25 +00:00
Chun-Min Chang 4c2709e357 Bug 1574644 - Update cubeb-coreaudio-rs to version 71faddb. r=kinetik
Differential Revision: https://phabricator.services.mozilla.com/D42382

--HG--
extra : moz-landing-system : lando
2019-08-16 22:20:30 +00:00
Chun-Min Chang 817f6f88f6 Bug 1570446 - P2: Update cubeb-coreaudio-rs to version ee0f981. r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D39979

--HG--
extra : moz-landing-system : lando
2019-08-02 18:29:37 +00:00
Chun-Min Chang f29bfc124d Bug 1570446 - P1: Update script importing cubeb-coreaudio-rs to gecko. r=padenot
- Don't import the build settings since the settings in gecko is more
complicated.
- Print out the picked commits when running the scripts

Differential Revision: https://phabricator.services.mozilla.com/D40097

--HG--
extra : moz-landing-system : lando
2019-08-02 18:29:25 +00:00
Mike Hommey 7acef03e16 Bug 1569331 - Use the more traditional way to override dependencies for coreaudio-sys. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D39579

--HG--
extra : moz-landing-system : lando
2019-07-27 00:35:09 +00:00
Mike Hommey 2919ab6ba3 Bug 1569003 - Disable bindgen when building coreaudio-sys. r=nalexander
This is the most immediate solution to the problem. This is how
automation ends up building things because it's cross-compiling and
cross-compiling falls back to the code path of that feature, and this
solves the immediate problem of builds not working out of the box.

The more long term fix would be to fix the coreaudio-sys crate to do the
right thing.

Differential Revision: https://phabricator.services.mozilla.com/D39447

--HG--
extra : moz-landing-system : lando
2019-07-26 03:54:13 +00:00
Paul Adenot 86d1623bc3 Bug 1567457 - Update cubeb-pulse-rs to version ee6666. r=kinetik
Reviewed upstream by :achronop, :kinetik, :chunmin in:
https://github.com/djg/cubeb-pulse-rs/pull/41
https://github.com/djg/cubeb-pulse-rs/pull/42
https://github.com/djg/cubeb-pulse-rs/pull/43
https://github.com/djg/cubeb-pulse-rs/pull/44
https://github.com/djg/cubeb-pulse-rs/pull/45

Differential Revision: https://phabricator.services.mozilla.com/D38661

--HG--
extra : moz-landing-system : lando
2019-07-23 12:03:23 +00:00
Paul Adenot b2b7b7837d Bug 1567480 - Update libcubeb to 0b5b52d. r=kinetik
Differential Revision: https://phabricator.services.mozilla.com/D38674

--HG--
extra : moz-landing-system : lando
2019-07-19 22:56:19 +00:00
Gurzau Raul 8517586551 Backed out 2 changesets (bug 1567457) for failures at test_getUserMedia_basicAudio_loopback.html on a CLOSED TREE.
Backed out changeset ce5d76c8be1b (bug 1567457)
Backed out changeset 35503df3d3e8 (bug 1567457)
2019-07-19 18:24:05 +03:00
Paul Adenot be57df7942 Bug 1567457 - Update cubeb-pulse-rs to version 3a748a2. r=kinetik
Reviewed upstream by :achronop, :kinetik, :chunmin in:
https://github.com/djg/cubeb-pulse-rs/pull/41
https://github.com/djg/cubeb-pulse-rs/pull/42

Differential Revision: https://phabricator.services.mozilla.com/D38661

--HG--
extra : moz-landing-system : lando
2019-07-19 13:36:44 +00:00
Chun-Min Chang ec036851de Bug 1530715 - P42: Remove unnecessary mutex. r=padenot
There are three potential data-race operations that may run at the same
time:
1. Data callback and stream reinitialization
2. Data callback and stream destroying
3. Stream reinitialization and stream destroying

The case 1 and 2 won't happen as long as the AudioOutputUnitStop is
called at the beginning of stream reinitialization and stream
destorying. The AudioOutputUnitStop requires to lock a mutex inside
CoreAudio framework that is also used by the data callback. Thus, if
there is a running callback, which holds the mutex inside CoreAudio
framework, when AudioOutputUnitStop is called, then the calling will
block the current thread until the data callback ends since it is
waiting for the mutex. By calling AudioOutputUnitStop at the beginning
of the stream reinitialization and stream destroying, the data race of
case 1 and 2 can be avoided.

On the other hand, the case 3 won't happen since the stream
initialization and destroying is run on the same task queue. The two
tasks on the same serial task queue are impossible to be run at the same
time. The mutex in AudioUnitStream is unnecessary because it's used for
the case 3.

Differential Revision: https://phabricator.services.mozilla.com/D34076

--HG--
extra : moz-landing-system : lando
2019-07-10 08:06:56 +00:00
Chun-Min Chang c4f1202ebd Bug 1530715 - P41: Remove OwnedCriticalSection in cubeb stream. r=padenot
The custom mutex, OwnedCriticalSection, in the current code comes with
the C-to-Rust translation work of cubeb_audiouniut.cpp. Its design is in
C style and not fitted well in the Rust. Rust has a better mutex design.

In the previous patches, all the data that may be touched on the
different threads are moved into a struct wrapped by a Rust mutex. Those
data will be touched in the critical sections created by the Rust mutex.
Therefore, this custom mutex becomes redundant. It's time to say goodbye
to it.

Differential Revision: https://phabricator.services.mozilla.com/D34074

--HG--
extra : moz-landing-system : lando
2019-07-10 08:06:58 +00:00
Chun-Min Chang 2c4a12e3b6 Bug 1530715 - P40: Move stream setup and close into a struct within a mutex. r=padenot
The core stream data that will be touched on the different threads when
the stream is created, reinitialized, destoryed should be used in the
critical section. Those core data are initialized in stream-setup and
destroyed in stream-close. The stream-setup and stream-close is run in
the critical section so they won't be executed at the same time.
Currently, the critical section is created by our custom mutex. However,
this custom mutex will be removed in the later mutex replacement.

Instead of running these two operations in the critical sections created
by the custom mutex, they should be moved into a struct wrapped by a
standard Rust mutex. As a result, at the end when the custom mutex is
removed, these two operations are still in the critical sections that
are created by the Rust mutex.

Differential Revision: https://phabricator.services.mozilla.com/D34073

--HG--
extra : moz-landing-system : lando
2019-07-10 08:07:00 +00:00
Chun-Min Chang 05ca07cf2a Bug 1530715 - P39: Move listeners (un)registrations into a strcut within a mutex. r=padenot
The listeners will be registered and unregistered on the different threads,
so the listeners should be used in the critical sections. We do create
critical sections by our own mutex. However, this custom mutex will be
gradually replaced by the standard Rust mutex in the following patches.

To replace the custom mutex, we put the listeners to the struct wrapped
by a Rust mutex and register or unregister the listeners in the critical
section created by this struct. At the end when the custom mutex is
removed, those operations are still in the critical sections.

Differential Revision: https://phabricator.services.mozilla.com/D34072

--HG--
extra : moz-landing-system : lando
2019-07-10 08:07:02 +00:00
Chun-Min Chang 36d0185bd8 Bug 1530715 - P38: Merge configure_input into setup. r=padenot
Calling configure_input requires borrowing AudioUnitStream as a
mutable. Merging configure_input into setup will help to avoid a
potential borrowing-twice issue in the later mutex replacement. There
will be a critical section created by a Rust mutex in the setup, which
will borrow the AudioUnitStream as an immutable.

Differential Revision: https://phabricator.services.mozilla.com/D34071

--HG--
extra : moz-landing-system : lando
2019-07-10 08:07:04 +00:00
Chun-Min Chang 49581ca4dc Bug 1530715 - P37: Merge configure_output into setup. r=padenot
Calling configure_output requires borrowing AudioUnitStream as a
mutable. Merging configure_output into setup will help to avoid a
potential borrowing-twice issue in the later mutex replacement. There
will be a critical section created by a Rust mutex in the setup, which
will borrow the AudioUnitStream as an immutable.

Differential Revision: https://phabricator.services.mozilla.com/D34070

--HG--
extra : moz-landing-system : lando
2019-07-10 08:07:06 +00:00
Chun-Min Chang c02d11403d Bug 1530715 - P36: Move out minimum_resampling_input_frames of output callback. r=padenot
Avoid calling minimum_resampling_input_frames by a borrowing from
AudioUnitStream

Differential Revision: https://phabricator.services.mozilla.com/D34069

--HG--
extra : moz-landing-system : lando
2019-07-10 08:07:08 +00:00
Chun-Min Chang 4f393e66ea Bug 1530715 - P35: Store layout in the stream instead of context. r=padenot
We store global layout info and channels info in the cubeb context.
However, the streams might output to different devices. We should store
the layout info of the output device in the stream directly instead of
in the context. On the other hand, the `channels` value is a duplicate
of `output_desc.mChannelsPerFrame` or `mixer.out_channels` so we don't
need to store this value.

Differential Revision: https://phabricator.services.mozilla.com/D34068

--HG--
extra : moz-landing-system : lando
2019-07-10 08:07:10 +00:00
Chun-Min Chang 6c5d3ff715 Bug 1530715 - P34: Merge layout_init into configure_output. r=padenot
1. Avoid calling layout_init by wrong AudioUnit value

2. Avoid calling layout getting/setting APIs by borrowing the
AudioUnitStream as a mutable. It will help to avoid the potential
borrowing-twice issues in the later mutex replacement.

Differential Revision: https://phabricator.services.mozilla.com/D34067

--HG--
extra : moz-landing-system : lando
2019-07-10 08:06:35 +00:00
Chun-Min Chang 93932acf07 Bug 1530715 - P33: Register and unregister the device-changed callbacks when stream setup and close. r=padenot
1. The code readability is slightly better if we can register and
unregister the callbacks in the same places. The device-chaned callbacks
are registered when stream setup and unregistered when stream close.

2. In the later mutex replacement, the core stream variables that may be
touched by different threads when reinitializing or destroying the
stream, including {in, out}_unit, will be wrapped in a Rust mutex.
Moving these callbacks (un)registration into the same places makes it
easier to find where the critical sections are.

Differential Revision: https://phabricator.services.mozilla.com/D34066

--HG--
extra : moz-landing-system : lando
2019-07-10 08:06:37 +00:00
Chun-Min Chang 56e7631637 Bug 1530715 - P32: Close the stream if failing in stream reinitialization. r=padenot
Before reporting the error by the state callback, closing the stream to
make sure the data callback and device-changed callback are
unregistered.

Differential Revision: https://phabricator.services.mozilla.com/D34065

--HG--
extra : moz-landing-system : lando
2019-07-10 08:06:39 +00:00
Chun-Min Chang f06595279a Bug 1530715 - P31: Merge render_input into audiounit_input_callback. r=padenot
1. If AudioUnitRender return kAudioUnitErr_CannotDoInCurrentContext
within a input-only stream, the input-only stream will keep feed silence
data into the buffer instead of reporting the error. With this change,
the error will be rendered as the returned value of the data callback to
the underlying CoreAudio framework.

2. By merging the render_input into audiounit_input_callback and adjust
the timing to call reinit_async, now the reinit_async is called at the
line that is out of the main logic for feeding buffer data. In the scope
of the main logic, there will be a critical section created by locking a
Rust mutex within AudioUnitStream in the later mutex replacement.
Without moving the reinit_async, which borrows AudioUnitStream as a
mutable, out of the critical section, there will be a borrowing-twice
issue.

Differential Revision: https://phabricator.services.mozilla.com/D34064

--HG--
extra : moz-landing-system : lando
2019-07-10 08:06:41 +00:00
Chun-Min Chang 7a27f19d14 Bug 1530715 - P30: Some clean-up in audiounit_output_callback. r=padenot
- Remove unnecessary mutabilities
- Remove duplicate API calls

Differential Revision: https://phabricator.services.mozilla.com/D34063

--HG--
extra : moz-landing-system : lando
2019-07-10 08:06:43 +00:00
Chun-Min Chang d637d53858 Bug 1530715 - P29: Move mixer to a struct within a mutex. r=padenot
The mixer of the stream will be created, reinitialized, used or
destroyed on different threads, so its operations should be in the
critical sections. We do create critical sections by our custom mutex.
However, this custom mutex will be gradually replaced by the standard
Rust mutex in the following patches.

To replace the custom mutex, we put the mixer to the struct wrapped by a
Rust mutex and do all the mixer operations in the critical section
created by this struct. At the end when the custom mutex is removed,
those operations are still in critical sections.

Calling notify_state_changed needs to borrow AudioUnitStream as a
mutuable. To avoid the borrowing-twice issue, the notify_state_changed
calling is moved out the scope of the critical section created in the
output data callback.

Differential Revision: https://phabricator.services.mozilla.com/D34062

--HG--
extra : moz-landing-system : lando
2019-07-10 08:06:45 +00:00
Chun-Min Chang 7efd386b4d Bug 1530715 - P28: Create a Mixer module. r=padenot
Using an Mixer struct to operate all the mixing APIs is a way to make
the code clearer. In addition, we can avoid calling mix function by
borrowing the AudioUnitStream as a mutable. It will help to avoid
potential borrowing-twice issues in the later mutex replacement.

Differential Revision: https://phabricator.services.mozilla.com/D34061

--HG--
extra : moz-landing-system : lando
2019-07-10 08:06:47 +00:00
Chun-Min Chang 2ac1419990 Bug 1530715 - P27: Move resampler to a struct within a mutex. r=padenot
The resampler of the stream will be created, reinitialized, used or
destroyed on different threads, so its operations should be in the
critical sections. We do create critical sections by our custom mutex.
However, this custom mutex will be gradually replaced by the standard
mutex in the following patches. To replace the custom mutex, we put the
resampler to the struct wrapped by a Rust mutex and do all the resampler
operations in the critical section created by this struct. At the end
when the custom mutex is removed, those operations are still in critical
sections.

Differential Revision: https://phabricator.services.mozilla.com/D34060

--HG--
extra : moz-landing-system : lando
2019-07-10 08:06:48 +00:00