Live video on the AT Protocol
fork

Configure Feed

Select the types of activity you want to include in your feed.

playback: cleanup from code review

Eli Mallon 61ac6641 0f9a3870

+2 -23
-1
pkg/e2etest/e2etest.go
··· 1 - package e2etest
+2 -17
pkg/media/webrtc_playback.go
··· 32 32 ctx, cancel := context.WithCancel(ctx) //nolint:all 33 33 34 34 pipelineSlice := []string{ 35 - "h264parse name=videoparse ! video/x-h264,stream-format=byte-stream ! appsink sync=false name=videoappsink", 36 - "opusparse name=audioparse ! appsink sync=false name=audioappsink", 35 + "h264parse name=videoparse ! video/x-h264,stream-format=byte-stream ! appsink name=videoappsink", 36 + "opusparse name=audioparse ! appsink name=audioappsink", 37 37 } 38 38 39 39 pipeline, err := gst.NewPipelineFromString(strings.Join(pipelineSlice, "\n")) ··· 203 203 } 204 204 }() 205 205 206 - started := time.Now() 207 - elapsed := time.Duration(0) 208 - 209 - go func() { 210 - for { 211 - select { 212 - case <-ctx.Done(): 213 - return 214 - case <-time.After(time.Second * 5): 215 - log.Log(ctx, "check elapsed", "elapsed", elapsed, "duration", time.Since(started)) 216 - } 217 - } 218 - }() 219 - 220 206 var lastVideoDuration = &DefaultDuration 221 207 222 208 go func() { ··· 248 234 if dur != nil { 249 235 mediaSample.Duration = *dur 250 236 lastVideoDuration = dur 251 - elapsed += *dur 252 237 } else if lastVideoDuration != nil { 253 238 // log.Log(ctx, "no video duration, using last duration", "lastVideoDuration", lastVideoDuration) 254 239 mediaSample.Duration = *lastVideoDuration
-5
pkg/media/webrtc_playback2.go
··· 14 14 "stream.place/streamplace/pkg/spmetrics" 15 15 ) 16 16 17 - // we have a bug that prevents us from correctly probing video durations 18 - // a lot of the time. so when we don't have them we use the last duration 19 - // that we had, and when we don't have that we use a default duration 20 - var DefaultDuration2 = time.Duration(32 * time.Millisecond) 21 - 22 17 // This function remains in scope for the duration of a single users' playback 23 18 func (mm *MediaManager) WebRTCPlayback2(ctx context.Context, user string, rendition string, offer *webrtc.SessionDescription) (*webrtc.SessionDescription, error) { 24 19 uu, err := uuid.NewV7()