solomax commented on a change in pull request #71: URL: https://github.com/apache/openmeetings/pull/71#discussion_r418361208
########## File path: openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/StreamProcessor.java ########## @@ -508,6 +510,12 @@ void addStream(KStream stream) { return streamByUid.values(); } + Collection<KStream> getStreamsByRoom(Long roomId) { Review comment: Maybe the name can be `getByRoom` It should be obvious StreamProcessor will return Streams :)) ########## File path: openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/KRoom.java ########## @@ -173,36 +163,36 @@ public void startRecording(StreamProcessor processor, Client c) { Optional<StreamDesc> osd = c.getScreenStream(); if (osd.isPresent()) { osd.get().addActivity(Activity.RECORD); - processor.getClientManager().update(c); + streamProcessor.getClientManager().update(c); rec.setWidth(osd.get().getWidth()); rec.setHeight(osd.get().getHeight()); } - rec = processor.getRecordingDao().update(rec); + rec = streamProcessor.getRecordingDao().update(rec); // Receive recordingId recordingId = rec.getId(); - for (final KStream stream : streams.values()) { - stream.startRecord(processor); - } + streamProcessor.getStreamsByRoom(this.getRoomId()).forEach( + stream -> stream.startRecord(streamProcessor) + ); // Send notification to all users that the recording has been started WebSocketHelper.sendRoom(new RoomMessage(roomId, u, RoomMessage.Type.RECORDING_TOGGLED)); log.debug("##REC:: recording in room {} is started {} ::", roomId, recordingId); } } - public void stopRecording(final StreamProcessor processor, Client c) { + public void stopRecording(Client c) { if (recordingStarted.compareAndSet(true, false)) { log.debug("##REC:: recording in room {} is stopping {} ::", roomId, recordingId); - for (final KStream stream : streams.values()) { - stream.stopRecord(); - } - Recording rec = processor.getRecordingDao().get(recordingId); + streamProcessor.getStreamsByRoom(this.getRoomId()).forEach( + stream -> stream.stopRecord() Review comment: You can replace the code lines 187-189 with ``` processor.getStreamsByRoom(this.getRoomId()).forEach(KStream::stopRecord); ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org