RTCStatsCollectorCallback.cs 630 B

12345678910111213141516171819202122232425262728
  1. using System;
  2. using System.Runtime.InteropServices;
  3. namespace Unity.WebRTC
  4. {
  5. internal class RTCStatsCollectorCallback : SafeHandle
  6. {
  7. public Action<RTCStatsReport> onStatsDelivered;
  8. private RTCStatsCollectorCallback()
  9. : base(IntPtr.Zero, true)
  10. {
  11. }
  12. public void Invoke(RTCStatsReport report)
  13. {
  14. onStatsDelivered?.Invoke(report);
  15. }
  16. public override bool IsInvalid { get { return handle == IntPtr.Zero; } }
  17. protected override bool ReleaseHandle()
  18. {
  19. onStatsDelivered = null;
  20. return true;
  21. }
  22. }
  23. }