OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 PPAPI_PROXY_MEDIA_STREAM_AUDIO_TRACK_RESOURCE_H_ | 5 #ifndef PPAPI_PROXY_MEDIA_STREAM_AUDIO_TRACK_RESOURCE_H_ |
6 #define PPAPI_PROXY_MEDIA_STREAM_AUDIO_TRACK_RESOURCE_H_ | 6 #define PPAPI_PROXY_MEDIA_STREAM_AUDIO_TRACK_RESOURCE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "ppapi/proxy/media_stream_track_resource_base.h" | 12 #include "ppapi/proxy/media_stream_track_resource_base.h" |
13 #include "ppapi/proxy/ppapi_proxy_export.h" | 13 #include "ppapi/proxy/ppapi_proxy_export.h" |
14 #include "ppapi/thunk/ppb_media_stream_audio_track_api.h" | 14 #include "ppapi/thunk/ppb_media_stream_audio_track_api.h" |
15 | 15 |
16 namespace ppapi { | 16 namespace ppapi { |
17 namespace proxy { | 17 namespace proxy { |
18 | 18 |
19 class AudioBufferResource; | 19 class AudioBufferResource; |
20 | 20 |
21 class PPAPI_PROXY_EXPORT MediaStreamAudioTrackResource | 21 class PPAPI_PROXY_EXPORT MediaStreamAudioTrackResource |
22 : public MediaStreamTrackResourceBase, | 22 : public MediaStreamTrackResourceBase, |
23 public thunk::PPB_MediaStreamAudioTrack_API { | 23 public thunk::PPB_MediaStreamAudioTrack_API { |
24 public: | 24 public: |
25 MediaStreamAudioTrackResource(Connection connection, | 25 MediaStreamAudioTrackResource(Connection connection, |
26 PP_Instance instance, | 26 PP_Instance instance, |
27 int pending_renderer_id, | 27 int pending_renderer_id, |
28 const std::string& id); | 28 const std::string& id); |
29 | 29 |
30 virtual ~MediaStreamAudioTrackResource(); | 30 ~MediaStreamAudioTrackResource() override; |
31 | 31 |
32 // Resource overrides: | 32 // Resource overrides: |
33 virtual thunk::PPB_MediaStreamAudioTrack_API* | 33 thunk::PPB_MediaStreamAudioTrack_API* AsPPB_MediaStreamAudioTrack_API() |
34 AsPPB_MediaStreamAudioTrack_API() override; | 34 override; |
35 | 35 |
36 // PPB_MediaStreamAudioTrack_API overrides: | 36 // PPB_MediaStreamAudioTrack_API overrides: |
37 virtual PP_Var GetId() override; | 37 PP_Var GetId() override; |
38 virtual PP_Bool HasEnded() override; | 38 PP_Bool HasEnded() override; |
39 virtual int32_t Configure(const int32_t attrib_list[], | 39 int32_t Configure(const int32_t attrib_list[], |
40 scoped_refptr<TrackedCallback> callback) override; | 40 scoped_refptr<TrackedCallback> callback) override; |
41 virtual int32_t GetAttrib(PP_MediaStreamAudioTrack_Attrib attrib, | 41 int32_t GetAttrib(PP_MediaStreamAudioTrack_Attrib attrib, |
42 int32_t* value) override; | 42 int32_t* value) override; |
43 virtual int32_t GetBuffer( | 43 int32_t GetBuffer(PP_Resource* buffer, |
44 PP_Resource* buffer, | 44 scoped_refptr<TrackedCallback> callback) override; |
45 scoped_refptr<TrackedCallback> callback) override; | 45 int32_t RecycleBuffer(PP_Resource buffer) override; |
46 virtual int32_t RecycleBuffer(PP_Resource buffer) override; | 46 void Close() override; |
47 virtual void Close() override; | |
48 | 47 |
49 // MediaStreamBufferManager::Delegate overrides: | 48 // MediaStreamBufferManager::Delegate overrides: |
50 virtual void OnNewBufferEnqueued() override; | 49 void OnNewBufferEnqueued() override; |
51 | 50 |
52 private: | 51 private: |
53 PP_Resource GetAudioBuffer(); | 52 PP_Resource GetAudioBuffer(); |
54 | 53 |
55 void ReleaseBuffers(); | 54 void ReleaseBuffers(); |
56 | 55 |
57 // IPC message handlers. | 56 // IPC message handlers. |
58 void OnPluginMsgConfigureReply(const ResourceMessageReplyParams& params); | 57 void OnPluginMsgConfigureReply(const ResourceMessageReplyParams& params); |
59 | 58 |
60 // Allocated buffer resources by |GetBuffer()|. | 59 // Allocated buffer resources by |GetBuffer()|. |
61 typedef std::map<PP_Resource, scoped_refptr<AudioBufferResource> > BufferMap; | 60 typedef std::map<PP_Resource, scoped_refptr<AudioBufferResource> > BufferMap; |
62 BufferMap buffers_; | 61 BufferMap buffers_; |
63 | 62 |
64 PP_Resource* get_buffer_output_; | 63 PP_Resource* get_buffer_output_; |
65 | 64 |
66 scoped_refptr<TrackedCallback> configure_callback_; | 65 scoped_refptr<TrackedCallback> configure_callback_; |
67 | 66 |
68 scoped_refptr<TrackedCallback> get_buffer_callback_; | 67 scoped_refptr<TrackedCallback> get_buffer_callback_; |
69 | 68 |
70 DISALLOW_COPY_AND_ASSIGN(MediaStreamAudioTrackResource); | 69 DISALLOW_COPY_AND_ASSIGN(MediaStreamAudioTrackResource); |
71 }; | 70 }; |
72 | 71 |
73 } // namespace proxy | 72 } // namespace proxy |
74 } // namespace ppapi | 73 } // namespace ppapi |
75 | 74 |
76 #endif // PPAPI_PROXY_MEDIA_STREAM_AUDIO_TRACK_RESOURCE_H_ | 75 #endif // PPAPI_PROXY_MEDIA_STREAM_AUDIO_TRACK_RESOURCE_H_ |
OLD | NEW |