Jump to content
  • 0

Do frame listeners need to be unregistered?


Balazs
 Share

Question

I am not sure about the contract around the `AntMediaApplicationAdapter.addFrameListener` method's proper usage. If I register listener instances from the `IStreamListener` interface `streamStarted` methods, am I supposed to take care of removing these frame listeners using `removeFrameListener` in the`streamFinished` lifecycle methods - or can I assume that Ant Media Server will free up the listeners and they will be garbage collected? I don't want to have my listeners accumulate and lead to a memory leak over months when thousands of streams get started and stopped over time.

Link to comment
Share on other sites

  • Answers 2
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

2 answers to this question

Recommended Posts

  • 0

Hi @Balazs,

Have a good day. Thank you for the great question. Your frames automatically release after being processed by muxers.

We also releasing Filter Graphs outputs after stream is finished.

https://github.com/ant-media/Plugins/blob/master/FilterPlugin/src/main/java/io/antmedia/filter/utils/FilterGraph.java#L206

https://github.com/ant-media/Plugins/blob/master/FilterPlugin/src/main/java/io/antmedia/filter/FilterAdaptor.java#L463

But I will discuss this issue with @BurakIf I miss something. 

Best Regards,

Selim

Link to comment
Share on other sites

  • 0

Hi, I think my answer was about the general api contract, not the filter plugin specifically, however your links helped me to see that you seem to be manually unregistering the listeners in your filter plugin so if I am not mistaken, the answer is "no" to my question, AMS won't free up things, listeners need to be de-registered manually..? @Burak

Link to comment
Share on other sites

 Share

×
×
  • Create New...