mirror of
https://github.com/aler9/rtsp-simple-server
synced 2025-11-02 20:04:01 +08:00
webrtc: return an error when proxying stream with no tracks (#3042)
This commit is contained in:
@@ -227,7 +227,7 @@ outer:
|
||||
// GatherIncomingTracks gathers incoming tracks.
|
||||
func (co *PeerConnection) GatherIncomingTracks(
|
||||
ctx context.Context,
|
||||
count int,
|
||||
maxCount int,
|
||||
) ([]*IncomingTrack, error) {
|
||||
var tracks []*IncomingTrack
|
||||
|
||||
@@ -237,7 +237,7 @@ func (co *PeerConnection) GatherIncomingTracks(
|
||||
for {
|
||||
select {
|
||||
case <-t.C:
|
||||
if count == 0 {
|
||||
if maxCount == 0 && len(tracks) != 0 {
|
||||
return tracks, nil
|
||||
}
|
||||
return nil, fmt.Errorf("deadline exceeded while waiting tracks")
|
||||
@@ -249,7 +249,7 @@ func (co *PeerConnection) GatherIncomingTracks(
|
||||
}
|
||||
tracks = append(tracks, track)
|
||||
|
||||
if len(tracks) == count || len(tracks) >= 2 {
|
||||
if len(tracks) == maxCount || len(tracks) >= 2 {
|
||||
return tracks, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user