Documentation
¶
Overview ¶
Package talk plays audio from an RTSP client through a camera's speaker.
The camera side is internal/baichuan's: OpenTalk negotiates the session and Talk carries the blocks. What this package adds is the conversion between the two ends. An RTSP back channel arrives as G.711 at 8 kHz in packets of whatever size the client chose; the cameras surveyed here take IMA ADPCM at 16 kHz in blocks of exactly 1024 samples. So audio is resampled to the camera's rate, collected until a whole block is there, and sent a block at a time.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrClosed = errors.New("talk: session closed")
ErrClosed is Write after Close.
Functions ¶
func Listen ¶ added in v0.2.16
Listen gives silence, in blocks of 1024 samples at 16 kHz paced by the camera's own talk return, while someone talking through the camera has spoken within muteHold; nothing arrives otherwise. A listener that falls behind loses blocks rather than holding the talk session up.
Types ¶
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session is one talk session on its own camera connection, separate from the ones carrying video, so talking never risks a stream.
func (*Session) Ping ¶
Ping keeps the connection alive between bursts of speech. The camera sends nothing back during a talk session, and a connection that hears nothing for baichuan.DefaultIdleTimeout gives up on itself.
func (*Session) Returns ¶ added in v0.2.16
func (s *Session) Returns() <-chan baichuan.TalkReturn
Returns gives the camera's talk return blocks, in order, until the session closes. A camera whose returns do not parse sends nothing here.
func (*Session) SetGain ¶ added in v0.2.6
SetGain sets the talk gain in dB (config talk_gain_db) for what Write sends from now on.