improve examples (#778)

This commit is contained in:
Alessandro Ros
2025-05-04 17:00:18 +02:00
committed by GitHub
parent 4e3c5e6c0d
commit cc0c96626c
55 changed files with 494 additions and 435 deletions

View File

@@ -13,9 +13,9 @@ import (
)
// This example shows how to
// 1. generate a dummy G711 audio stream
// 2. connect to a RTSP server, find a back channel that supports G711
// 3. route the G711 stream to the channel
// 1. generate a dummy G711 audio stream.
// 2. connect to a RTSP server, find a back channel that supports G711.
// 3. route the G711 stream to the channel.
func multiplyAndDivide(v, m, d int64) int64 {
secs := v / d
@@ -72,7 +72,7 @@ func main() {
// find the back channel
medi, forma := findG711BackChannel(desc)
if medi == nil {
panic("media not found")
panic("back channel not found")
}
// setup a single media
@@ -137,7 +137,7 @@ func main() {
for _, pkt := range pkts {
pkt.Timestamp += uint32(int64(randomStart) + prevPTS)
err = c.WritePacketRTP(desc.Medias[0], pkt)
err = c.WritePacketRTP(medi, pkt)
if err != nil {
panic(err)
}