Chromium Code Reviews| Index: content/renderer/media/mojo_audio_output_ipc.h |
| diff --git a/content/renderer/media/mojo_audio_output_ipc.h b/content/renderer/media/mojo_audio_output_ipc.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..51b91841f88bbb1d46a7acf68328884f5ac5b054 |
| --- /dev/null |
| +++ b/content/renderer/media/mojo_audio_output_ipc.h |
| @@ -0,0 +1,66 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_RENDERER_MEDIA_MOJO_AUDIO_OUTPUT_IPC_H_ |
| +#define CONTENT_RENDERER_MEDIA_MOJO_AUDIO_OUTPUT_IPC_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/macros.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "base/threading/thread_checker.h" |
| +#include "content/common/media/renderer_audio_output_stream_factory.mojom.h" |
| +#include "media/audio/audio_output_ipc.h" |
| + |
| +namespace content { |
| + |
| +// MojoAudioOutputIPC is a renderer-side class for handling creation, |
| +// initialization and control of an output stream. |
|
o1ka
2017/04/20 10:36:00
Could you add a comment on threading (it can run o
Max Morin
2017/05/05 13:10:59
In the current version, it may only be used on a s
|
| +class MojoAudioOutputIPC : public media::AudioOutputIPC { |
| + public: |
| + explicit MojoAudioOutputIPC(int frame_id); |
| + |
| + ~MojoAudioOutputIPC() override; |
| + |
| + // AudioOutputIPC implementation. |
| + void RequestDeviceAuthorization(media::AudioOutputIPCDelegate* delegate, |
| + int session_id, |
| + const std::string& device_id, |
| + const url::Origin& security_origin) override; |
| + void CreateStream(media::AudioOutputIPCDelegate* delegate, |
| + const media::AudioParameters& params) override; |
| + void PlayStream() override; |
| + void PauseStream() override; |
| + void CloseStream() override; |
| + void SetVolume(double volume) override; |
| + |
| + private: |
| + media::mojom::AudioOutputStreamProviderRequest MakeProviderRequest( |
| + media::AudioOutputIPCDelegate* delegate); |
| + |
| + void RecievedDeviceAuthorization(media::AudioOutputIPCDelegate* delegate, |
| + media::OutputDeviceStatus status, |
| + const media::AudioParameters& params, |
| + const std::string& device_id) const; |
| + |
| + void StreamCreated(media::AudioOutputIPCDelegate* delegate, |
| + mojo::ScopedSharedBufferHandle shared_memory, |
| + mojo::ScopedHandle socket); |
| + |
| + base::ThreadChecker thread_checker_; |
|
o1ka
2017/04/20 10:36:00
it can run on AudioIPCFactory::io_task_runner only
Max Morin
2017/05/05 13:10:59
See above.
|
| + const int frame_id_; |
| + |
| + media::mojom::AudioOutputStreamProviderPtr stream_provider_; |
| + media::mojom::AudioOutputStreamPtr stream_; |
| + |
| + // To make sure we don't send an "authorization completed" callback for a |
| + // stream after it's closed, we use this weak factory. |
| + base::WeakPtrFactory<MojoAudioOutputIPC> weak_factory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(MojoAudioOutputIPC); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_RENDERER_MEDIA_MOJO_AUDIO_OUTPUT_IPC_H_ |