nativeroom

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: MIT Imports: 26 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package nativeroom provides experimental opt-in LiveKit session transports.

Build with nativeinprocess to use NewInProcess. Pass the returned transport to worker.StartSessionOptions.Transport before connecting the job's Pion room. Pre-connect audio is enabled by default; RoomOptions controls its timeout and opt-out. Native owns receive playout, reconnect, and both media directions.

One FFI runtime is shared by all native sessions in the process. Close session transports first, then call CloseInProcessRuntime once during worker shutdown. Runtime disposal is terminal; the native library cannot be swapped or reopened. Construction does not select a transport globally or load the native library.

New retains the existing helper-process transport. Neither constructor changes the worker's default transport. See examples/starter/packaging/INPROCESS.md for build, library installation and rollback instructions.

Index

Constants

This section is empty.

Variables

View Source
var ErrSourceEnded = errors.New("native room source ended")

Functions

func DownloadNativeLibrary

func DownloadNativeLibrary(ctx context.Context) error

DownloadNativeLibrary installs the pinned runtime, verifying the archive before atomically replacing the destination. It never changes transport selection.

func NativeLibraryPath

func NativeLibraryPath() (string, error)

NativeLibraryPath resolves the explicit override or the application-local install. It does not download or load the library.

Types

type Cleanup

type Cleanup struct {
	Mode               string  `json:"mode,omitempty"`
	NativeCleanupMS    float64 `json:"native_cleanup_ms"`
	PID                int     `json:"pid"`
	Reaped             bool    `json:"reaped"`
	ExitCode           int     `json:"exit_code"`
	KillAttempted      bool    `json:"kill_attempted"`
	CleanupMS          float64 `json:"cleanup_ms"`
	ShutdownSeen       bool    `json:"shutdown_seen"`
	DisconnectCallback bool    `json:"disconnect_callback"`
	HandlesReleased    bool    `json:"handles_released"`
	RuntimeDisposed    bool    `json:"runtime_disposed"`
	CallbackOverflow   bool    `json:"callback_overflow"`
}

Cleanup is published after connection teardown and PCM-consumer shutdown. Helper mode reports child/native shutdown flags. In-process mode never sets Reaped or RuntimeDisposed: global disposal belongs to worker shutdown.

type Config

type Config struct {
	// ParticipantDisconnected runs off the FFI owner, before source-ended job shutdown.
	// The callback must return promptly and must not synchronously close this room.
	ParticipantDisconnected func(string)

	Binary, Library                   string
	URL, Token, Participant, TrackSID string
	// contains filtered or unexported fields
}

type Continuity

type Continuity struct {
	WallSeconds       float64 `json:"wall_seconds"`
	PCMSeconds        float64 `json:"pcm_seconds"`
	TotalPCMSeconds   float64 `json:"total_pcm_seconds"`
	MaxGapMS          float64 `json:"max_gap_ms"`
	SinceLastFrameMS  float64 `json:"since_last_frame_ms"`
	FirstFrameDelayMS float64 `json:"first_frame_delay_ms"`
}

Continuity measures application callback delivery using the parent's monotonic clock. It observes PCM; it never schedules, drops, or synthesizes frames.

type Room

type Room struct {
	Config            Config
	APIKey, APISecret string
	Job               *worker.JobContext
	Session           *agent.AgentSession
	DeleteRoomOnClose bool
	// contains filtered or unexported fields
}

Room owns one native connection and uses the worker-assigned primary token. It never connects the prepared Pion room or creates a second agent identity.

func New

func New(job *worker.JobContext, session *agent.AgentSession, cfg Config, key, secret string) *Room

func (*Room) AttachRoom

func (r *Room) AttachRoom(*worker.SDKRoom)

func (*Room) BeginShutdown

func (r *Room) BeginShutdown()

func (*Room) CleanupDiagnostics

func (r *Room) CleanupDiagnostics() (Cleanup, bool)

CleanupDiagnostics returns a stable snapshot only once the child is reaped.

func (*Room) Close

func (r *Room) Close() error

func (*Room) GetCallback

func (r *Room) GetCallback() *worker.RoomCallback

func (*Room) PopulateSessionReport

func (r *Room) PopulateSessionReport(report *agent.SessionReport)

func (*Room) ReconcileParticipants

func (r *Room) ReconcileParticipants()

func (*Room) Start

func (r *Room) Start(ctx context.Context) error

func (*Room) StartRecorder

func (r *Room) StartRecorder(path string, rate int) error

func (*Room) StopRecorder

func (r *Room) StopRecorder() error

Jump to

Keyboard shortcuts

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