Skip to content

Commit 30cda0b

Browse files
committed
fix: release video frame after processing in WHEP example #191
1 parent 28a9714 commit 30cda0b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

webrtc-examples/src/main/java/dev/onvoid/webrtc/examples/WhepExample.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ private void createPeerConnection() {
165165
if (track instanceof VideoTrack vTrack) {
166166
vTrack.addSink(videoFrame -> {
167167
System.out.println("Received video frame: " + videoFrame);
168+
169+
// IMPORTANT: Always release the frame when done to prevent memory leaks
170+
videoFrame.release();
168171
});
169172
}
170173
}

0 commit comments

Comments
 (0)