Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASCS Source Implementation #372

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

ASCS Source Implementation #372

wants to merge 1 commit into from

Conversation

zxzxwu
Copy link
Collaborator

@zxzxwu zxzxwu commented Dec 13, 2023

This example roughly works on my devices, but one issue is that we don't have a very great model to route source audio.

Also we need to improve the event emittion in ASCS I think.

@zxzxwu
Copy link
Collaborator Author

zxzxwu commented Dec 13, 2023

SCO has the same issue. I think one solution could be - again, using microphone input from a web frontend.

@zxzxwu zxzxwu marked this pull request as draft December 13, 2023 16:11
@barbibulle
Copy link
Collaborator

SCO has the same issue. I think one solution could be - again, using microphone input from a web frontend.

You could read the input from an LC3 encoded audio file, like for the A2DP source example.

@zxzxwu
Copy link
Collaborator Author

zxzxwu commented May 3, 2024

Consider the difficulty of audio prcessing and state synchronization between Python and Web Frontend, I think it's better to host codec in Python instead of JS.

The liblc3.wasm file is built from liblc3 source. With wasmtime, it could be executed on all platforms (with CPython only?). Not sure whether there is a better way to pack liblc3?

@zxzxwu zxzxwu marked this pull request as ready for review May 3, 2024 12:40
@zxzxwu zxzxwu marked this pull request as draft May 3, 2024 12:40
@zxzxwu zxzxwu closed this May 3, 2024
@zxzxwu zxzxwu reopened this May 3, 2024
@zxzxwu
Copy link
Collaborator Author

zxzxwu commented May 3, 2024

Not sure how to solve this...

thread 'tokio-runtime-worker' panicked at /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-asyncio-0.18.0/src/testing.rs:285:39:
called `Result::unwrap()` on an `Err` value: PyErr { type: <class 'ModuleNotFoundError'>, value: ModuleNotFoundError("No module named 'cryptography'"), traceback: Some(<traceback object at 0x7bb4710b75c0>) }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Traceback (most recent call last):
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
pyo3_asyncio.RustPanic: rust future panicked
thread 'main' panicked at pytests/pytests.rs:15:1:
called `Result::unwrap()` on an `Err` value: ()
error: test failed, to rerun pass `--test pytests`

@zxzxwu zxzxwu force-pushed the source branch 3 times, most recently from 0115f92 to 47fb7f8 Compare May 3, 2024 16:27
setup.cfg Outdated Show resolved Hide resolved
@barbibulle
Copy link
Collaborator

Not sure how to solve this...

thread 'tokio-runtime-worker' panicked at /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-asyncio-0.18.0/src/testing.rs:285:39:
called `Result::unwrap()` on an `Err` value: PyErr { type: <class 'ModuleNotFoundError'>, value: ModuleNotFoundError("No module named 'cryptography'"), traceback: Some(<traceback object at 0x7bb4710b75c0>) }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Traceback (most recent call last):
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
pyo3_asyncio.RustPanic: rust future panicked
thread 'main' panicked at pytests/pytests.rs:15:1:
called `Result::unwrap()` on an `Err` value: ()
error: test failed, to rerun pass `--test pytests`

When do you get this error?

@zxzxwu
Copy link
Collaborator Author

zxzxwu commented May 6, 2024

It looks like an issue on my local machine. I tried again with GH workflow and then get

thread 'tokio-runtime-worker' panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-asyncio-0.18.0/src/testing.rs:285:39:
called `Result::unwrap()` on an `Err` value: PyErr { type: <class 'RuntimeError'>, value: RuntimeError("There is no current event loop in thread 'Dummy-1'."), traceback: Some(<traceback object at 0x7f421426b6c0>) }
stack backtrace:
   0: rust_begin_unwind
             at /rustc/07dca489ac2d933c78d3c51[58](https://github.com/zxzxwu/bumble/actions/runs/8964830670/job/24617243180?pr=5#step:10:59)e3f43beefeb02ce/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
   2: core::result::unwrap_failed
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/result.rs:1[64](https://github.com/zxzxwu/bumble/actions/runs/8964830670/job/24617243180?pr=5#step:10:65)9:5
   3: core::result::Result<T,E>::unwrap
   4: pyo3_asyncio::testing::test_harness::{{closure}}::{{closure}}::{{closure}}
   5: <futures_util::stream::futures_unordered::FuturesUnordered<Fut> as futures_core::stream::Stream>::poll_next
   6: futures_util::stream::stream::StreamExt::poll_next_unpin
   7: <futures_util::stream::stream::for_each_concurrent::ForEachConcurrent<St,Fut,F> as core::future::future::Future>::poll
   8: pyo3_asyncio::testing::test_harness::{{closure}}
   9: pyo3_asyncio::testing::main::{{closure}}

After some investigation, the root cause of this seems to be async lock?

@zxzxwu zxzxwu force-pushed the source branch 4 times, most recently from 07286dd to 7a5f059 Compare May 6, 2024 07:58
@zxzxwu zxzxwu marked this pull request as ready for review May 6, 2024 17:17
@zxzxwu zxzxwu changed the title [WIP] ASCS Source ASCS Source Implementation May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants