ffi

package
v0.0.0-...-392cdac Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package ffi provides purego-based FFI bindings to the libwebrtc shim library. This file contains device capture FFI bindings.

Package ffi provides FFI bindings to the libwebrtc shim library. It supports both purego (default) and CGO backends via build tags.

Index

Constants

View Source
const (
	RTLD_NOW    = C.RTLD_NOW
	RTLD_GLOBAL = C.RTLD_GLOBAL
)

RTLD flags for dlopen - using C constants from dlfcn.h

View Source
const (
	ShimOK                     int32 = 0
	ShimErrInvalidParam        int32 = -1
	ShimErrInitFailed          int32 = -2
	ShimErrEncodeFailed        int32 = -3
	ShimErrDecodeFailed        int32 = -4
	ShimErrOutOfMemory         int32 = -5
	ShimErrNotSupported        int32 = -6
	ShimErrNeedMoreData        int32 = -7
	ShimErrBufferTooSmall      int32 = -8
	ShimErrNotFound            int32 = -9
	ShimErrRenegotiationNeeded int32 = -10
)

Error codes from shim (int32 to match C int)

View Source
const (
	QualityLimitationNone      = 0
	QualityLimitationCPU       = 1
	QualityLimitationBandwidth = 2
	QualityLimitationOther     = 3
)

Quality limitation reason constants

View Source
const ExpectedLibWebRTCVersion = "M141"

ExpectedLibWebRTCVersion is the libwebrtc version this Go code expects. Must match kLibWebRTCVersion in shim/shim_common.cc.

View Source
const ExpectedShimVersion = "0.5.1"

ExpectedShimVersion is the shim API version this Go code expects. Must match kShimVersion in shim/shim_common.cc.

View Source
const MaxErrorMsgLen = 512

MaxErrorMsgLen matches SHIM_MAX_ERROR_MSG_LEN in shim.h

Variables

View Source
var (
	// ErrLibraryNotLoaded is returned when the shim library hasn't been loaded.
	ErrLibraryNotLoaded = errors.New("libwebrtc_shim library not loaded")

	// ErrLibraryNotFound is returned when the shim library cannot be found.
	ErrLibraryNotFound = errors.New("libwebrtc_shim library not found")

	// FFI error sentinels - these match shim error codes and support errors.Is().
	ErrInvalidParam        = errors.New("invalid parameter")
	ErrInitFailed          = errors.New("initialization failed")
	ErrEncodeFailed        = errors.New("encode failed")
	ErrDecodeFailed        = errors.New("decode failed")
	ErrOutOfMemory         = errors.New("out of memory")
	ErrNotSupported        = errors.New("not supported")
	ErrNeedMoreData        = errors.New("need more data")
	ErrBufferTooSmall      = errors.New("buffer too small")
	ErrNotFound            = errors.New("not found")
	ErrRenegotiationNeeded = errors.New("renegotiation needed")
)
View Source
var ErrCaptureAlreadyStarted = errors.New("capture already started")

ErrCaptureAlreadyStarted is returned when trying to start a capture that's already running.

View Source
var ErrCaptureNotStarted = errors.New("capture not started")

ErrCaptureNotStarted is returned when trying to stop a capture that wasn't started.

View Source
var ErrVersionMismatch = errors.New("shim version mismatch")

ErrVersionMismatch is returned when the shim version doesn't match.

Functions

func AudioDecoderDecodeInto

func AudioDecoderDecodeInto(decoder uintptr, src []byte, samplesDst []byte) (numSamples int, err error)

AudioDecoderDecodeInto decodes encoded audio into a pre-allocated buffer. samplesDst must be pre-allocated (as bytes, will hold int16 samples). Returns the number of samples per channel decoded.

func AudioDecoderDestroy

func AudioDecoderDestroy(decoder uintptr)

AudioDecoderDestroy destroys an audio decoder.

func AudioEncoderDestroy

func AudioEncoderDestroy(encoder uintptr)

AudioEncoderDestroy destroys an audio encoder.

func AudioEncoderEncodeInto

func AudioEncoderEncodeInto(encoder uintptr, samples []byte, numSamples int, dst []byte) (int, error)

AudioEncoderEncodeInto encodes audio samples into a pre-allocated buffer. Returns the number of bytes written.

func AudioEncoderSetBitrate

func AudioEncoderSetBitrate(encoder uintptr, bitrate uint32) error

AudioEncoderSetBitrate updates the encoder bitrate.

func AudioTrackSourceCreate

func AudioTrackSourceCreate(pc uintptr, sampleRate, channels int) uintptr

AudioTrackSourceCreate creates an audio track source for frame injection.

func AudioTrackSourceDestroy

func AudioTrackSourceDestroy(source uintptr)

AudioTrackSourceDestroy destroys an audio track source.

func AudioTrackSourcePushFrame

func AudioTrackSourcePushFrame(source uintptr, samples []int16, numSamples int, timestampUs int64) error

AudioTrackSourcePushFrame pushes interleaved audio samples to the audio track source. numSamples is the number of samples per channel.

func BoolPtr

func BoolPtr(p *int32) uintptr

BoolPtr returns a uintptr to an int32 used as bool.

func ByteArrayToString

func ByteArrayToString(b []byte) string

ByteArrayToString converts a fixed-size byte array to a Go string, stopping at the first null byte.

func ByteSlicePtr

func ByteSlicePtr(b []byte) uintptr

ByteSlicePtr returns a uintptr to the first element of a byte slice. Returns 0 if the slice is empty.

func CString

func CString(s string) []byte

CString allocates a null-terminated C string from a Go string. The caller is responsible for keeping the returned byte slice alive for as long as the C code needs it.

func CStringToGo

func CStringToGo(b []byte) string

CStringToGo converts a null-terminated C string to a Go string.

func CheckCameraPermission

func CheckCameraPermission() bool

CheckCameraPermission checks if camera access is authorized. Returns true if authorized, false otherwise.

func CheckMicrophonePermission

func CheckMicrophonePermission() bool

CheckMicrophonePermission checks if microphone access is authorized. Returns true if authorized, false otherwise.

func CheckVersion

func CheckVersion() error

CheckVersion verifies the shim version matches what this Go code expects. Returns nil if versions match, ErrVersionMismatch otherwise.

func Close

func Close() error

Close unloads the shim library.

func CopyBytesFromC

func CopyBytesFromC(ptr uintptr, size int) []byte

CopyBytesFromC copies bytes from C memory to a new Go slice. Returns nil if ptr is 0 or size <= 0.

func CopyInt16FromC

func CopyInt16FromC(ptr uintptr, length int) []int16

CopyInt16FromC copies int16 values from C memory to a new Go slice. Returns nil if ptr is 0 or length <= 0.

func CopyStructFromC

func CopyStructFromC[T any](ptr uintptr) (T, bool)

CopyStructFromC copies a value of type T from C memory.

func CreateAudioDecoder

func CreateAudioDecoder(sampleRate, channels int) (uintptr, error)

CreateAudioDecoder creates an audio decoder.

func CreateAudioEncoder

func CreateAudioEncoder(config *AudioEncoderConfig) (uintptr, error)

CreateAudioEncoder creates an audio encoder.

func CreateDepacketizer

func CreateDepacketizer(codec CodecType) uintptr

CreateDepacketizer creates an RTP depacketizer.

func CreatePacketizer

func CreatePacketizer(config *PacketizerConfig) uintptr

CreatePacketizer creates an RTP packetizer.

func CreatePeerConnection

func CreatePeerConnection(config *PeerConnectionConfig) (uintptr, error)

CreatePeerConnection creates a new PeerConnection.

func CreateVideoDecoder

func CreateVideoDecoder(codec CodecType) (uintptr, error)

CreateVideoDecoder creates a video decoder for the specified codec.

func CreateVideoEncoder

func CreateVideoEncoder(codec CodecType, config *VideoEncoderConfig) (uintptr, error)

CreateVideoEncoder creates a video encoder for the specified codec.

func DataChannelClose

func DataChannelClose(dc uintptr)

DataChannelClose closes a data channel.

func DataChannelDestroy

func DataChannelDestroy(dc uintptr)

DataChannelDestroy destroys a data channel.

func DataChannelLabel

func DataChannelLabel(dc uintptr) string

DataChannelLabel returns the label of a data channel.

func DataChannelReadyState

func DataChannelReadyState(dc uintptr) int

DataChannelReadyState returns the ready state of a data channel.

func DataChannelSend

func DataChannelSend(dc uintptr, data []byte, isBinary bool) error

DataChannelSend sends data on a data channel.

func DataChannelSetOnClose

func DataChannelSetOnClose(dc uintptr, cb OnDataChannelStateCallback)

DataChannelSetOnClose sets the close callback for a data channel.

func DataChannelSetOnMessage

func DataChannelSetOnMessage(dc uintptr, cb OnDataChannelMessageCallback)

DataChannelSetOnMessage sets the message callback for a data channel.

func DataChannelSetOnOpen

func DataChannelSetOnOpen(dc uintptr, cb OnDataChannelStateCallback)

DataChannelSetOnOpen sets the open callback for a data channel.

func DepacketizerDestroy

func DepacketizerDestroy(depacketizer uintptr)

DepacketizerDestroy destroys a depacketizer.

func DepacketizerPopInto

func DepacketizerPopInto(depacketizer uintptr, dst []byte) (size int, timestamp uint32, isKeyframe bool, err error)

DepacketizerPopInto pops a complete frame into a pre-allocated buffer.

func DepacketizerPush

func DepacketizerPush(depacketizer uintptr, packet []byte) error

DepacketizerPush pushes an RTP packet for reassembly.

func GetAudioSinkCallbackPtr

func GetAudioSinkCallbackPtr() uintptr

GetAudioSinkCallbackPtr returns the purego callback pointer for audio sinks.

func GetVideoSinkCallbackPtr

func GetVideoSinkCallbackPtr() uintptr

GetVideoSinkCallbackPtr returns the purego callback pointer for video sinks.

func GoBytes

func GoBytes(ptr uintptr, size int) []byte

GoBytes copies C memory to a Go byte slice and frees the C memory.

func GoInt16Slice

func GoInt16Slice(ptr uintptr, numSamples int) []int16

GoInt16Slice copies C int16 array to a Go slice and frees the C memory.

func GoString

func GoString(ptr unsafe.Pointer) string

GoString converts a C string pointer to a Go string.

func GoStringFromC

func GoStringFromC(ptr uintptr) string

GoStringFromC converts a C string pointer (as uintptr) to a Go string. This is a convenience function that combines UnsafePointerFromC and GoString.

func Int16SlicePtr

func Int16SlicePtr(s []int16) uintptr

Int16SlicePtr returns a uintptr to the first element of an int16 slice.

func Int32Ptr

func Int32Ptr(p *int32) uintptr

Int32Ptr returns a uintptr to an int32 variable.

func Int32SlicePtr

func Int32SlicePtr(s []int32) uintptr

Int32SlicePtr returns a uintptr to the first element of an int32 slice.

func IntPtr

func IntPtr(p *int) uintptr

IntPtr returns a uintptr to an int variable.

func IsCodecSupported

func IsCodecSupported(mimeType string) bool

IsCodecSupported checks if a specific codec is supported.

func IsLoaded

func IsLoaded() bool

IsLoaded returns true if the shim library is loaded. Thread-safe due to atomic.Bool.

func LibWebRTCVersion

func LibWebRTCVersion() string

LibWebRTCVersion returns the libwebrtc version the shim was built with. Returns empty string if library is not loaded.

func LoadLibrary

func LoadLibrary() error

LoadLibrary loads the libwebrtc_shim shared library. It resolves the library in the following order: 1. Exact path specified by LIBWEBRTC_SHIM_PATH (authoritative if set) 2. ./lib/{os}_{arch}/ (module-relative) 3. Auto-download from GitHub Releases (unless disabled) 4. System library paths

func MustLoadLibrary

func MustLoadLibrary()

MustLoadLibrary loads the library and panics on failure.

func PacketizerDestroy

func PacketizerDestroy(packetizer uintptr)

PacketizerDestroy destroys a packetizer.

func PacketizerPacketizeInto

func PacketizerPacketizeInto(
	packetizer uintptr,
	data []byte,
	timestamp uint32,
	isKeyframe bool,
	dst []byte,
	offsets []int32,
	sizes []int32,
	maxPackets int,
) (int, error)

PacketizerPacketizeInto packetizes encoded data into RTP packets. Writes packets into dst buffer, returns packet count.

func PacketizerSequenceNumber

func PacketizerSequenceNumber(packetizer uintptr) uint16

PacketizerSequenceNumber returns the current sequence number.

func PeerConnectionAddAudioTrackFromSource

func PeerConnectionAddAudioTrackFromSource(pc, source uintptr, trackID, streamID string) uintptr

PeerConnectionAddAudioTrackFromSource adds an audio track using a source.

func PeerConnectionAddICECandidate

func PeerConnectionAddICECandidate(pc uintptr, candidate, sdpMid string, sdpMLineIndex int) error

PeerConnectionAddICECandidate adds an ICE candidate.

func PeerConnectionAddTrack

func PeerConnectionAddTrack(pc uintptr, codec CodecType, trackID, streamID string) uintptr

PeerConnectionAddTrack adds a track to the peer connection.

func PeerConnectionAddTransceiver

func PeerConnectionAddTransceiver(pc uintptr, kind MediaKind, direction TransceiverDirection, paramsConfig *RTPSendParameters) uintptr

PeerConnectionAddTransceiver adds a transceiver with the specified kind and direction.

func PeerConnectionAddVideoTrackFromSource

func PeerConnectionAddVideoTrackFromSource(pc, source uintptr, trackID, streamID string) uintptr

PeerConnectionAddVideoTrackFromSource adds a video track using a source.

func PeerConnectionClose

func PeerConnectionClose(pc uintptr)

PeerConnectionClose closes the peer connection.

func PeerConnectionConnectionState

func PeerConnectionConnectionState(pc uintptr) int

PeerConnectionConnectionState returns the connection state.

func PeerConnectionCreateAnswer

func PeerConnectionCreateAnswer(pc uintptr, sdpBuf []byte, options *webrtc.AnswerOptions) (int, error)

PeerConnectionCreateAnswer creates an SDP answer.

func PeerConnectionCreateDataChannel

func PeerConnectionCreateDataChannel(
	pc uintptr,
	label string,
	ordered bool,
	maxPacketLifeTime int,
	maxRetransmits int,
	protocol string,
	negotiated bool,
	id int,
) uintptr

PeerConnectionCreateDataChannel creates a data channel.

func PeerConnectionCreateOffer

func PeerConnectionCreateOffer(pc uintptr, sdpBuf []byte, options *webrtc.OfferOptions) (int, error)

PeerConnectionCreateOffer creates an SDP offer. Returns the SDP string written to the provided buffer.

func PeerConnectionDestroy

func PeerConnectionDestroy(pc uintptr)

PeerConnectionDestroy destroys a PeerConnection.

func PeerConnectionGetReceivers

func PeerConnectionGetReceivers(pc uintptr, maxReceivers int) ([]uintptr, error)

PeerConnectionGetReceivers gets all receivers associated with a PeerConnection.

func PeerConnectionGetSenders

func PeerConnectionGetSenders(pc uintptr, maxSenders int) ([]uintptr, error)

PeerConnectionGetSenders gets all senders associated with a PeerConnection.

func PeerConnectionGetStatsJSON

func PeerConnectionGetStatsJSON(pc uintptr) ([]byte, error)

PeerConnectionGetStatsJSON gets a structured stats report serialized as JSON.

func PeerConnectionGetTransceivers

func PeerConnectionGetTransceivers(pc uintptr, maxTransceivers int) ([]uintptr, error)

PeerConnectionGetTransceivers gets all transceivers associated with a PeerConnection.

func PeerConnectionICEConnectionState

func PeerConnectionICEConnectionState(pc uintptr) int

PeerConnectionICEConnectionState returns the ICE connection state.

func PeerConnectionICEGatheringState

func PeerConnectionICEGatheringState(pc uintptr) int

PeerConnectionICEGatheringState returns the ICE gathering state.

func PeerConnectionRemoveTrack

func PeerConnectionRemoveTrack(pc uintptr, sender uintptr) error

PeerConnectionRemoveTrack removes a track from the peer connection.

func PeerConnectionRestartICE

func PeerConnectionRestartICE(pc uintptr) error

PeerConnectionRestartICE triggers an ICE restart on the next offer.

func PeerConnectionSetLocalDescription

func PeerConnectionSetLocalDescription(pc uintptr, sdpType int, sdp string) error

PeerConnectionSetLocalDescription sets the local SDP description.

func PeerConnectionSetOnBandwidthEstimate

func PeerConnectionSetOnBandwidthEstimate(pc uintptr, cb BandwidthEstimateCallback) error

PeerConnectionSetOnBandwidthEstimate sets the bandwidth estimate callback. The current shim does not implement this surface and returns ErrNotSupported.

func PeerConnectionSetOnConnectionStateChange

func PeerConnectionSetOnConnectionStateChange(pc uintptr, cb ConnectionStateCallback)

PeerConnectionSetOnConnectionStateChange sets the connection state change callback.

func PeerConnectionSetOnDataChannel

func PeerConnectionSetOnDataChannel(pc uintptr, cb OnDataChannelCallback)

PeerConnectionSetOnDataChannel sets the on data channel callback.

func PeerConnectionSetOnICECandidate

func PeerConnectionSetOnICECandidate(pc uintptr, cb OnICECandidateCallback)

PeerConnectionSetOnICECandidate sets the on ICE candidate callback.

func PeerConnectionSetOnICEConnectionStateChange

func PeerConnectionSetOnICEConnectionStateChange(pc uintptr, cb ICEConnectionStateCallback)

PeerConnectionSetOnICEConnectionStateChange sets the ICE connection state change callback.

func PeerConnectionSetOnICEGatheringStateChange

func PeerConnectionSetOnICEGatheringStateChange(pc uintptr, cb ICEGatheringStateCallback)

PeerConnectionSetOnICEGatheringStateChange sets the ICE gathering state change callback.

func PeerConnectionSetOnNegotiationNeeded

func PeerConnectionSetOnNegotiationNeeded(pc uintptr, cb NegotiationNeededCallback)

PeerConnectionSetOnNegotiationNeeded sets the negotiation needed callback.

func PeerConnectionSetOnSignalingStateChange

func PeerConnectionSetOnSignalingStateChange(pc uintptr, cb SignalingStateCallback)

PeerConnectionSetOnSignalingStateChange sets the signaling state change callback.

func PeerConnectionSetOnTrack

func PeerConnectionSetOnTrack(pc uintptr, cb OnTrackCallback)

PeerConnectionSetOnTrack sets the on track callback.

func PeerConnectionSetRemoteDescription

func PeerConnectionSetRemoteDescription(pc uintptr, sdpType int, sdp string) error

PeerConnectionSetRemoteDescription sets the remote SDP description.

func PeerConnectionSignalingState

func PeerConnectionSignalingState(pc uintptr) int

PeerConnectionSignalingState returns the signaling state.

func PtrAt

func PtrAt(base uintptr, offset uintptr) uintptr

PtrAt returns pointer offset by n bytes from base.

func RTPReceiverGetTrack

func RTPReceiverGetTrack(receiver uintptr) uintptr

RTPReceiverGetTrack gets the track associated with a receiver.

func RTPReceiverSetJitterBufferMinDelay

func RTPReceiverSetJitterBufferMinDelay(receiver uintptr, minDelayMs int) error

RTPReceiverSetJitterBufferMinDelay sets the minimum jitter buffer delay. This sets a floor for libwebrtc's adaptive jitter buffer. The actual delay may be higher based on network conditions, but won't go below this value. Pass 0 to let libwebrtc's adaptive algorithm decide without a minimum floor.

func RTPSenderDestroy

func RTPSenderDestroy(sender uintptr)

RTPSenderDestroy destroys an RTP sender.

func RTPSenderGetActiveLayers

func RTPSenderGetActiveLayers(sender uintptr) (spatial, temporal int, err error)

RTPSenderGetActiveLayers gets the number of active layers.

func RTPSenderGetScalabilityMode

func RTPSenderGetScalabilityMode(sender uintptr) (string, error)

RTPSenderGetScalabilityMode gets the current scalability mode for a sender.

func RTPSenderGetTrack

func RTPSenderGetTrack(sender uintptr) uintptr

RTPSenderGetTrack gets the track associated with a sender.

func RTPSenderReplaceTrack

func RTPSenderReplaceTrack(sender uintptr, track uintptr) error

RTPSenderReplaceTrack replaces the track on an RTP sender.

func RTPSenderSetBitrate

func RTPSenderSetBitrate(sender uintptr, bitrate uint32) error

RTPSenderSetBitrate sets the bitrate for an RTP sender.

func RTPSenderSetLayerActive

func RTPSenderSetLayerActive(sender uintptr, rid string, active bool) error

RTPSenderSetLayerActive enables or disables a simulcast layer.

func RTPSenderSetLayerBitrate

func RTPSenderSetLayerBitrate(sender uintptr, rid string, maxBitrate uint32) error

RTPSenderSetLayerBitrate sets the maximum bitrate for a layer.

func RTPSenderSetOnRTCPFeedback

func RTPSenderSetOnRTCPFeedback(sender uintptr, cb RTCPFeedbackCallback) error

RTPSenderSetOnRTCPFeedback sets the RTCP feedback callback. The current shim does not implement this surface and returns ErrNotSupported.

func RTPSenderSetParameters

func RTPSenderSetParameters(sender uintptr, params *RTPSendParameters) error

RTPSenderSetParameters sets the RTP send parameters.

func RTPSenderSetPreferredCodec

func RTPSenderSetPreferredCodec(sender uintptr, mimeType string, payloadType int) error

RTPSenderSetPreferredCodec sets the preferred codec for a sender. Returns ErrNotFound if the codec was not negotiated. Returns ErrRenegotiationNeeded if SetParameters rejected the change.

func RTPSenderSetScalabilityMode

func RTPSenderSetScalabilityMode(sender uintptr, mode string) error

RTPSenderSetScalabilityMode sets the scalability mode for a sender.

func ReadFloat64FromC

func ReadFloat64FromC(ptr uintptr) float64

ReadFloat64FromC reads a float64 value from C memory at the given address.

func ReadInt32FromC

func ReadInt32FromC(ptr uintptr) int32

ReadInt32FromC reads an int32 value from C memory at the given address.

func ReadUint32FromC

func ReadUint32FromC(ptr uintptr) uint32

ReadUint32FromC reads a uint32 value from C memory at the given address.

func ReadUintptrFromC

func ReadUintptrFromC(ptr uintptr) uintptr

ReadUintptrFromC reads a uintptr value from C memory at the given address.

func RegisterAudioCallback

func RegisterAudioCallback(trackID uintptr, cb AudioFrameCallback)

RegisterAudioCallback registers an audio frame callback for a track. The trackID should be the track handle pointer value.

func RegisterVideoCallback

func RegisterVideoCallback(trackID uintptr, cb VideoFrameCallback)

RegisterVideoCallback registers a video frame callback for a track. The trackID should be the track handle pointer value.

func RequestCameraPermission

func RequestCameraPermission() bool

RequestCameraPermission requests camera access permission. On macOS, this shows the system permission dialog if needed. Returns true if authorized, false if denied. Note: This is a blocking call that may show a system dialog.

func RequestMicrophonePermission

func RequestMicrophonePermission() bool

RequestMicrophonePermission requests microphone access permission. On macOS, this shows the system permission dialog if needed. Returns true if authorized, false if denied. Note: This is a blocking call that may show a system dialog.

func ResetForTesting

func ResetForTesting()

ResetForTesting clears all callback registries. This should only be used in tests to ensure test isolation.

func ShimError

func ShimError(code int32) error

ShimError converts a shim error code to a Go error. Returns sentinel errors that support errors.Is() comparisons.

func ShimVersion

func ShimVersion() string

ShimVersion returns the shim library version. Returns empty string if library is not loaded.

func TrackID

func TrackID(track uintptr) string

TrackID returns the track ID.

func TrackKind

func TrackKind(track uintptr) string

TrackKind returns the track kind ("video" or "audio").

func TrackRemoveAudioSink

func TrackRemoveAudioSink(track uintptr)

TrackRemoveAudioSink removes an audio sink from a track.

func TrackRemoveVideoSink

func TrackRemoveVideoSink(track uintptr)

TrackRemoveVideoSink removes a video sink from a track.

func TrackSetAudioSink

func TrackSetAudioSink(track uintptr, callback uintptr, ctx uintptr) error

TrackSetAudioSink sets an audio frame callback on a remote track.

func TrackSetVideoSink

func TrackSetVideoSink(track uintptr, callback uintptr, ctx uintptr) error

TrackSetVideoSink sets a video frame callback on a remote track.

func TransceiverGetReceiver

func TransceiverGetReceiver(transceiver uintptr) uintptr

TransceiverGetReceiver gets the receiver associated with a transceiver.

func TransceiverGetSender

func TransceiverGetSender(transceiver uintptr) uintptr

TransceiverGetSender gets the sender associated with a transceiver.

func TransceiverMid

func TransceiverMid(transceiver uintptr) string

TransceiverMid gets the mid of a transceiver.

func TransceiverSetCodecPreferences

func TransceiverSetCodecPreferences(transceiver uintptr, codecs []CodecCapability) error

TransceiverSetCodecPreferences sets which codecs are negotiated for this transceiver. Must be called before creating offer/answer.

func TransceiverSetDirection

func TransceiverSetDirection(transceiver uintptr, direction TransceiverDirection) error

TransceiverSetDirection sets the direction of a transceiver.

func TransceiverStop

func TransceiverStop(transceiver uintptr) error

TransceiverStop stops the transceiver.

func Uint32Ptr

func Uint32Ptr(p *uint32) uintptr

Uint32Ptr returns a uintptr to a uint32 variable.

func UintptrFromSlice

func UintptrFromSlice[T any](s []T) uintptr

UintptrFromSlice returns a uintptr to the first element of any slice.

func UintptrPtr

func UintptrPtr(p *uintptr) uintptr

UintptrPtr returns a uintptr to a uintptr variable.

func UintptrSlicePtr

func UintptrSlicePtr(s []uintptr) uintptr

UintptrSlicePtr returns a uintptr to the first element of a uintptr slice.

func UnregisterAudioCallback

func UnregisterAudioCallback(trackID uintptr)

UnregisterAudioCallback removes an audio frame callback for a track.

func UnregisterBandwidthEstimateCallback

func UnregisterBandwidthEstimateCallback(pc uintptr)

UnregisterBandwidthEstimateCallback removes the bandwidth estimate callback for a PC.

func UnregisterConnectionStateCallback

func UnregisterConnectionStateCallback(pc uintptr)

UnregisterConnectionStateCallback removes the connection state callback for a PC.

func UnregisterDataChannelCallbacks

func UnregisterDataChannelCallbacks(dc uintptr)

UnregisterDataChannelCallbacks removes all callbacks for a data channel.

func UnregisterICEConnectionStateCallback

func UnregisterICEConnectionStateCallback(pc uintptr)

UnregisterICEConnectionStateCallback removes the ICE connection state callback for a PC.

func UnregisterICEGatheringStateCallback

func UnregisterICEGatheringStateCallback(pc uintptr)

UnregisterICEGatheringStateCallback removes the ICE gathering state callback for a PC.

func UnregisterNegotiationNeededCallback

func UnregisterNegotiationNeededCallback(pc uintptr)

UnregisterNegotiationNeededCallback removes the negotiation needed callback for a PC.

func UnregisterOnDataChannelCallback

func UnregisterOnDataChannelCallback(pc uintptr)

UnregisterOnDataChannelCallback removes the on data channel callback for a PC.

func UnregisterOnICECandidateCallback

func UnregisterOnICECandidateCallback(pc uintptr)

UnregisterOnICECandidateCallback removes the on ICE candidate callback for a PC.

func UnregisterOnTrackCallback

func UnregisterOnTrackCallback(pc uintptr)

UnregisterOnTrackCallback removes the on track callback for a PC.

func UnregisterRTCPFeedbackCallback

func UnregisterRTCPFeedbackCallback(sender uintptr)

UnregisterRTCPFeedbackCallback removes the RTCP feedback callback for a sender.

func UnregisterSignalingStateCallback

func UnregisterSignalingStateCallback(pc uintptr)

UnregisterSignalingStateCallback removes the signaling state callback for a PC.

func UnregisterVideoCallback

func UnregisterVideoCallback(trackID uintptr)

UnregisterVideoCallback removes a video frame callback for a track.

func UnsafePointerFromC

func UnsafePointerFromC(ptr uintptr) unsafe.Pointer

UnsafePointerFromC converts a uintptr from C to unsafe.Pointer. This is used for C string pointers returned by FFI functions.

func VideoDecoderDecodeInto

func VideoDecoderDecodeInto(
	decoder uintptr,
	src []byte,
	timestamp uint32,
	isKeyframe bool,
	yDst, uDst, vDst []byte,
) (width, height, yStride, uStride, vStride int, err error)

VideoDecoderDecodeInto decodes encoded video data into pre-allocated buffers. yDst, uDst, vDst must be pre-allocated with sufficient space. Returns the actual dimensions decoded.

func VideoDecoderDestroy

func VideoDecoderDestroy(decoder uintptr)

VideoDecoderDestroy destroys a video decoder.

func VideoEncoderDestroy

func VideoEncoderDestroy(encoder uintptr)

VideoEncoderDestroy destroys a video encoder.

func VideoEncoderEncodeInto

func VideoEncoderEncodeInto(
	encoder uintptr,
	yPlane, uPlane, vPlane []byte,
	yStride, uStride, vStride int,
	timestamp uint32,
	forceKeyframe bool,
	dst []byte,
) (n int, isKeyframe bool, err error)

VideoEncoderEncodeInto encodes a video frame into a pre-allocated buffer. Returns the number of bytes written, isKeyframe flag, and error. This is the allocation-free version - data is written directly to dst.

func VideoEncoderGetLastDependencyDescriptor

func VideoEncoderGetLastDependencyDescriptor(encoder uintptr, dst []byte) (int, error)

VideoEncoderGetLastDependencyDescriptor returns the serialized dependency descriptor payload for the most recent encoded frame, if available.

func VideoEncoderRequestKeyframe

func VideoEncoderRequestKeyframe(encoder uintptr) error

VideoEncoderRequestKeyframe requests the encoder to produce a keyframe.

func VideoEncoderSetBitrate

func VideoEncoderSetBitrate(encoder uintptr, bitrate uint32) error

VideoEncoderSetBitrate updates the encoder bitrate.

func VideoEncoderSetFramerate

func VideoEncoderSetFramerate(encoder uintptr, framerate float32) error

VideoEncoderSetFramerate updates the encoder framerate.

func VideoTrackSourceCreate

func VideoTrackSourceCreate(pc uintptr, width, height int) uintptr

VideoTrackSourceCreate creates a video track source for frame injection.

func VideoTrackSourceDestroy

func VideoTrackSourceDestroy(source uintptr)

VideoTrackSourceDestroy destroys a video track source.

func VideoTrackSourcePushFrame

func VideoTrackSourcePushFrame(source uintptr, yPlane, uPlane, vPlane []byte, yStride, uStride, vStride int, timestampUs int64) error

VideoTrackSourcePushFrame pushes an I420 frame to the video track source.

Types

type AudioCapture

type AudioCapture struct {
	// contains filtered or unexported fields
}

AudioCapture wraps a native audio capture device.

func NewAudioCapture

func NewAudioCapture(deviceID string, sampleRate, channels int) (*AudioCapture, error)

NewAudioCapture creates a new audio capture device. deviceID can be empty to use the default device.

func (*AudioCapture) Close

func (c *AudioCapture) Close()

Close releases the audio capture device.

func (*AudioCapture) IsRunning

func (c *AudioCapture) IsRunning() bool

IsRunning returns true if capture is active.

func (*AudioCapture) Start

func (c *AudioCapture) Start(callback AudioCaptureCallback) error

Start begins audio capture with the given callback.

func (*AudioCapture) Stop

func (c *AudioCapture) Stop()

Stop stops audio capture.

type AudioCaptureCallback

type AudioCaptureCallback func(frame *CapturedAudioFrame)

AudioCaptureCallback is called for each captured audio frame.

type AudioEncoderConfig

type AudioEncoderConfig struct {
	SampleRate int32
	Channels   int32
	BitrateBps uint32
}

AudioEncoderConfig matches ShimAudioEncoderConfig in shim.h

func (*AudioEncoderConfig) Ptr

func (c *AudioEncoderConfig) Ptr() uintptr

Ptr returns a pointer to the config as uintptr for FFI calls.

type AudioFrameCallback

type AudioFrameCallback func(samples []int16, sampleRate, channels int, timestampUs int64)

AudioFrameCallback is called when audio samples are received from a remote track.

type BandwidthEstimate

type BandwidthEstimate struct {
	TimestampUs      int64
	TargetBitrateBps int64
	AvailableSendBps int64
	AvailableRecvBps int64
	PacingRateBps    int64
	CongestionWindow int32

	LossRate float64
	// contains filtered or unexported fields
}

BandwidthEstimate matches ShimBandwidthEstimate in shim.h.

func PeerConnectionGetBandwidthEstimate

func PeerConnectionGetBandwidthEstimate(pc uintptr) (*BandwidthEstimate, error)

PeerConnectionGetBandwidthEstimate gets the current bandwidth estimate. The current shim does not implement this surface and returns ErrNotSupported.

func ReadBandwidthEstimateFromC

func ReadBandwidthEstimateFromC(ptr uintptr) *BandwidthEstimate

ReadBandwidthEstimateFromC copies a BandwidthEstimate from C memory.

type BandwidthEstimateCallback

type BandwidthEstimateCallback func(estimate *BandwidthEstimate)

BandwidthEstimateCallback is called when the bandwidth estimate changes.

type CapturedAudioFrame

type CapturedAudioFrame struct {
	Samples     []int16
	NumChannels int32
	SampleRate  int32
	TimestampUs int64
}

CapturedAudioFrame represents an audio frame captured from a device. Samples are S16LE interleaved. NOTE: int32 fields match C ABI (int = 32-bit)

type CapturedVideoFrame

type CapturedVideoFrame struct {
	YPlane      []byte
	UPlane      []byte
	VPlane      []byte
	Width       int32
	Height      int32
	YStride     int32
	UStride     int32
	VStride     int32
	TimestampUs int64
}

CapturedVideoFrame represents a video frame captured from a device. The frame data is in I420 (YUV420P) format. NOTE: int32 fields match C ABI (int = 32-bit)

type CodecCapability

type CodecCapability struct {
	MimeType    [64]byte
	ClockRate   int32
	Channels    int32
	SDPFmtpLine [256]byte
	PayloadType int32
}

CodecCapability matches ShimCodecCapability in shim.h.

func GetSupportedAudioCodecs

func GetSupportedAudioCodecs() ([]CodecCapability, error)

GetSupportedAudioCodecs returns a list of supported audio codecs.

func GetSupportedVideoCodecs

func GetSupportedVideoCodecs() ([]CodecCapability, error)

GetSupportedVideoCodecs returns a list of supported video codecs.

func RTPSenderGetNegotiatedCodecs

func RTPSenderGetNegotiatedCodecs(sender uintptr) ([]CodecCapability, error)

RTPSenderGetNegotiatedCodecs returns the list of codecs negotiated for a sender.

func TransceiverGetCodecPreferences

func TransceiverGetCodecPreferences(transceiver uintptr) ([]CodecCapability, error)

TransceiverGetCodecPreferences gets the codec preferences for this transceiver.

type CodecType

type CodecType int32

CodecType matches ShimCodecType in shim.h (int32 to match C int)

const (
	CodecH264 CodecType = 0
	CodecVP8  CodecType = 1
	CodecVP9  CodecType = 2
	CodecAV1  CodecType = 3
	CodecOpus CodecType = 10
)

type ConnectionStateCallback

type ConnectionStateCallback func(state int)

ConnectionStateCallback is called when the connection state changes.

type DependencyReport

type DependencyReport struct {
	Name                     string
	Path                     string
	Source                   string
	CacheDir                 string
	Available                bool
	DownloadDisabled         bool
	ExpectedVersion          string
	ActualVersion            string
	ExpectedLibWebRTCVersion string
	ActualLibWebRTCVersion   string
	VersionStatus            DiagnosticStatus
	ExpectedSHA256           string
	ActualSHA256             string
	ChecksumStatus           DiagnosticStatus
	BlockingIssues           []string
	Warnings                 []string
}

DependencyReport summarizes the runtime state for a dependency used by libgowebrtc.

type DeviceInfo

type DeviceInfo struct {
	DeviceID string
	Label    string
	Kind     DeviceKind
}

DeviceInfo represents information about a media device.

func EnumerateDevices

func EnumerateDevices() ([]DeviceInfo, error)

EnumerateDevices returns a list of available media devices.

type DeviceKind

type DeviceKind int

DeviceKind represents the type of media device.

const (
	// DeviceKindVideoInput represents a camera/video input device.
	DeviceKindVideoInput DeviceKind = 0
	// DeviceKindAudioInput represents a microphone/audio input device.
	DeviceKindAudioInput DeviceKind = 1
	// DeviceKindAudioOutput represents a speaker/audio output device.
	DeviceKindAudioOutput DeviceKind = 2
)

func (DeviceKind) String

func (k DeviceKind) String() string

String returns a string representation of the device kind.

type DiagnosticStatus

type DiagnosticStatus string

DiagnosticStatus describes the outcome of a runtime diagnostic check.

const (
	DiagnosticStatusUnknown    DiagnosticStatus = "unknown"
	DiagnosticStatusOK         DiagnosticStatus = "ok"
	DiagnosticStatusMissing    DiagnosticStatus = "missing"
	DiagnosticStatusMismatch   DiagnosticStatus = "mismatch"
	DiagnosticStatusUnverified DiagnosticStatus = "unverified"
)

type ICEConnectionStateCallback

type ICEConnectionStateCallback func(state int)

ICEConnectionStateCallback is called when the ICE connection state changes.

type ICEGatheringStateCallback

type ICEGatheringStateCallback func(state int)

ICEGatheringStateCallback is called when the ICE gathering state changes.

type ICEServerConfig

type ICEServerConfig struct {
	URLs       uintptr // Pointer to array of C strings
	URLCount   int32
	Username   *byte // C string
	Credential *byte // C string
}

ICEServerConfig matches ShimICEServer in shim.h

func (*ICEServerConfig) Ptr

func (c *ICEServerConfig) Ptr() uintptr

Ptr returns a pointer to the config as uintptr for FFI calls.

type MediaKind

type MediaKind int

MediaKind represents the kind of media.

const (
	MediaKindAudio MediaKind = 0
	MediaKindVideo MediaKind = 1
)

type NegotiationNeededCallback

type NegotiationNeededCallback func()

NegotiationNeededCallback is called when negotiation is needed.

type OnDataChannelCallback

type OnDataChannelCallback func(dc uintptr)

OnDataChannelCallback is called when a data channel is received.

type OnDataChannelMessageCallback

type OnDataChannelMessageCallback func(data []byte, isBinary bool)

DataChannel callback types

type OnDataChannelStateCallback

type OnDataChannelStateCallback func()

type OnICECandidateCallback

type OnICECandidateCallback func(candidate, sdpMid string, sdpMLineIndex int)

OnICECandidateCallback is called when an ICE candidate is generated.

type OnTrackCallback

type OnTrackCallback func(track uintptr, receiver uintptr, streams string)

OnTrackCallback is called when a remote track is received.

type PacketizerConfig

type PacketizerConfig struct {
	Codec       int32
	SSRC        uint32
	PayloadType uint8

	MTU       uint16
	ClockRate uint32
	// contains filtered or unexported fields
}

PacketizerConfig matches ShimPacketizerConfig in shim.h C layout: codec(4) + ssrc(4) + pt(1) + pad(1) + mtu(2) + clockrate(4) = 16 bytes

func (*PacketizerConfig) Ptr

func (c *PacketizerConfig) Ptr() uintptr

Ptr returns a pointer to the config as uintptr for FFI calls.

type PeerConnectionConfig

type PeerConnectionConfig struct {
	ICEServers           uintptr // Pointer to array of ICEServerConfig
	ICEServerCount       int32
	ICECandidatePoolSize int32
	ICETransportPolicy   *byte // C string
	BundlePolicy         *byte // C string
	RTCPMuxPolicy        *byte // C string
	SDPSemantics         *byte // C string
}

PeerConnectionConfig matches ShimPeerConnectionConfig in shim.h

func (*PeerConnectionConfig) Ptr

func (c *PeerConnectionConfig) Ptr() uintptr

Ptr returns a pointer to the config as uintptr for FFI calls.

type RTCPFeedbackCallback

type RTCPFeedbackCallback func(feedbackType int, ssrc uint32)

RTCPFeedbackCallback describes the future RTCP feedback callback surface.

type RTCStats

type RTCStats struct {
	TimestampUs              int64
	BytesSent                int64
	BytesReceived            int64
	PacketsSent              int64
	PacketsReceived          int64
	PacketsLost              int64
	RoundTripTimeMs          float64
	JitterMs                 float64
	AvailableOutgoingBitrate float64
	AvailableIncomingBitrate float64
	CurrentRTTMs             int64
	TotalRTTMs               int64
	ResponsesReceived        int64
	FramesEncoded            int32
	FramesDecoded            int32
	FramesDropped            int32
	KeyFramesEncoded         int32
	KeyFramesDecoded         int32
	NACKCount                int32
	PLICount                 int32
	FIRCount                 int32
	QPSum                    int32
	AudioLevel               float64
	TotalAudioEnergy         float64
	ConcealmentEvents        int32

	// SCTP/DataChannel stats
	DataChannelsOpened       int64
	DataChannelsClosed       int64
	MessagesSent             int64
	MessagesReceived         int64
	BytesSentDataChannel     int64
	BytesReceivedDataChannel int64

	// Quality limitation
	QualityLimitationReason     int32 // 0=none, 1=cpu, 2=bandwidth, 3=other
	QualityLimitationDurationMs int32

	// Remote inbound/outbound RTP stats
	RemotePacketsLost     int64
	RemoteJitterMs        float64
	RemoteRoundTripTimeMs float64

	// Jitter buffer stats (from RTCInboundRtpStreamStats)
	JitterBufferDelayMs        float64 // Total time spent in jitter buffer / emitted count
	JitterBufferTargetDelayMs  float64 // Target delay for adaptive buffer
	JitterBufferMinimumDelayMs float64 // User-configured minimum delay
	JitterBufferEmittedCount   int64   // Number of samples/frames emitted from buffer
}

RTCStats matches ShimRTCStats in shim.h

func PeerConnectionGetStats

func PeerConnectionGetStats(pc uintptr) (*RTCStats, error)

PeerConnectionGetStats gets connection statistics.

func RTPReceiverGetStats

func RTPReceiverGetStats(receiver uintptr) (*RTCStats, error)

RTPReceiverGetStats gets statistics for a receiver.

func RTPSenderGetStats

func RTPSenderGetStats(sender uintptr) (*RTCStats, error)

RTPSenderGetStats gets statistics for a sender. The current shim does not implement sender stats and returns ErrNotSupported.

type RTPEncodingParameters

type RTPEncodingParameters struct {
	RID                   [64]byte
	MaxBitrateBps         uint32
	MinBitrateBps         uint32
	MaxFramerate          float64
	ScaleResolutionDownBy float64
	Active                int32
	ScalabilityMode       [32]byte
}

RTPEncodingParameters matches ShimRTPEncodingParameters in shim.h

type RTPHeaderExtensionParameter

type RTPHeaderExtensionParameter struct {
	URI [256]byte
	ID  int32
}

RTPHeaderExtensionParameter matches ShimRTPHeaderExtensionParameter in shim.h

type RTPSendParameters

type RTPSendParameters struct {
	Encodings     uintptr
	EncodingCount int32

	HeaderExtensions     uintptr
	HeaderExtensionCount int32
	TransactionID        [64]byte
	// contains filtered or unexported fields
}

RTPSendParameters matches ShimRTPSendParameters in shim.h

func RTPSenderGetParameters

func RTPSenderGetParameters(sender uintptr, encodings []RTPEncodingParameters, headerExtensions []RTPHeaderExtensionParameter) (*RTPSendParameters, int, int, error)

RTPSenderGetParameters gets the current RTP send parameters.

type RuntimeDiagnosticsReport

type RuntimeDiagnosticsReport struct {
	Ready    bool
	Shim     DependencyReport
	OpenH264 DependencyReport
	Warnings []string
}

RuntimeDiagnosticsReport summarizes libgowebrtc runtime dependency state.

func CheckRuntimeDependencies

func CheckRuntimeDependencies() (*RuntimeDiagnosticsReport, error)

CheckRuntimeDependencies reports the currently configured runtime dependency state without downloading artifacts or mutating process-global loader state.

type ScreenCapture

type ScreenCapture struct {
	// contains filtered or unexported fields
}

ScreenCapture wraps a native screen/window capture.

func NewScreenCapture

func NewScreenCapture(id int64, isWindow bool, fps int) (*ScreenCapture, error)

NewScreenCapture creates a new screen or window capture.

func (*ScreenCapture) Close

func (c *ScreenCapture) Close()

Close releases the screen capture.

func (*ScreenCapture) IsRunning

func (c *ScreenCapture) IsRunning() bool

IsRunning returns true if capture is active.

func (*ScreenCapture) Start

func (c *ScreenCapture) Start(callback VideoCaptureCallback) error

Start begins screen capture with the given callback.

func (*ScreenCapture) Stop

func (c *ScreenCapture) Stop()

Stop stops screen capture.

type ScreenInfo

type ScreenInfo struct {
	ID       int64
	Title    string
	IsWindow bool
}

ScreenInfo represents information about a screen or window for capture.

func EnumerateScreens

func EnumerateScreens() ([]ScreenInfo, error)

EnumerateScreens returns a list of available screens and windows for capture.

type ShimErrorBuffer

type ShimErrorBuffer struct {
	Message [MaxErrorMsgLen]byte
}

ShimErrorBuffer matches the C struct for error message passing. This struct is memory-compatible with the C ShimErrorBuffer type.

func (*ShimErrorBuffer) Clear

func (e *ShimErrorBuffer) Clear()

Clear resets the error buffer.

func (*ShimErrorBuffer) Ptr

func (e *ShimErrorBuffer) Ptr() uintptr

Ptr returns a uintptr to this error buffer for FFI calls.

func (*ShimErrorBuffer) String

func (e *ShimErrorBuffer) String() string

String returns the error message as a Go string.

func (*ShimErrorBuffer) ToError

func (e *ShimErrorBuffer) ToError(code int32) error

ToError converts the error buffer and code to a Go error. Returns nil if code is ShimOK.

type ShimErrorWithMessage

type ShimErrorWithMessage struct {
	Code    int32
	Message string
}

ShimErrorWithMessage wraps a shim error code with a detailed message. It implements error and supports errors.Is()/errors.As().

func (*ShimErrorWithMessage) Error

func (e *ShimErrorWithMessage) Error() string

Error returns the error string including the message.

func (*ShimErrorWithMessage) Is

func (e *ShimErrorWithMessage) Is(target error) bool

Is implements errors.Is for sentinel error comparison.

func (*ShimErrorWithMessage) Unwrap

func (e *ShimErrorWithMessage) Unwrap() error

Unwrap returns the underlying sentinel error.

type SignalingStateCallback

type SignalingStateCallback func(state int)

SignalingStateCallback is called when the signaling state changes.

type TransceiverDirection

type TransceiverDirection int

TransceiverDirection represents the direction of a transceiver.

const (
	TransceiverDirectionSendRecv TransceiverDirection = 0
	TransceiverDirectionSendOnly TransceiverDirection = 1
	TransceiverDirectionRecvOnly TransceiverDirection = 2
	TransceiverDirectionInactive TransceiverDirection = 3
	TransceiverDirectionStopped  TransceiverDirection = 4
)

func TransceiverGetCurrentDirection

func TransceiverGetCurrentDirection(transceiver uintptr) TransceiverDirection

TransceiverGetCurrentDirection gets the current direction as negotiated in SDP.

func TransceiverGetDirection

func TransceiverGetDirection(transceiver uintptr) TransceiverDirection

TransceiverGetDirection gets the current direction of a transceiver.

type VideoCapture

type VideoCapture struct {
	// contains filtered or unexported fields
}

VideoCapture wraps a native video capture device.

func NewVideoCapture

func NewVideoCapture(deviceID string, width, height, fps int) (*VideoCapture, error)

NewVideoCapture creates a new video capture device. deviceID can be empty to use the default device.

func (*VideoCapture) Close

func (c *VideoCapture) Close()

Close releases the video capture device.

func (*VideoCapture) IsRunning

func (c *VideoCapture) IsRunning() bool

IsRunning returns true if capture is active.

func (*VideoCapture) Start

func (c *VideoCapture) Start(callback VideoCaptureCallback) error

Start begins video capture with the given callback.

func (*VideoCapture) Stop

func (c *VideoCapture) Stop()

Stop stops video capture.

type VideoCaptureCallback

type VideoCaptureCallback func(frame *CapturedVideoFrame)

VideoCaptureCallback is called for each captured video frame.

type VideoEncoderConfig

type VideoEncoderConfig struct {
	Width            int32
	Height           int32
	BitrateBps       uint32
	Framerate        float32
	KeyframeInterval int32
	H264Profile      *byte // C string pointer
	VP9Profile       int32
	PreferHW         int32 // bool as int
	ScalabilityMode  *byte // C string pointer
}

VideoEncoderConfig matches ShimVideoEncoderConfig in shim.h

func (*VideoEncoderConfig) Ptr

func (c *VideoEncoderConfig) Ptr() uintptr

Ptr returns a pointer to the config as uintptr for FFI calls.

type VideoFrameCallback

type VideoFrameCallback func(width, height int, yPlane, uPlane, vPlane []byte, yStride, uStride, vStride int, timestampUs int64)

VideoFrameCallback is called when a video frame is received from a remote track.

Jump to

Keyboard shortcuts

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