Conversation
jemoreira
left a comment
There was a problem hiding this comment.
Please rebase your branch on top of main instead of creating merge commits.
| } | ||
|
|
||
| ::unlink(socket_path_.c_str()); | ||
| server_fd_ = SharedFD::SocketLocalServer( |
There was a problem hiding this comment.
Because of the way cuttlefish spawns processes there is no guarantee that this socket will be created before the client attempts to connect to it. Our way of dealing with this race is to have the parent process run_cvd create the socket and let the child process (this one) inherit it. The actual fd is passed by command line parameter.
There are several examples under host/commands/run_cvd/launch that you can use for guidance.
There was a problem hiding this comment.
Added the injection of server_fd into the PCM streaming server.
The changes to the run_cvd for injection would be in the subsequent PR to keep this PR minimal.
| } | ||
|
|
||
| if (server_fd_->IsOpen()) { | ||
| server_fd_->Shutdown(SHUT_RDWR); |
There was a problem hiding this comment.
why Shutdown? Is Close not enough?
There was a problem hiding this comment.
We need Shutdown() because accept_thread_ is sleeping inside blocking Fd::Accept() when Stop() is called. If accept_thread_ weren't sleeping inside Accept(), Close() alone would be sufficient.
| namespace virtualtuner { | ||
| namespace { | ||
|
|
||
| bool ReadExactly(const SharedFD& fd, std::span<uint8_t> buffer) { |
There was a problem hiding this comment.
We already have ReadExact in shared_buf.h
There was a problem hiding this comment.
Calling ReadExact and casting it to char* here.
Introduce the audio emulation pipeline for the Cuttlefish Virtual Tuner: - AudioGenerator: Generates 48 kHz, 16-bit stereo PCM audio frames (white noise while tuned/playing, silence while stopped/untuned). - PcmStreamServer: Multi-client PCM stream server delivering 48 kHz 16-bit stereo audio frames over a UNIX domain stream socket to Cuttlefish's virtio-snd virtual sound card backend (CrosVM). - Unit and integration tests covering audio frame synthesis and socket streaming. Test: bazel test //cuttlefish/host/commands/virtual_tuner_daemon:... Bug: 521329213 TAG=agy CONV=809829e8-ac68-4c32-b9b7-632f61743e47
8f12d88 to
bce0d57
Compare
Introduce the audio emulation pipeline for the Cuttlefish Virtual Tuner:
Test: bazel test //cuttlefish/host/commands/virtual_tuner_daemon:...
Bug: 521329213
TAG=agy
CONV=809829e8-ac68-4c32-b9b7-632f61743e47