mirror of
https://github.com/aler9/gortsplib
synced 2025-09-28 03:52:12 +08:00
partially revert cabfcd6
This commit is contained in:
@@ -1059,6 +1059,8 @@ func (c *Client) doAnnounce(u *url.URL, medias media.Medias) (*base.Response, er
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
medias.SetControls()
|
||||||
|
|
||||||
byts, err := medias.Marshal(false).Marshal()
|
byts, err := medias.Marshal(false).Marshal()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@@ -283,7 +283,6 @@ func TestClientRecordSerial(t *testing.T) {
|
|||||||
|
|
||||||
medi := testH264Media
|
medi := testH264Media
|
||||||
medias := media.Medias{medi}
|
medias := media.Medias{medi}
|
||||||
medias.SetControls()
|
|
||||||
|
|
||||||
err = record(&c, scheme+"://localhost:8554/teststream", medias,
|
err = record(&c, scheme+"://localhost:8554/teststream", medias,
|
||||||
func(medi *media.Media, pkt rtcp.Packet) {
|
func(medi *media.Media, pkt rtcp.Packet) {
|
||||||
@@ -439,7 +438,6 @@ func TestClientRecordParallel(t *testing.T) {
|
|||||||
|
|
||||||
medi := testH264Media
|
medi := testH264Media
|
||||||
medias := media.Medias{medi}
|
medias := media.Medias{medi}
|
||||||
medias.SetControls()
|
|
||||||
|
|
||||||
err = record(&c, scheme+"://localhost:8554/teststream", medias, nil)
|
err = record(&c, scheme+"://localhost:8554/teststream", medias, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@@ -592,7 +590,6 @@ func TestClientRecordPauseSerial(t *testing.T) {
|
|||||||
|
|
||||||
medi := testH264Media
|
medi := testH264Media
|
||||||
medias := media.Medias{medi}
|
medias := media.Medias{medi}
|
||||||
medias.SetControls()
|
|
||||||
|
|
||||||
err = record(&c, "rtsp://localhost:8554/teststream", medias, nil)
|
err = record(&c, "rtsp://localhost:8554/teststream", medias, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@@ -723,7 +720,6 @@ func TestClientRecordPauseParallel(t *testing.T) {
|
|||||||
|
|
||||||
medi := testH264Media
|
medi := testH264Media
|
||||||
medias := media.Medias{medi}
|
medias := media.Medias{medi}
|
||||||
medias.SetControls()
|
|
||||||
|
|
||||||
err = record(&c, "rtsp://localhost:8554/teststream", medias, nil)
|
err = record(&c, "rtsp://localhost:8554/teststream", medias, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@@ -863,7 +859,6 @@ func TestClientRecordAutomaticProtocol(t *testing.T) {
|
|||||||
|
|
||||||
medi := testH264Media
|
medi := testH264Media
|
||||||
medias := media.Medias{medi}
|
medias := media.Medias{medi}
|
||||||
medias.SetControls()
|
|
||||||
|
|
||||||
err = record(&c, "rtsp://localhost:8554/teststream", medias, nil)
|
err = record(&c, "rtsp://localhost:8554/teststream", medias, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@@ -1045,7 +1040,6 @@ func TestClientRecordDecodeErrors(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
medias := media.Medias{testH264Media}
|
medias := media.Medias{testH264Media}
|
||||||
medias.SetControls()
|
|
||||||
|
|
||||||
err = record(&c, "rtsp://localhost:8554/stream", medias, nil)
|
err = record(&c, "rtsp://localhost:8554/stream", medias, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@@ -1204,7 +1198,6 @@ func TestClientRecordRTCPReport(t *testing.T) {
|
|||||||
|
|
||||||
medi := testH264Media
|
medi := testH264Media
|
||||||
medias := media.Medias{medi}
|
medias := media.Medias{medi}
|
||||||
medias.SetControls()
|
|
||||||
|
|
||||||
err = record(&c, "rtsp://localhost:8554/teststream", medias, nil)
|
err = record(&c, "rtsp://localhost:8554/teststream", medias, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@@ -1333,7 +1326,6 @@ func TestClientRecordIgnoreTCPRTPPackets(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
medias := media.Medias{testH264Media}
|
medias := media.Medias{testH264Media}
|
||||||
medias.SetControls()
|
|
||||||
|
|
||||||
err = record(&c, "rtsp://localhost:8554/teststream", medias,
|
err = record(&c, "rtsp://localhost:8554/teststream", medias,
|
||||||
func(medi *media.Media, pkt rtcp.Packet) {
|
func(medi *media.Media, pkt rtcp.Packet) {
|
||||||
|
@@ -40,7 +40,6 @@ func main() {
|
|||||||
Type: media.TypeAudio,
|
Type: media.TypeAudio,
|
||||||
Formats: []format.Format{&format.G711{}},
|
Formats: []format.Format{&format.G711{}},
|
||||||
}}
|
}}
|
||||||
medias.SetControls()
|
|
||||||
|
|
||||||
c := gortsplib.Client{}
|
c := gortsplib.Client{}
|
||||||
|
|
||||||
|
@@ -40,7 +40,6 @@ func main() {
|
|||||||
Type: media.TypeAudio,
|
Type: media.TypeAudio,
|
||||||
Formats: []format.Format{&format.G722{}},
|
Formats: []format.Format{&format.G722{}},
|
||||||
}}
|
}}
|
||||||
medias.SetControls()
|
|
||||||
|
|
||||||
c := gortsplib.Client{}
|
c := gortsplib.Client{}
|
||||||
|
|
||||||
|
@@ -44,7 +44,6 @@ func main() {
|
|||||||
PacketizationMode: 1,
|
PacketizationMode: 1,
|
||||||
}},
|
}},
|
||||||
}}
|
}}
|
||||||
medias.SetControls()
|
|
||||||
|
|
||||||
// connect to the server and start recording the media
|
// connect to the server and start recording the media
|
||||||
c := gortsplib.Client{}
|
c := gortsplib.Client{}
|
||||||
|
@@ -43,7 +43,6 @@ func main() {
|
|||||||
PayloadTyp: 96,
|
PayloadTyp: 96,
|
||||||
}},
|
}},
|
||||||
}}
|
}}
|
||||||
medias.SetControls()
|
|
||||||
|
|
||||||
// connect to the server and start recording the media
|
// connect to the server and start recording the media
|
||||||
c := gortsplib.Client{}
|
c := gortsplib.Client{}
|
||||||
|
@@ -45,7 +45,6 @@ func main() {
|
|||||||
ChannelCount: 1,
|
ChannelCount: 1,
|
||||||
}},
|
}},
|
||||||
}}
|
}}
|
||||||
medias.SetControls()
|
|
||||||
|
|
||||||
c := gortsplib.Client{}
|
c := gortsplib.Client{}
|
||||||
|
|
||||||
|
@@ -51,7 +51,6 @@ func main() {
|
|||||||
IndexDeltaLength: 3,
|
IndexDeltaLength: 3,
|
||||||
}},
|
}},
|
||||||
}}
|
}}
|
||||||
medias.SetControls()
|
|
||||||
|
|
||||||
// connect to the server and start recording the media
|
// connect to the server and start recording the media
|
||||||
c := gortsplib.Client{}
|
c := gortsplib.Client{}
|
||||||
|
@@ -44,7 +44,6 @@ func main() {
|
|||||||
ChannelCount: 2,
|
ChannelCount: 2,
|
||||||
}},
|
}},
|
||||||
}}
|
}}
|
||||||
medias.SetControls()
|
|
||||||
|
|
||||||
c := gortsplib.Client{}
|
c := gortsplib.Client{}
|
||||||
|
|
||||||
|
@@ -43,7 +43,6 @@ func main() {
|
|||||||
PayloadTyp: 96,
|
PayloadTyp: 96,
|
||||||
}},
|
}},
|
||||||
}}
|
}}
|
||||||
medias.SetControls()
|
|
||||||
|
|
||||||
// connect to the server and start recording the media
|
// connect to the server and start recording the media
|
||||||
c := gortsplib.Client{}
|
c := gortsplib.Client{}
|
||||||
|
@@ -43,7 +43,6 @@ func main() {
|
|||||||
PayloadTyp: 96,
|
PayloadTyp: 96,
|
||||||
}},
|
}},
|
||||||
}}
|
}}
|
||||||
medias.SetControls()
|
|
||||||
|
|
||||||
// connect to the server and start recording the media
|
// connect to the server and start recording the media
|
||||||
c := gortsplib.Client{}
|
c := gortsplib.Client{}
|
||||||
|
@@ -45,7 +45,6 @@ func main() {
|
|||||||
PacketizationMode: 1,
|
PacketizationMode: 1,
|
||||||
}},
|
}},
|
||||||
}}
|
}}
|
||||||
medias.SetControls()
|
|
||||||
|
|
||||||
// Client allows to set additional client options
|
// Client allows to set additional client options
|
||||||
c := &gortsplib.Client{
|
c := &gortsplib.Client{
|
||||||
|
@@ -46,7 +46,6 @@ func main() {
|
|||||||
PacketizationMode: 1,
|
PacketizationMode: 1,
|
||||||
}},
|
}},
|
||||||
}}
|
}}
|
||||||
medias.SetControls()
|
|
||||||
|
|
||||||
// connect to the server and start recording the media
|
// connect to the server and start recording the media
|
||||||
c := gortsplib.Client{}
|
c := gortsplib.Client{}
|
||||||
|
@@ -38,6 +38,13 @@ func main() {
|
|||||||
|
|
||||||
log.Printf("republishing %d medias", len(medias))
|
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
|
// connect to the server and start recording the same medias
|
||||||
publisher := gortsplib.Client{}
|
publisher := gortsplib.Client{}
|
||||||
err = publisher.StartRecording("rtsp://localhost:8554/mystream2", medias)
|
err = publisher.StartRecording("rtsp://localhost:8554/mystream2", medias)
|
||||||
@@ -46,12 +53,6 @@ func main() {
|
|||||||
}
|
}
|
||||||
defer publisher.Close()
|
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
|
// read RTP packets from reader and write them to publisher
|
||||||
reader.OnPacketRTPAny(func(medi *media.Media, forma format.Format, pkt *rtp.Packet) {
|
reader.OnPacketRTPAny(func(medi *media.Media, forma format.Format, pkt *rtp.Packet) {
|
||||||
publisher.WritePacketRTP(medi, pkt)
|
publisher.WritePacketRTP(medi, pkt)
|
||||||
|
Reference in New Issue
Block a user