Documentation ¶
Overview ¶
Package crastestclient provides functions to interact cras_test_client
Package crastestclient provides functions to interact cras_test_client
Index ¶
- func CaptureCommand(ctx context.Context, duration, blocksize int) *testexec.Cmd
- func CaptureFileCommand(ctx context.Context, file string, duration, channels, rate int) *testexec.Cmd
- func FirstRunningDevice(ctx context.Context, streamType audio.StreamType) (string, error)
- func Mute(ctx context.Context) error
- func PlaybackCommand(ctx context.Context, duration, blocksize int) *testexec.Cmd
- func PlaybackFileCommand(ctx context.Context, file string, duration, channels, rate int) *testexec.Cmd
- func StartPollStreamWorker(ctx context.Context, timeout time.Duration) <-chan PollStreamResult
- func Unmute(ctx context.Context) error
- func WaitForNoStream(ctx context.Context, timeout time.Duration) error
- type NoStreamError
- type PollStreamResult
- type StreamInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CaptureCommand ¶
CaptureCommand creates a cras_test_client capture command.
func CaptureFileCommand ¶
func CaptureFileCommand(ctx context.Context, file string, duration, channels, rate int) *testexec.Cmd
CaptureFileCommand creates a cras_test_client capture-to-file command.
func FirstRunningDevice ¶
FirstRunningDevice returns the first input/output device by parsing audio thread logs. A device may not be opened immediately so it will repeat a query until there is a running device or timeout.
func Mute ¶
Mute lets DUT be muted. That is, after Mute() is done, DUT doesn't sound when a video plays.
func PlaybackCommand ¶
PlaybackCommand creates a cras_test_client playback command.
func PlaybackFileCommand ¶
func PlaybackFileCommand(ctx context.Context, file string, duration, channels, rate int) *testexec.Cmd
PlaybackFileCommand creates a cras_test_client playback-from-file command.
func StartPollStreamWorker ¶
func StartPollStreamWorker(ctx context.Context, timeout time.Duration) <-chan PollStreamResult
StartPollStreamWorker starts a goroutine to poll an active stream.
Types ¶
type NoStreamError ¶
NoStreamError represents the error of failing to detect any active streams.
type PollStreamResult ¶
type PollStreamResult struct { Streams []StreamInfo Error error }
PollStreamResult is the CRAS stream polling result.
type StreamInfo ¶
type StreamInfo struct { Direction string Effects uint64 FrameRate uint32 NumChannels uint8 IsPinned bool ClientType string }
StreamInfo holds attributes of an active stream. It contains only test needed fields.
func WaitForStreams ¶
WaitForStreams returns error if it fails to detect any active streams.