| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_VIDEO_TRACK_RESOURCE_H_ | 5 #ifndef PPAPI_PROXY_MEDIA_STREAM_AUDIO_TRACK_RESOURCE_H_ |
| 6 #define PPAPI_PROXY_MEDIA_STREAM_VIDEO_TRACK_RESOURCE_H_ | 6 #define PPAPI_PROXY_MEDIA_STREAM_AUDIO_TRACK_RESOURCE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "ppapi/proxy/media_stream_track_resource_base.h" | 11 #include "ppapi/proxy/media_stream_track_resource_base.h" |
| 12 #include "ppapi/proxy/ppapi_proxy_export.h" | 12 #include "ppapi/proxy/ppapi_proxy_export.h" |
| 13 #include "ppapi/thunk/ppb_media_stream_video_track_api.h" | 13 #include "ppapi/thunk/ppb_media_stream_audio_track_api.h" |
| 14 | 14 |
| 15 namespace ppapi { | 15 namespace ppapi { |
| 16 namespace proxy { | 16 namespace proxy { |
| 17 | 17 |
| 18 class VideoFrameResource; | 18 class AudioFrameResource; |
| 19 | 19 |
| 20 class PPAPI_PROXY_EXPORT MediaStreamVideoTrackResource | 20 class PPAPI_PROXY_EXPORT MediaStreamAudioTrackResource |
| 21 : public MediaStreamTrackResourceBase, | 21 : public MediaStreamTrackResourceBase, |
| 22 public thunk::PPB_MediaStreamVideoTrack_API { | 22 public thunk::PPB_MediaStreamAudioTrack_API { |
| 23 public: | 23 public: |
| 24 MediaStreamVideoTrackResource(Connection connection, | 24 MediaStreamAudioTrackResource(Connection connection, |
| 25 PP_Instance instance, | 25 PP_Instance instance, |
| 26 int pending_renderer_id, | 26 int pending_renderer_id, |
| 27 const std::string& id); | 27 const std::string& id); |
| 28 | 28 |
| 29 virtual ~MediaStreamVideoTrackResource(); | 29 virtual ~MediaStreamAudioTrackResource(); |
| 30 | 30 |
| 31 // Resource overrides: | 31 // Resource overrides: |
| 32 virtual thunk::PPB_MediaStreamVideoTrack_API* | 32 virtual thunk::PPB_MediaStreamAudioTrack_API* |
| 33 AsPPB_MediaStreamVideoTrack_API() OVERRIDE; | 33 AsPPB_MediaStreamAudioTrack_API() OVERRIDE; |
| 34 | 34 |
| 35 // PPB_MediaStreamVideoTrack_API overrides: | 35 // PPB_MediaStreamAudioTrack_API overrides: |
| 36 virtual PP_Var GetId() OVERRIDE; | 36 virtual PP_Var GetId() OVERRIDE; |
| 37 virtual PP_Bool HasEnded() OVERRIDE; | 37 virtual PP_Bool HasEnded() OVERRIDE; |
| 38 virtual int32_t Configure(uint32_t max_buffered_frames) OVERRIDE; | 38 virtual int32_t Configure(uint32_t samples_per_frame, |
| 39 uint32_t max_buffered_frames) OVERRIDE; |
| 39 virtual int32_t GetFrame( | 40 virtual int32_t GetFrame( |
| 40 PP_Resource* frame, | 41 PP_Resource* frame, |
| 41 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 42 scoped_refptr<TrackedCallback> callback) OVERRIDE; |
| 42 virtual int32_t RecycleFrame(PP_Resource frame) OVERRIDE; | 43 virtual int32_t RecycleFrame(PP_Resource frame) OVERRIDE; |
| 43 virtual void Close() OVERRIDE; | 44 virtual void Close() OVERRIDE; |
| 44 | 45 |
| 45 // MediaStreamFrameBuffer::Delegate overrides: | 46 // MediaStreamFrameBuffer::Delegate overrides: |
| 46 virtual void OnNewFrameEnqueued() OVERRIDE; | 47 virtual void OnNewFrameEnqueued() OVERRIDE; |
| 47 | 48 |
| 48 private: | 49 private: |
| 49 PP_Resource GetVideoFrame(); | 50 PP_Resource GetAudioFrame(); |
| 50 | 51 |
| 51 void ReleaseFrames(); | 52 void ReleaseFrames(); |
| 52 | 53 |
| 53 // Allocated frame resources by |GetFrame()|. | 54 // Allocated frame resources by |GetFrame()|. |
| 54 typedef std::map<PP_Resource, scoped_refptr<VideoFrameResource> > FrameMap; | 55 typedef std::map<PP_Resource, scoped_refptr<AudioFrameResource> > FrameMap; |
| 55 FrameMap frames_; | 56 FrameMap frames_; |
| 56 | 57 |
| 57 PP_Resource* get_frame_output_; | 58 PP_Resource* get_frame_output_; |
| 58 | 59 |
| 59 scoped_refptr<TrackedCallback> get_frame_callback_; | 60 scoped_refptr<TrackedCallback> get_frame_callback_; |
| 60 | 61 |
| 61 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoTrackResource); | 62 DISALLOW_COPY_AND_ASSIGN(MediaStreamAudioTrackResource); |
| 62 }; | 63 }; |
| 63 | 64 |
| 64 } // namespace proxy | 65 } // namespace proxy |
| 65 } // namespace ppapi | 66 } // namespace ppapi |
| 66 | 67 |
| 67 #endif // PPAPI_PROXY_MEDIA_STREAM_VIDEO_TRACK_RESOURCE_H_ | 68 #endif // PPAPI_PROXY_MEDIA_STREAM_AUDIO_TRACK_RESOURCE_H_ |
| OLD | NEW |