Skip to content

Commit

Permalink
fix stream stop
Browse files Browse the repository at this point in the history
Former-commit-id: 390f8eec8b341d6274de3fbe3025d9fef299b97d [formerly 620e585c076d26b4015499e1e093cfd4baa8f1e2] [formerly 5ddbbb6abcd576cb3bb4ad273582332d0c89514f [formerly 0dedfac]]
Former-commit-id: 22250457f1af628483174238844231ab121cfc54 [formerly 4b87d89ec5dfd4631c700671994db995854177b9]
Former-commit-id: cc533d999b1abd3a9233763427fbc400d50f6fa4
  • Loading branch information
notedit committed Apr 22, 2019
1 parent c45beec commit 3deceb3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
3 changes: 2 additions & 1 deletion incomingstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,14 +311,15 @@ func (i *IncomingStream) Stop() {
return
}

i.Lock()
for k, track := range i.tracks {
track.Stop()
delete(i.tracks, k)
}
i.Unlock()

for _, stopFunc := range i.onStopListeners {
stopFunc()
}

i.transport = nil
}
10 changes: 4 additions & 6 deletions incomingstreamtrack.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package mediaserver

import (
"fmt"
"sort"
"strconv"
"time"
Expand Down Expand Up @@ -238,8 +237,6 @@ func NewIncomingStreamTrack(media string, id string, receiver native.RTPReceiver
return track.encodings[i].id < track.encodings[j].id
})

fmt.Println(track.encodings)

return track
}

Expand Down Expand Up @@ -504,9 +501,10 @@ func (i *IncomingStreamTrack) Stop() {
encoding.depacketizer.Stop()
native.DeleteStreamTrackDepacketizer(encoding.depacketizer)
}
if encoding.source != nil {
native.DeleteRTPIncomingSourceGroup(encoding.source)
}
// does not
// if encoding.source != nil {
// native.DeleteRTPIncomingSourceGroup(encoding.source)
// }
}

if i.mediaStreamDuplicater != nil {
Expand Down
4 changes: 2 additions & 2 deletions transport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func Test_TransportCreateStream(t *testing.T) {

fmt.Println(incoming)

// incoming.Stop()
// transport.Stop()
//incoming.Stop()
transport.Stop()

}

0 comments on commit 3deceb3

Please sign in to comment.