| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_RENDERER_MEDIA_ANDROID_RENDERER_DEMUXER_ANDROID_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_ANDROID_RENDERER_DEMUXER_ANDROID_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_ANDROID_RENDERER_DEMUXER_ANDROID_H_ | 6 #define CONTENT_RENDERER_MEDIA_ANDROID_RENDERER_DEMUXER_ANDROID_H_ |
| 7 | 7 |
| 8 #include "base/atomic_sequence_num.h" | 8 #include "base/atomic_sequence_num.h" |
| 9 #include "base/id_map.h" | 9 #include "base/id_map.h" |
| 10 #include "ipc/ipc_channel_proxy.h" | 10 #include "ipc/ipc_message_filter.h" |
| 11 #include "media/base/android/demuxer_stream_player_params.h" | 11 #include "media/base/android/demuxer_stream_player_params.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 | 14 |
| 15 class MediaSourceDelegate; | 15 class MediaSourceDelegate; |
| 16 class ThreadSafeSender; | 16 class ThreadSafeSender; |
| 17 | 17 |
| 18 // Represents the renderer process half of an IPC-based implementation of | 18 // Represents the renderer process half of an IPC-based implementation of |
| 19 // media::DemuxerAndroid. | 19 // media::DemuxerAndroid. |
| 20 // | 20 // |
| 21 // Refer to BrowserDemuxerAndroid for the browser process half. | 21 // Refer to BrowserDemuxerAndroid for the browser process half. |
| 22 class RendererDemuxerAndroid : public IPC::ChannelProxy::MessageFilter { | 22 class RendererDemuxerAndroid : public IPC::MessageFilter { |
| 23 public: | 23 public: |
| 24 RendererDemuxerAndroid(); | 24 RendererDemuxerAndroid(); |
| 25 | 25 |
| 26 // Returns the next available demuxer client ID for use in IPC messages. | 26 // Returns the next available demuxer client ID for use in IPC messages. |
| 27 // | 27 // |
| 28 // Safe to call on any thread. | 28 // Safe to call on any thread. |
| 29 int GetNextDemuxerClientID(); | 29 int GetNextDemuxerClientID(); |
| 30 | 30 |
| 31 // Associates |delegate| with |demuxer_client_id| for handling incoming IPC | 31 // Associates |delegate| with |demuxer_client_id| for handling incoming IPC |
| 32 // messages. | 32 // messages. |
| 33 // | 33 // |
| 34 // Must be called on media thread. | 34 // Must be called on media thread. |
| 35 void AddDelegate(int demuxer_client_id, MediaSourceDelegate* delegate); | 35 void AddDelegate(int demuxer_client_id, MediaSourceDelegate* delegate); |
| 36 | 36 |
| 37 // Removes the association created by AddDelegate(). | 37 // Removes the association created by AddDelegate(). |
| 38 // | 38 // |
| 39 // Must be called on media thread. | 39 // Must be called on media thread. |
| 40 void RemoveDelegate(int demuxer_client_id); | 40 void RemoveDelegate(int demuxer_client_id); |
| 41 | 41 |
| 42 // IPC::ChannelProxy::MessageFilter overrides. | 42 // IPC::MessageFilter overrides. |
| 43 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 43 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 44 | 44 |
| 45 // media::DemuxerAndroidClient "implementation". | 45 // media::DemuxerAndroidClient "implementation". |
| 46 // | 46 // |
| 47 // TODO(scherkus): Consider having RendererDemuxerAndroid actually implement | 47 // TODO(scherkus): Consider having RendererDemuxerAndroid actually implement |
| 48 // media::DemuxerAndroidClient and MediaSourceDelegate actually implement | 48 // media::DemuxerAndroidClient and MediaSourceDelegate actually implement |
| 49 // media::DemuxerAndroid. | 49 // media::DemuxerAndroid. |
| 50 void DemuxerReady(int demuxer_client_id, | 50 void DemuxerReady(int demuxer_client_id, |
| 51 const media::DemuxerConfigs& configs); | 51 const media::DemuxerConfigs& configs); |
| 52 void ReadFromDemuxerAck(int demuxer_client_id, | 52 void ReadFromDemuxerAck(int demuxer_client_id, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 73 IDMap<MediaSourceDelegate> delegates_; | 73 IDMap<MediaSourceDelegate> delegates_; |
| 74 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 74 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
| 75 scoped_refptr<base::MessageLoopProxy> media_message_loop_; | 75 scoped_refptr<base::MessageLoopProxy> media_message_loop_; |
| 76 | 76 |
| 77 DISALLOW_COPY_AND_ASSIGN(RendererDemuxerAndroid); | 77 DISALLOW_COPY_AND_ASSIGN(RendererDemuxerAndroid); |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 } // namespace content | 80 } // namespace content |
| 81 | 81 |
| 82 #endif // CONTENT_RENDERER_MEDIA_ANDROID_RENDERER_DEMUXER_ANDROID_H_ | 82 #endif // CONTENT_RENDERER_MEDIA_ANDROID_RENDERER_DEMUXER_ANDROID_H_ |
| OLD | NEW |