class UsbVideoStream
Defined at line 98 of file ../../src/camera/drivers/usb_video/usb_video_stream.h
UsbVideoStream State Machine:
[DISCONNECTED] ------
<GetChannel
()>---------> [STOPPED]
/|
\
/ |
| --------
<stream
.OnClose()> |
<control
.OnClose>--/-------------- / |
| /
\
|
\
|/
[STREAMING]
<
--Start()--- [READY]
<
---
<CreateStream
()>
All states ------> Unbind() ----> [UNBOUND]
State transition table:
Cells marked with Error will return an error if attempted, but
will not result in a state transition.
Cells marked with N/A are not possible due to lack of channel to
make the call.
Initial State
| DISCONNECTED | STOPPED | READY | STREAMING
GetChannel | STOPPED | Error! | Error! | Error!
CreateStream | N/A | READY | Error! | Error!
Start | N/A | N/A | STREAMING | Error!
Stop | N/A | N/A | Error! | READY
stream close | N/A | N/A | STOPPED | STOPPED
control close | N/A | DISCONNECTED| DISCONNECTED | DISCONNECTED
Unbind | UNBOUND | UNBOUND | UNBOUND | UNBOUND
The Unbind action closes all channels, and disallows any further state transitions.
The state can be determined as follows:
if (unbind callback set) -> UNBOUND
if (!control channel) -> DISCONNECTED
elif (!stream channel) -> STOPPED
elif (!is_streaming_) -> READY
else -> STREAMING
This device does not allow multiple simultaneous control connections via GetChannel,
nor does it allow multiple streaming connections via CreateStream.
Any failure in communication over the control or stream channel will result in that channel
being closed, along with the state transitions that closure implies.
Calling Stop() may not stop the usb device from streaming video frames, but
It will cause this device to stop notifying the client of new frames via OnFrameAvailable.
When Start() is called after calling Stop(), OnFrameAvailable will be called when the next
available frame is filled, so the capture time may have occurred before Start() was called.
The stream_token eventpair passed with CreateStream will be ignored by this device,
although it will retain ownership of the token until the stream is shut down following
closure of the stream channel.
Unless specified otherwise, all methods of this class are assumed to be called
on the single threaded dispatcher owned by this class.
Public Members
static basic_string_view kDriverName
Public Methods
void UsbVideoStream ()
The constructor will not be called on the fidl_dispatch_loop_.
Defined at line 55 of file ../../src/camera/drivers/usb_video/usb_video_stream.cc
void ~UsbVideoStream ()
Defined at line 64 of file ../../src/camera/drivers/usb_video/usb_video_stream.cc
zx::result<> Start (fdf::DriverContext context)
fdf::DriverBase2 implementation.
These methods will not be called on the fidl_dispatch_loop_.
Start connects to the usb banjo protocol of the parent device, parses the video
streaming descriptors and advertises fuchsia_hardware_camera::Service.
Defined at line 70 of file ../../src/camera/drivers/usb_video/usb_video_stream.cc
void Stop (fdf::StopCompleter completer)
Stop posts an async task on the fidl_dispatch_loop_, and completes once all
channels have been closed.
Defined at line 118 of file ../../src/camera/drivers/usb_video/usb_video_stream.cc
Friends
void UsbVideoStream (async_dispatcher_t * async_task_t * zx_status_t )