audio_input_delegate.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Copyright 2017 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef MEDIA_AUDIO_AUDIO_INPUT_DELEGATE_H_
  5. #define MEDIA_AUDIO_AUDIO_INPUT_DELEGATE_H_
  6. #include <memory>
  7. #include <string>
  8. #include "base/memory/ref_counted.h"
  9. #include "media/base/media_export.h"
  10. namespace base {
  11. class CancelableSyncSocket;
  12. class ReadOnlySharedMemoryRegion;
  13. } // namespace base
  14. namespace media {
  15. class MEDIA_EXPORT AudioInputDelegate {
  16. public:
  17. // An AudioInputDelegate must not call back to its EventHandler in its
  18. // constructor.
  19. class MEDIA_EXPORT EventHandler {
  20. public:
  21. virtual ~EventHandler() = 0;
  22. // Called when the underlying stream is ready for recording.
  23. virtual void OnStreamCreated(
  24. int stream_id,
  25. base::ReadOnlySharedMemoryRegion shared_memory_region,
  26. std::unique_ptr<base::CancelableSyncSocket> socket,
  27. bool initially_muted) = 0;
  28. // Called if stream encounters an error and has become unusable.
  29. virtual void OnStreamError(int stream_id) = 0;
  30. };
  31. virtual ~AudioInputDelegate() = 0;
  32. virtual int GetStreamId() = 0;
  33. // Stream control:
  34. virtual void OnRecordStream() = 0;
  35. virtual void OnSetVolume(double volume) = 0;
  36. virtual void OnSetOutputDeviceForAec(
  37. const std::string& raw_output_device_id) = 0;
  38. };
  39. } // namespace media
  40. #endif // MEDIA_AUDIO_AUDIO_INPUT_DELEGATE_H_