mirror of
https://github.com/aler9/gortsplib
synced 2025-10-04 06:46:42 +08:00
client: do not override media controls inside Announce()
this fixes the client-read-republish example and allows users to set their own media controls. Function medias.SetControls() is provided in order to automatically set media controls and must be called manually.
This commit is contained in:
@@ -36,7 +36,7 @@ func main() {
|
||||
log.Println("stream connected")
|
||||
|
||||
// create a media that contains a LPCM format
|
||||
medi := &media.Media{
|
||||
medias := media.Medias{&media.Media{
|
||||
Type: media.TypeAudio,
|
||||
Formats: []format.Format{&format.LPCM{
|
||||
PayloadTyp: 96,
|
||||
@@ -44,13 +44,13 @@ func main() {
|
||||
SampleRate: 44100,
|
||||
ChannelCount: 1,
|
||||
}},
|
||||
}
|
||||
}}
|
||||
medias.SetControls()
|
||||
|
||||
c := gortsplib.Client{}
|
||||
|
||||
// connect to the server and start recording the media
|
||||
err = c.StartRecording("rtsp://localhost:8554/mystream",
|
||||
media.Medias{medi})
|
||||
err = c.StartRecording("rtsp://localhost:8554/mystream", medias)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -65,7 +65,7 @@ func main() {
|
||||
}
|
||||
|
||||
// route RTP packet to the server
|
||||
err = c.WritePacketRTP(medi, &pkt)
|
||||
err = c.WritePacketRTP(medias[0], &pkt)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user