partially revert cabfcd6

This commit is contained in:
aler9
2022-12-22 20:36:41 +01:00
parent ae9dac0ad3
commit 5a2ea9cf9c
14 changed files with 9 additions and 25 deletions

View File

@@ -1059,6 +1059,8 @@ func (c *Client) doAnnounce(u *url.URL, medias media.Medias) (*base.Response, er
return nil, err
}
medias.SetControls()
byts, err := medias.Marshal(false).Marshal()
if err != nil {
return nil, err

View File

@@ -283,7 +283,6 @@ func TestClientRecordSerial(t *testing.T) {
medi := testH264Media
medias := media.Medias{medi}
medias.SetControls()
err = record(&c, scheme+"://localhost:8554/teststream", medias,
func(medi *media.Media, pkt rtcp.Packet) {
@@ -439,7 +438,6 @@ func TestClientRecordParallel(t *testing.T) {
medi := testH264Media
medias := media.Medias{medi}
medias.SetControls()
err = record(&c, scheme+"://localhost:8554/teststream", medias, nil)
require.NoError(t, err)
@@ -592,7 +590,6 @@ func TestClientRecordPauseSerial(t *testing.T) {
medi := testH264Media
medias := media.Medias{medi}
medias.SetControls()
err = record(&c, "rtsp://localhost:8554/teststream", medias, nil)
require.NoError(t, err)
@@ -723,7 +720,6 @@ func TestClientRecordPauseParallel(t *testing.T) {
medi := testH264Media
medias := media.Medias{medi}
medias.SetControls()
err = record(&c, "rtsp://localhost:8554/teststream", medias, nil)
require.NoError(t, err)
@@ -863,7 +859,6 @@ func TestClientRecordAutomaticProtocol(t *testing.T) {
medi := testH264Media
medias := media.Medias{medi}
medias.SetControls()
err = record(&c, "rtsp://localhost:8554/teststream", medias, nil)
require.NoError(t, err)
@@ -1045,7 +1040,6 @@ func TestClientRecordDecodeErrors(t *testing.T) {
}
medias := media.Medias{testH264Media}
medias.SetControls()
err = record(&c, "rtsp://localhost:8554/stream", medias, nil)
require.NoError(t, err)
@@ -1204,7 +1198,6 @@ func TestClientRecordRTCPReport(t *testing.T) {
medi := testH264Media
medias := media.Medias{medi}
medias.SetControls()
err = record(&c, "rtsp://localhost:8554/teststream", medias, nil)
require.NoError(t, err)
@@ -1333,7 +1326,6 @@ func TestClientRecordIgnoreTCPRTPPackets(t *testing.T) {
}
medias := media.Medias{testH264Media}
medias.SetControls()
err = record(&c, "rtsp://localhost:8554/teststream", medias,
func(medi *media.Media, pkt rtcp.Packet) {

View File

@@ -40,7 +40,6 @@ func main() {
Type: media.TypeAudio,
Formats: []format.Format{&format.G711{}},
}}
medias.SetControls()
c := gortsplib.Client{}

View File

@@ -40,7 +40,6 @@ func main() {
Type: media.TypeAudio,
Formats: []format.Format{&format.G722{}},
}}
medias.SetControls()
c := gortsplib.Client{}

View File

@@ -44,7 +44,6 @@ func main() {
PacketizationMode: 1,
}},
}}
medias.SetControls()
// connect to the server and start recording the media
c := gortsplib.Client{}

View File

@@ -43,7 +43,6 @@ func main() {
PayloadTyp: 96,
}},
}}
medias.SetControls()
// connect to the server and start recording the media
c := gortsplib.Client{}

View File

@@ -45,7 +45,6 @@ func main() {
ChannelCount: 1,
}},
}}
medias.SetControls()
c := gortsplib.Client{}

View File

@@ -51,7 +51,6 @@ func main() {
IndexDeltaLength: 3,
}},
}}
medias.SetControls()
// connect to the server and start recording the media
c := gortsplib.Client{}

View File

@@ -44,7 +44,6 @@ func main() {
ChannelCount: 2,
}},
}}
medias.SetControls()
c := gortsplib.Client{}

View File

@@ -43,7 +43,6 @@ func main() {
PayloadTyp: 96,
}},
}}
medias.SetControls()
// connect to the server and start recording the media
c := gortsplib.Client{}

View File

@@ -43,7 +43,6 @@ func main() {
PayloadTyp: 96,
}},
}}
medias.SetControls()
// connect to the server and start recording the media
c := gortsplib.Client{}

View File

@@ -45,7 +45,6 @@ func main() {
PacketizationMode: 1,
}},
}}
medias.SetControls()
// Client allows to set additional client options
c := &gortsplib.Client{

View File

@@ -46,7 +46,6 @@ func main() {
PacketizationMode: 1,
}},
}}
medias.SetControls()
// connect to the server and start recording the media
c := gortsplib.Client{}

View File

@@ -38,6 +38,13 @@ func main() {
log.Printf("republishing %d medias", len(medias))
// setup all medias
// this must be called before StartRecording(), that overrides the control attribute.
err = reader.SetupAll(medias, baseURL)
if err != nil {
panic(err)
}
// connect to the server and start recording the same medias
publisher := gortsplib.Client{}
err = publisher.StartRecording("rtsp://localhost:8554/mystream2", medias)
@@ -46,12 +53,6 @@ func main() {
}
defer publisher.Close()
// setup all medias
err = reader.SetupAll(medias, baseURL)
if err != nil {
panic(err)
}
// read RTP packets from reader and write them to publisher
reader.OnPacketRTPAny(func(medi *media.Media, forma format.Format, pkt *rtp.Packet) {
publisher.WritePacketRTP(medi, pkt)