TzuHuanTai / RaspberryPi-WebRTC

Turn your Raspberry Pi into a low-latency home security camera by using native WebRTC with the v4l2 hardware H.264 encoder and the software-based OpenH264 encoder for live video stream.
Apache License 2.0
784 stars 32 forks source link

fix: memory leak #164

Closed TzuHuanTai closed 3 months ago

TzuHuanTai commented 4 months ago
  1. v4l2_capture.cpp

    ==3887525== 96 bytes in 1 blocks are definitely lost in loss record 1,404 of 2,018
    ==3887525==    at 0x484A484: operator new(unsigned long) (vg_replace_malloc.c:342)
    ==3887525==    by 0xEBD6B3: webrtc::videocapturemodule::VideoCaptureImpl::CreateDeviceInfo() (in /home/pi/IoT/RaspberryPi_WebRTC/build/pi_webrtc)
    ==3887525==    by 0xE7A0F3: V4L2Capture::Init(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (src/capture/v4l2_capture.cpp:28)
    ==3887525==    by 0xE79FCB: V4L2Capture::Create(Args) (src/capture/v4l2_capture.cpp:14)
    ==3887525==    by 0x419B6B: Conductor::InitializeTracks() (src/conductor.cpp:60)
    ==3887525==    by 0x41919F: Conductor::Create(Args) (src/conductor.cpp:31)
    ==3887525==    by 0x4177A3: main (src/main.cpp:14)
  2. utils.cpp

    ==3887525== 262,144 bytes in 4 blocks are definitely lost in loss record 2,011 of 2,018
    ==3887525==    at 0x4849E4C: malloc (vg_replace_malloc.c:307)
    ==3887525==    by 0x647E90B: ??? (in /usr/lib/aarch64-linux-gnu/libjpeg.so.62.3.0)
    ==3887525==    by 0x646F0EF: ??? (in /usr/lib/aarch64-linux-gnu/libjpeg.so.62.3.0)
    ==3887525==    by 0x646BCCB: ??? (in /usr/lib/aarch64-linux-gnu/libjpeg.so.62.3.0)
    ==3887525==    by 0x6477E47: ??? (in /usr/lib/aarch64-linux-gnu/libjpeg.so.62.3.0)
    ==3887525==    by 0x646B957: jpeg_write_scanlines (in /usr/lib/aarch64-linux-gnu/libjpeg.so.62.3.0)
    ==3887525==    by 0xE8A2A3: Utils::ConvertYuvToJpeg(unsigned char const*, int, int, int) (src/common/utils.cpp:218)
    ==3887525==    by 0xE8A54F: Utils::CreateJpegImage(unsigned char const*, int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (src/common/utils.cpp:245)
    ==3887525==    by 0xE71B5B: VideoRecorder::MakePreviewImage(V4l2Buffer&)::$_4::operator()(V4l2Buffer) const (src/recorder/video_recorder.cpp:109)
    ==3887525==    by 0xE71993: void std::__invoke_impl<void, VideoRecorder::MakePreviewImage(V4l2Buffer&)::$_4&, V4l2Buffer&>(std::__invoke_other, VideoRecorder::MakePreviewImage(V4l2Buffer&)::$_4&, V4l2Buffer&) (invoke.h:60)
    ==3887525==    by 0xE718FF: std::enable_if<is_invocable_r_v<void, VideoRecorder::MakePreviewImage(V4l2Buffer&)::$_4&, V4l2Buffer&>, void>::type std::__invoke_r<void, VideoRecorder::MakePreviewImage(V4l2Buffer&)::$_4&, V4l2Buffer&>(VideoRecorder::MakePreviewImage(V4l2Buffer&)::$_4&, V4l2Buffer&) (invoke.h:110)
    ==3887525==    by 0xE717CF: std::_Function_handler<void (V4l2Buffer&), VideoRecorder::MakePreviewImage(V4l2Buffer&)::$_4>::_M_invoke(std::_Any_data const&, V4l2Buffer&) (std_function.h:291)