From c46d2156b6a29d44f1e51e455ba2f21d508b9157 Mon Sep 17 00:00:00 2001 From: Alessandro Ros Date: Sat, 24 Jun 2023 13:30:36 +0200 Subject: [PATCH] webrtc: fix memory leak when publishing or reading (#1884) (#1983) --- README.md | 6 +++--- internal/core/webrtc_session.go | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c5f3d5af..00d43d09 100644 --- a/README.md +++ b/README.md @@ -659,7 +659,7 @@ After starting the server, the webcam can be reached on `rtsp://localhost:8554/c ### From a Raspberry Pi Camera -_MediaMTX_ natively support the Raspberry Pi Camera, enabling high-quality and low-latency video streaming from the camera to any user. There are a couple of requisites: +_MediaMTX_ natively support the Raspberry Pi Camera, enabling high-quality and low-latency video streaming from the camera to any user. There are a couple of requirements: 1. The server must run on a Raspberry Pi, with Raspberry Pi OS bullseye or newer as operative system. Both 32 bit and 64 bit operative systems are supported. @@ -694,7 +694,7 @@ docker run --rm -it \ bluenviron/mediamtx:latest-rpi ``` -After starting the server, the camera can be reached on `rtsp://raspberry-pi:8554/cam` or `http://raspberry-pi:8888/cam`. +After starting the server, the camera can be reached on path `/cam` (`http://raspberry-pi:8889/cam`, `http://raspberry-pi:8888/cam`, `rtsp://raspberry-pi:8554/cam` or `rtmp://raspberry-pi:1935/cam`). Camera settings can be changed by using the `rpiCamera*` parameters: @@ -731,7 +731,7 @@ default:CARD=U0x46d0x809 Default Audio Device ``` -Find the audio card of the microfone and take note of its name, for instance `default:CARD=U0x46d0x809`. Then use GStreamer inside `runOnReady` to read the video stream, add audio and publish the improved stream to another path: +Find the audio card of the microfone and take note of its name, for instance `default:CARD=U0x46d0x809`. Then use GStreamer inside `runOnReady` to read the video stream, add audio and publish the new stream to another path: ```yml paths: diff --git a/internal/core/webrtc_session.go b/internal/core/webrtc_session.go index 62b09c11..17c44595 100644 --- a/internal/core/webrtc_session.go +++ b/internal/core/webrtc_session.go @@ -231,6 +231,8 @@ func (s *webRTCSession) run() { } } + s.ctxCancel() + s.parent.sessionClose(s) s.Log(logger.Info, "closed (%v)", err)