crastestclient

package
v0.0.0-...-683b059 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2022 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package crastestclient provides functions to interact cras_test_client

Package crastestclient provides functions to interact cras_test_client

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CaptureCommand

func CaptureCommand(ctx context.Context, duration, blocksize int) *testexec.Cmd

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

func FirstRunningDevice(ctx context.Context, streamType audio.StreamType) (string, error)

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

func Mute(ctx context.Context) error

Mute lets DUT be muted. That is, after Mute() is done, DUT doesn't sound when a video plays.

func PlaybackCommand

func PlaybackCommand(ctx context.Context, duration, blocksize int) *testexec.Cmd

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.

func Unmute

func Unmute(ctx context.Context) error

Unmute lets DUT be unmuted, if it is muted by Mute().

func WaitForNoStream

func WaitForNoStream(ctx context.Context, timeout time.Duration) error

WaitForNoStream returns error if it fails to wait for all active streams to stop.

Types

type NoStreamError

type NoStreamError struct {
	*errors.E
}

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

func WaitForStreams(ctx context.Context, timeout time.Duration) ([]StreamInfo, error)

WaitForStreams returns error if it fails to detect any active streams.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL