getusermedia

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: 14 Imported by: 0

Documentation

Overview

Package getusermedia provides code for webrtc.* tests related to getUserMedia(), see: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DataFiles

func DataFiles() []string

DataFiles returns a list of required files that tests that use this package should include in their Data fields.

func RunDecodeAccelUsedJPEG

func RunDecodeAccelUsedJPEG(ctx context.Context, s *testing.State, getUserMediaFilename, streamName, histogramName string, bucketValue int64)

RunDecodeAccelUsedJPEG tests that the HW JPEG decoder is used in a GetUserMedia(). The test fails if bucketValue on histogramName does not count up.

func RunGetUserMedia

func RunGetUserMedia(ctx context.Context, s *testing.State, cr ChromeInterface,
	duration time.Duration, verbose VerboseLoggingMode) cameraResults

RunGetUserMedia run a test in /data/getusermedia.html. duration specifies how long video capturing will run for each resolution. If verbose is true, video drivers' verbose messages will be enabled. verbose must be false for performance tests.

func RunTest

func RunTest(ctx context.Context, s *testing.State, cr ChromeInterface,
	htmlName, entryPoint string, results, logs interface{})

RunTest checks if the given WebRTC tests work correctly. htmlName is a filename of an HTML file in data directory. entryPoint is a JavaScript expression that starts the test there.

Types

type ChromeInterface

type ChromeInterface interface {
	NewConn(context.Context, string, ...browser.CreateTargetOption) (*chrome.Conn, error)
	Close(ctx context.Context) error
}

ChromeInterface defines interface which includes methods which should be implemented by all Chrome instances. (e.g. Lacros)

type FrameStats

type FrameStats struct {
	TotalFrames  int `json:"totalFrames"`
	BlackFrames  int `json:"blackFrames"`
	FrozenFrames int `json:"frozenFrames"`
}

FrameStats is a struct for statistics of frames.

func (*FrameStats) CheckBrokenFrames

func (s *FrameStats) CheckBrokenFrames() error

CheckBrokenFrames checks that there were less than threshold frozen or black frames. This test might be too strict for real cameras, but should work fine with the Fake video/audio capture device that should be used for WebRTC tests.

func (*FrameStats) CheckTotalFrames

func (s *FrameStats) CheckTotalFrames() error

CheckTotalFrames checks whether video frames were displayed.

func (*FrameStats) SetPerf

func (s *FrameStats) SetPerf(p *perf.Values, suffix string)

SetPerf records performance data in FrameStats to perf.Values. p is a pointer for perf.Values where data will be stored. suffix is a string that will be used as sufixes of metrics' names.

type VerboseLoggingMode

type VerboseLoggingMode int

VerboseLoggingMode describes whether video driver's verbose debug log is enabled.

const (
	// VerboseLogging enables verbose logging.
	VerboseLogging VerboseLoggingMode = iota
	// NoVerboseLogging disables verbose logging.
	NoVerboseLogging
)

Jump to

Keyboard shortcuts

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