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
3 // found in the LICENSE file.
5 #ifndef PPAPI_PROXY_MEDIA_STREAM_AUDIO_TRACK_RESOURCE_H_
6 #define PPAPI_PROXY_MEDIA_STREAM_AUDIO_TRACK_RESOURCE_H_
11 #include "base/memory/ref_counted.h"
12 #include "ppapi/proxy/media_stream_track_resource_base.h"
13 #include "ppapi/proxy/ppapi_proxy_export.h"
14 #include "ppapi/thunk/ppb_media_stream_audio_track_api.h"
19 class AudioBufferResource
;
21 class PPAPI_PROXY_EXPORT MediaStreamAudioTrackResource
22 : public MediaStreamTrackResourceBase
,
23 public thunk::PPB_MediaStreamAudioTrack_API
{
25 MediaStreamAudioTrackResource(Connection connection
,
27 int pending_renderer_id
,
28 const std::string
& id
);
30 virtual ~MediaStreamAudioTrackResource();
32 // Resource overrides:
33 virtual thunk::PPB_MediaStreamAudioTrack_API
*
34 AsPPB_MediaStreamAudioTrack_API() OVERRIDE
;
36 // PPB_MediaStreamAudioTrack_API overrides:
37 virtual PP_Var
GetId() OVERRIDE
;
38 virtual PP_Bool
HasEnded() OVERRIDE
;
39 virtual int32_t Configure(const int32_t attrib_list
[],
40 scoped_refptr
<TrackedCallback
> callback
) OVERRIDE
;
41 virtual int32_t GetAttrib(PP_MediaStreamAudioTrack_Attrib attrib
,
42 int32_t* value
) OVERRIDE
;
43 virtual int32_t GetBuffer(
45 scoped_refptr
<TrackedCallback
> callback
) OVERRIDE
;
46 virtual int32_t RecycleBuffer(PP_Resource buffer
) OVERRIDE
;
47 virtual void Close() OVERRIDE
;
49 // MediaStreamBufferManager::Delegate overrides:
50 virtual void OnNewBufferEnqueued() OVERRIDE
;
53 PP_Resource
GetAudioBuffer();
55 void ReleaseBuffers();
57 // IPC message handlers.
58 void OnPluginMsgConfigureReply(const ResourceMessageReplyParams
& params
);
60 // Allocated buffer resources by |GetBuffer()|.
61 typedef std::map
<PP_Resource
, scoped_refptr
<AudioBufferResource
> > BufferMap
;
64 PP_Resource
* get_buffer_output_
;
66 scoped_refptr
<TrackedCallback
> configure_callback_
;
68 scoped_refptr
<TrackedCallback
> get_buffer_callback_
;
70 DISALLOW_COPY_AND_ASSIGN(MediaStreamAudioTrackResource
);
76 #endif // PPAPI_PROXY_MEDIA_STREAM_AUDIO_TRACK_RESOURCE_H_