audio_frame_observer.h 626 B

1234567891011121314151617181920212223
  1. #pragma once
  2. #include "callback.h"
  3. using AudioFrameReadyCallback =
  4. Callback<const void*, const int, const int, const int, const int>;
  5. /// Audio frame observer to get notified of newly available audio frames.
  6. class AudioFrameObserver : public webrtc::AudioTrackSinkInterface {
  7. public:
  8. void SetCallback(AudioFrameReadyCallback callback) ;
  9. protected:
  10. // AudioTrackSinkInterface interface
  11. void OnData(const void* audio_data,
  12. int bits_per_sample,
  13. int sample_rate,
  14. size_t number_of_channels,
  15. size_t number_of_frames) override;
  16. private:
  17. AudioFrameReadyCallback callback_;
  18. std::mutex mutex_;
  19. };