devopvoid / webrtc-java

WebRTC for desktop platforms running Java
Apache License 2.0
248 stars 60 forks source link

frame error causing system crush #73

Closed kinsleykajiva closed 2 years ago

kinsleykajiva commented 2 years ago

Describe the bug I have a set-up, I am using Janus gateway for my desktop app, using JavaFX 17. My app when I get streams from two participating in the room it works well, the streams come in nice (the one remote stream) , but as soon as I get three or more streams the app crushes closing the whole app. but I do not get any crash logs or stack traces in the console.

I suspect the frame object that Ontrack (). when I push the frame I think frame. retain(); is a problem.

To Reproduce Steps to reproduce the behaviour: the code below is called from the onTrack method , my video view is set in a VBox node


 public void publishFrame(VideoTrack videoTrack, VideoFrame frame) {
                            Platform.runLater(() -> {
                                centerRoot.getChildren().stream()
                                        .filter(node -> node instanceof VideoView && !node.getId().equals(null) && !node.getId().equals("null"))
                                        .forEach(node -> {
                                            VideoView videoView = (VideoView) node;
                                            centerRoot.lookup(String.valueOf(videoItem.getUserId()));
                                            if (videoView != null) {
                                                try {
                                                    frame.retain();
                                                    videoView.setVideoFrame(frame);
                                                    frame.release();
                                                } catch (Exception e) {
                                                    e.printStackTrace();
                                                    System.err.println("Render Error : " + e.getMessage());
                                                }
                                            }
                                        });
                            });
                        }

Expected behavior App ought to continue to render the new additional streams

Desktop (please complete the following information):

Processor Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz 2.11 GHz Installed RAM 16.0 GB (15.9 GB usable)

System type 64-bit operating system, x64-based processor Pen and touch No pen or touch input is available for this display

Additional context Add any other context about the problem here.

kinsleykajiva commented 2 years ago

I have used and tried to imitate your contributions on https://github.com/lectureStudio/lectureStudio project but they are too complex or advanced hence I have found it difficult to even use.

kinsleykajiva commented 2 years ago

I have reviewed this on my end so I am closing this issue as it was not a problem it was my design issue.