The audio backend of Firefox on Mac OS X.
Перейти к файлу
Chun-Min Chang 3fb3652f81 Add assertions to check if the pointers are null before dereferencing them 2018-11-01 10:50:40 -07:00
src Add assertions to check if the pointers are null before dereferencing them 2018-11-01 10:50:40 -07:00
.editorconfig Add editorconfig 2018-09-10 11:23:29 -07:00
.gitignore create a empty cargo library crate 2018-09-10 11:23:03 -07:00
Cargo.toml impl audiounit_strref_to_cstr_utf8 2018-10-07 14:32:27 -07:00
LICENSE Add Readme and License 2018-09-10 11:18:00 -07:00
README.md Add notes 2018-10-30 17:06:43 -07:00

README.md

cubeb-coreaudio-rs

Implementation of MacOS Audio backend in CoreAudio framework for Cubeb written in Rust.

Current Goals

  • Translate C code line by line into Rust
  • Create tests for later refactoring

TODO

  • Test aggregate devices
  • Test for stream operations
  • Clean up the tests. Merge the duplicated pieces in to a function.
  • Find a way to catch memory leaks
    • Try Instrument on OSX

Issues

  • Mutex: Find a replacement for owned_critical_section
    • a dummy mutex like Mutex<()> should work (see test_dummy_mutex_multithread) as what owned_critical_section does in C version, but it doens't has similar API like assert_current_thread_owns.
    • We implement a OwnedCriticalSection around pthread_mutex_t like what we do in C version for now.
  • Unworkable API: dispatch_async
    • The second parameter of dispatch_async is dispatch_block_t, which is defined by typedef void (^dispatch_block_t)(void).
    • The caret symbol ^ defines a block.
    • The block is a lambda expression-like syntax to create closures. (See Apple's document: Working with Blocks)
    • Not sure if Rust can work with it. Rust has its own closure.
    • For now, we implement an API async_dispatch to replace dispatch_async
      • async_dispatch is based on dispatch_async_f.
      • async_dispatch takes a Rust closure (instead of Apple's block) as one of its parameter.
      • prototype on gist
        • The closure (it's a struct) will be boxed, which means the closure will be moved into heap, so the closure cannot be optimized as inline code.
        • Since the closure will be run on an asynchronous thread, we need to move the closure to heap in case it's destroyed when the other thread want to use it.