Chromium Code Reviews| Index: content/renderer/media/audio_output_client.h |
| diff --git a/content/renderer/media/audio_output_client.h b/content/renderer/media/audio_output_client.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3911f8b9e9918af8daca78fd0251370dc0a260a6 |
| --- /dev/null |
| +++ b/content/renderer/media/audio_output_client.h |
| @@ -0,0 +1,82 @@ |
| +// Copyright 2015 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_AUDIO_OUTPUT_CLIENT_H_ |
| +#define CONTENT_RENDERER_MEDIA_AUDIO_OUTPUT_CLIENT_H_ |
| + |
| +#include <map> |
| + |
| +#include "base/files/file.h" |
| +#include "base/macros.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/memory/shared_memory_handle.h" |
| +#include "base/sync_socket.h" |
| +#include "base/threading/thread_checker.h" |
| +#include "content/common/content_export.h" |
| +#include "media/mojo/interfaces/audio_output.mojom.h" |
| +#include "mojo/public/cpp/bindings/binding.h" |
| +#include "mojo/public/cpp/bindings/interface_request.h" |
| + |
| +namespace base { |
| +class SingleThreadTaskRunner; |
| +} |
| + |
| +namespace media { |
| +class AudioParameters; |
| +} |
| + |
| +namespace content { |
| + |
| +class AudioMessageFilter; |
| +class ServiceRegistry; |
| + |
| + |
| +class CONTENT_EXPORT AudioOutputClient { |
| + public: |
| + explicit AudioOutputClient(ServiceRegistry* service_registry, |
| + AudioMessageFilter* audio_message_filter); |
| + |
| + |
| + ~AudioOutputClient(); |
| + |
| + void CreateStream(int stream_id, |
|
Henrik Grunell
2016/04/19 15:36:09
Add comments to all functions.
rchtara
2016/04/21 09:10:18
Done.
|
| + int render_frame_id, |
| + const media::AudioParameters& params); |
| + void CreateStreamOnMainThread(int stream_id, |
| + int render_frame_id, |
| + const media::AudioParameters& params); |
| + void CreateStreamCallback(mojom::AudioOutputStreamPtr stream, |
| + int stream_id, |
| + mojo::ScopedSharedBufferHandle shared_buffer, |
| + mojo::ScopedHandle socket_descriptor); |
| + void CreateStreamOnIOThread( |
| + mojom::AudioOutputStreamPtr* const stream, |
| + base::SharedMemoryHandle handle, |
| + base::SyncSocket::TransitDescriptor socket_descriptor, |
| + uint32_t length); |
| + |
| + void CloseStream(int stream_id); |
| + void CloseStreamOnMainThread(int stream_id); |
| + |
| + void OnStreamError(int stream_id); |
| + void ReportErrorOnIOThread(int stream_id); |
| + |
| + private: |
| + // Mojo connection error handler. |
| + void OnConnectionError(); |
| + |
| + // The Mojo service for registering observers to listen for enable/disable |
| + // events. |
| + mojom::AudioOutputPtr service_; |
| + std::map<int, scoped_ptr<mojom::AudioOutputStreamPtr>> streams_; |
| + |
| + scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
| + AudioMessageFilter* audio_message_filter_; |
|
Henrik Grunell
2016/04/19 15:36:09
How is it guaranteed that the filter outlives this
rchtara
2016/04/21 09:10:18
I will replace it by scoped_refptr<AudioMessageFil
|
| + DISALLOW_COPY_AND_ASSIGN(AudioOutputClient); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_RENDERER_MEDIA_AUDIO_OUTPUT_CLIENT_H_ |