@@ -64,21 +64,21 @@ func (m *Manager) TriggerDueStreams() error {
6464 errs = append (errs , fmt .Errorf ("getClient: %w" , err ))
6565 }
6666
67- resp , err := m .requestStreamVersion (ctx , s , client , lh . CombIP )
67+ resp , err := m .requestStreamVersion (ctx , s , client , lh , protobuf . StreamVersion_STREAM_VERSION_COMBINED )
6868 if err != nil && ! errors .Is (err , errNotNoLectureSource ) {
6969 errs = append (errs , fmt .Errorf ("RequestStream COMB: %w" , err ))
7070 continue
7171 }
7272 log .With ("stream" , s .ID , "job" , resp .JobId , "version" , model .COMB ).Info ("started Stream" )
7373
74- resp , err = m .requestStreamVersion (ctx , s , client , lh . PresIP )
74+ resp , err = m .requestStreamVersion (ctx , s , client , lh , protobuf . StreamVersion_STREAM_VERSION_PRESENTATION )
7575 if err != nil && ! errors .Is (err , errNotNoLectureSource ) {
7676 errs = append (errs , fmt .Errorf ("RequestStream PRES: %w" , err ))
7777 continue
7878 }
7979 log .With ("stream" , s .ID , "job" , resp .JobId , "version" , model .PRES ).Info ("started Stream" )
8080
81- resp , err = m .requestStreamVersion (ctx , s , client , lh . CamIP )
81+ resp , err = m .requestStreamVersion (ctx , s , client , lh , protobuf . StreamVersion_STREAM_VERSION_CAMERA )
8282 if err != nil && ! errors .Is (err , errNotNoLectureSource ) {
8383 errs = append (errs , fmt .Errorf ("RequestStream CAM: %w" , err ))
8484 continue
@@ -228,14 +228,21 @@ func (m *Manager) streamStarted(ctx context.Context, req *protobuf.StreamStartNo
228228
229229var errNotNoLectureSource = fmt .Errorf ("no source configured for this lecture hall ip" )
230230
231- func (m * Manager ) requestStreamVersion (ctx context.Context , s model.Stream , client protobuf.RunnerServiceClient , ip string ) (* protobuf.StreamResponse , error ) {
232- if ip == "" {
233- // not configured for this lecture hall
234- return & protobuf.StreamResponse {}, errNotNoLectureSource
231+ func (m * Manager ) requestStreamVersion (ctx context.Context , s model.Stream , client protobuf.RunnerServiceClient , lh model.LectureHall , version protobuf.StreamVersion ) (* protobuf.StreamResponse , error ) {
232+ var ip string
233+ switch version {
234+ case protobuf .StreamVersion_STREAM_VERSION_COMBINED :
235+ ip = lh .CombIP
236+ case protobuf .StreamVersion_STREAM_VERSION_CAMERA :
237+ ip = lh .CamIP
238+ case protobuf .StreamVersion_STREAM_VERSION_PRESENTATION :
239+ ip = lh .PresIP
240+ default :
241+ return nil , fmt .Errorf ("invalid stream version %v" , version )
235242 }
236243 return client .RequestStream (ctx , & protobuf.StreamRequest {
237244 StreamId : ptr .Take (uint64 (s .ID )),
238- Version : ptr .Take (protobuf . StreamVersion_STREAM_VERSION_COMBINED ),
245+ Version : ptr .Take (version ),
239246 End : timestamppb .New (s .End ),
240247 FfmpegOutputOptions : ptr .Take ("-c:a copy -c:v copy" ),
241248 Input : ptr .Take (fmt .Sprintf ("srt://%s" , ip )),
0 commit comments