forked from External/mediamtx
webrtc: return an error when proxying stream with no tracks (#3042)
This commit is contained in:
parent
6e721201ed
commit
a52f550ee6
2 changed files with 34 additions and 3 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue