ros-drivers / audio_common

Common code for working with audio in ROS
BSD 3-Clause "New" or "Revised" License
86 stars 152 forks source link

Avoid memory leak in audio_play #206

Closed knorth55 closed 2 years ago

knorth55 commented 2 years ago

Solve issues reported in #205 . I add gst_buffer_unref when the GstBuffer is no more used. I add the line in audio_play and audio_capture.

randoms commented 2 years ago

I don't think gst_buffer_unref is needed in audio_capture. According to the doc of gst_sample_get_buffer

The buffer remains valid as long as sample is valid. If you need to hold on to it for longer than that, take a ref to the buffer with gst_buffer_ref.

The buffer should be unreferenced automatically after you unreference the sample.

knorth55 commented 2 years ago

@randoms thank you for your review. I change this PR and only modify audio_play.