class Device
Defined at line 40 of file ../../src/media/audio/services/device_registry/device.h
This class represents a driver and audio device, once it is detected.
Public Methods
bool has_error ()
Simple accessors
This is the const subset available to device observers.
Defined at line 184 of file ../../src/media/audio/services/device_registry/device.h
bool is_operational ()
Defined at line 185 of file ../../src/media/audio/services/device_registry/device.h
fuchsia_audio_device::DeviceType device_type ()
Defined at line 186 of file ../../src/media/audio/services/device_registry/device.h
bool is_codec ()
Defined at line 187 of file ../../src/media/audio/services/device_registry/device.h
bool is_composite ()
Defined at line 188 of file ../../src/media/audio/services/device_registry/device.h
TokenId token_id ()
Assigned by this service, guaranteed unique for this boot session, but not across reboots.
Defined at line 193 of file ../../src/media/audio/services/device_registry/device.h
const std::optional<fuchsia_audio_device::Info> & info ()
`info` is only populated once the device is initialized.
Defined at line 195 of file ../../src/media/audio/services/device_registry/device.h
const std::vector<fuchsia_audio_device::ElementDaiFormatSet> & dai_format_sets ()
Defined at line 198 of file ../../src/media/audio/services/device_registry/device.h
const std::vector<fuchsia_audio_device::ElementRingBufferFormatSet> & ring_buffer_format_sets ()
Defined at line 201 of file ../../src/media/audio/services/device_registry/device.h
fuchsia_audio::Format ring_buffer_format (ElementId element_id)
TODO(https://fxbug.dev/42069015): Consider using media_audio::Format internally.
Defined at line 207 of file ../../src/media/audio/services/device_registry/device.h
std::optional<int16_t> valid_bits_per_sample (ElementId element_id)
Defined at line 214 of file ../../src/media/audio/services/device_registry/device.h
std::optional<bool> supports_set_active_channels (ElementId element_id)
Defined at line 222 of file ../../src/media/audio/services/device_registry/device.h
bool dai_format_is_set ()
Defined at line 228 of file ../../src/media/audio/services/device_registry/device.h
const fuchsia_hardware_audio::CodecFormatInfo & codec_format_info (ElementId element_id)
Defined at line 229 of file ../../src/media/audio/services/device_registry/device.h
bool codec_is_started ()
Defined at line 232 of file ../../src/media/audio/services/device_registry/device.h
bool has_codec_properties ()
Defined at line 234 of file ../../src/media/audio/services/device_registry/device.h
bool has_composite_properties ()
Defined at line 235 of file ../../src/media/audio/services/device_registry/device.h
bool has_health_state ()
Defined at line 236 of file ../../src/media/audio/services/device_registry/device.h
bool dai_format_sets_retrieved ()
Defined at line 237 of file ../../src/media/audio/services/device_registry/device.h
bool ring_buffer_format_sets_retrieved ()
Defined at line 238 of file ../../src/media/audio/services/device_registry/device.h
bool packet_stream_format_sets_retrieved ()
Defined at line 239 of file ../../src/media/audio/services/device_registry/device.h
const std::unordered_set<ElementId> & dai_ids ()
Defined at line 240 of file ../../src/media/audio/services/device_registry/device.h
const std::unordered_set<ElementId> & ring_buffer_ids ()
Defined at line 241 of file ../../src/media/audio/services/device_registry/device.h
const std::unordered_set<ElementId> & packet_stream_ids ()
Defined at line 242 of file ../../src/media/audio/services/device_registry/device.h
const std::unordered_set<TopologyId> & topology_ids ()
Defined at line 243 of file ../../src/media/audio/services/device_registry/device.h
const std::unordered_set<ElementId> & element_ids ()
Defined at line 244 of file ../../src/media/audio/services/device_registry/device.h
bool has_plug_state ()
Defined at line 246 of file ../../src/media/audio/services/device_registry/device.h
bool checked_for_signalprocessing ()
Defined at line 247 of file ../../src/media/audio/services/device_registry/device.h
bool supports_signalprocessing ()
Defined at line 248 of file ../../src/media/audio/services/device_registry/device.h
std::shared_ptr<DeviceInspectInstance> inspect ()
Defined at line 251 of file ../../src/media/audio/services/device_registry/device.h
uint64_t count ()
Static object counts, for debugging purposes.
Defined at line 254 of file ../../src/media/audio/services/device_registry/device.h
uint64_t initialized_count ()
Defined at line 255 of file ../../src/media/audio/services/device_registry/device.h
uint64_t unhealthy_count ()
Defined at line 256 of file ../../src/media/audio/services/device_registry/device.h
std::shared_ptr<Device> Create (std::weak_ptr<DevicePresenceWatcher> presence_watcher, async_dispatcher_t * dispatcher, std::string_view name, fuchsia_audio_device::DeviceType device_type, fuchsia_audio_device::DriverClient driver_client, const std::string & added_by)
static
Defined at line 285 of file ../../src/media/audio/services/device_registry/device.cc
void ~Device ()
Defined at line 348 of file ../../src/media/audio/services/device_registry/device.cc
void Initialize ()
Defined at line 829 of file ../../src/media/audio/services/device_registry/device.cc
bool AddObserver (const std::shared_ptr<ObserverNotify> & observer_to_add)
Defined at line 580 of file ../../src/media/audio/services/device_registry/device.cc
bool SetControl (std::shared_ptr<ControlNotify> control_notify)
Returns true if the specified entity successfully asserts control of this device.
Defined at line 518 of file ../../src/media/audio/services/device_registry/device.cc
void DropRingBuffer (ElementId element_id)
Whether client- or device-originated, reset any state associated with an active RingBuffer.
Defined at line 660 of file ../../src/media/audio/services/device_registry/device.cc
void DropPacketStream (ElementId element_id)
Defined at line 726 of file ../../src/media/audio/services/device_registry/device.cc
std::optional<fuchsia_hardware_audio::Format2> SupportedRingBufferDriverFormatForClientFormat (ElementId element_id, const fuchsia_audio::Format & client_format)
Determine the full fuchsia_hardware_audio::Format needed for ConnectRingBufferFidl.
This method expects that the required fields are present.
Defined at line 1919 of file ../../src/media/audio/services/device_registry/device.cc
void SetDaiFormat (ElementId element_id, const fuchsia_hardware_audio::DaiFormat & dai_formats)
This method guarantees that ControlNotify's DaiFormatIsChanged or DaiFormatIsNotChanged will
eventually be called, either immediately or asynchronously when driver SetDaiFormat concludes.
Defined at line 2042 of file ../../src/media/audio/services/device_registry/device.cc
bool Reset ()
If true is returned, then we guarantee to call ControlNotify::DeviceIsReset (and CodecIsStopped
if the Start/Stop state is changed, and DaiFormatIsChanged if the DaiFormat is changed).
If false is returned, then no change occurs and these notifications will not be called.
Defined at line 2219 of file ../../src/media/audio/services/device_registry/device.cc
bool CodecStart ()
If true is returned, then we guarantee to call CodecIsStarted/CodecIsNotStarted on ControlNotify.
If false is returned, then this notification will not be called.
Defined at line 2321 of file ../../src/media/audio/services/device_registry/device.cc
bool CodecStop ()
If true is returned, then we guarantee to call CodecIsStopped or CodecIsNotStopped on
ControlNotify. If false is returned, then this notification will not be called.
Defined at line 2376 of file ../../src/media/audio/services/device_registry/device.cc
zx_status_t SetTopology (TopologyId topology_id)
If the method does not return ZX_OK, then the driver was not called.
Defined at line 1481 of file ../../src/media/audio/services/device_registry/device.cc
zx_status_t SetElementState (ElementId element_id, const fuchsia_hardware_audio_signalprocessing::SettableElementState & element_state)
If the method does not return ZX_OK, then the driver was not called.
Defined at line 1377 of file ../../src/media/audio/services/device_registry/device.cc
bool CreateRingBuffer (ElementId element_id, const fuchsia_hardware_audio::Format2 & format, uint32_t requested_ring_buffer_bytes, fit::callback<void (fit::result<fuchsia_audio_device::ControlCreateRingBufferError, Device::RingBufferInfo>)> create_ring_buffer_callback)
This method guarantees to call create_ring_buffer_callback (immediately or asynchronously).
For certain unrecoverable errors, OnError is called as well.
Defined at line 2431 of file ../../src/media/audio/services/device_registry/device.cc
bool SetActiveChannels (ElementId element_id, uint64_t channel_bitmask, fit::callback<void (zx::result<zx::time>)> set_active_channels_callback)
Change the channels that are currently active (powered-up).
Defined at line 3017 of file ../../src/media/audio/services/device_registry/device.cc
void StartRingBuffer (ElementId element_id, fit::callback<void (zx::result<zx::time>)> start_callback)
Start the device ring buffer now (including clock recovery).
Defined at line 3112 of file ../../src/media/audio/services/device_registry/device.cc
void StopRingBuffer (ElementId element_id, fit::callback<void (zx_status_t)> stop_callback)
Stop the device ring buffer now (including device clock recovery).
Defined at line 3166 of file ../../src/media/audio/services/device_registry/device.cc
void StartPacketStream (ElementId element_id, fit::callback<void (zx::result<>)> start_callback)
Start the device packet stream now.
Defined at line 3220 of file ../../src/media/audio/services/device_registry/device.cc
void StopPacketStream (ElementId element_id, fit::callback<void (zx_status_t)> stop_callback)
Stop the device packet stream now.
Defined at line 3299 of file ../../src/media/audio/services/device_registry/device.cc
void SetPacketStreamBuffers (ElementId element_id, std::variant<fuchsia_hardware_audio::AllocateVmosConfig, fuchsia_hardware_audio::RegisterVmosConfig> setup_strategy, fit::callback<void (zx_status_t, std::optional<std::vector<fuchsia_hardware_audio::VmoInfo>>)> set_buffers_callback)
Set the packet stream buffers.
Defined at line 3369 of file ../../src/media/audio/services/device_registry/device.cc
zx::result<zx::clock> GetReadOnlyClock ()
Create a duplicate handle to our clock with limited rights. We can transfer it to a client who
can only read and duplicate. Specifically, they cannot change this clock's rate or offset.
Defined at line 1901 of file ../../src/media/audio/services/device_registry/device.cc
void SetSignalProcessingSupported (bool is_supported)
Called during initialization, when we know definitively whether the driver supports the protocol.
It might also be called later, if there is an error related to the signalprocessing protocol.
If this is the first time this is called, then call `OnInitializationResponse` to unblock the
signalprocessing-related aspect of the "wait for multiple responses" state machine.
Defined at line 358 of file ../../src/media/audio/services/device_registry/device.cc
Records
Friends
std::ostream & Device (std::ostream & out, PacketStreamState packet_stream_state)
std::ostream & Device (std::ostream & out, RingBufferState ring_buffer_state)
std::ostream & Device (std::ostream & out, State device_state)
class AudioDeviceRegistryServerTestBase
class CompositeTest
class CodecTest
class DeviceTest
class DeviceTestBase