OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef PPAPI_PROXY_MEDIA_STREAM_TRACK_RESOURCE_BASE_H_ |
| 6 #define PPAPI_PROXY_MEDIA_STREAM_TRACK_RESOURCE_BASE_H_ |
| 7 |
| 8 #include "ppapi/proxy/plugin_resource.h" |
| 9 #include "ppapi/proxy/ppapi_proxy_export.h" |
| 10 #include "ppapi/shared_impl/media_stream_frame_buffer.h" |
| 11 #include "ppapi/thunk/ppb_media_stream_track_api.h" |
| 12 |
| 13 namespace ppapi { |
| 14 namespace proxy { |
| 15 |
| 16 class PPAPI_PROXY_EXPORT MediaStreamTrackResourceBase |
| 17 : public PluginResource, |
| 18 public MediaStreamFrameBuffer::Delegate, |
| 19 virtual public thunk::PPB_MediaStreamTrack_API { |
| 20 protected: |
| 21 MediaStreamTrackResourceBase(Connection connection, |
| 22 PP_Instance instance, |
| 23 int pending_renderer_id, |
| 24 const std::string& id); |
| 25 |
| 26 virtual ~MediaStreamTrackResourceBase(); |
| 27 |
| 28 std::string id() const { return id_; } |
| 29 |
| 30 bool has_ended() const { return has_ended_; } |
| 31 |
| 32 MediaStreamFrameBuffer* frame_buffer() { return &frame_buffer_; } |
| 33 |
| 34 // Enqueue a frame into host's |frame_queue_|. |
| 35 void HostEnqueueFrame(int32_t index); |
| 36 |
| 37 // Resource overrides: |
| 38 thunk::PPB_MediaStreamTrack_API* AsPPB_MediaStreamTrack_API() OVERRIDE; |
| 39 |
| 40 // PluginResource overrides: |
| 41 virtual void OnReplyReceived(const ResourceMessageReplyParams& params, |
| 42 const IPC::Message& msg) OVERRIDE; |
| 43 |
| 44 // PPB_MediaStreamTrack_API overrides: |
| 45 virtual PP_Var GetId() OVERRIDE; |
| 46 virtual PP_Bool HasEnded() OVERRIDE; |
| 47 virtual void Close() OVERRIDE; |
| 48 |
| 49 private: |
| 50 // Message handlers: |
| 51 void OnPluginMsgInitFrames(const ResourceMessageReplyParams& params, |
| 52 int32_t number_of_frames, |
| 53 int32_t frame_size); |
| 54 void OnPluginMsgEnqueueFrame(const ResourceMessageReplyParams& params, |
| 55 int32_t index); |
| 56 |
| 57 MediaStreamFrameBuffer frame_buffer_; |
| 58 |
| 59 std::string id_; |
| 60 |
| 61 bool has_ended_; |
| 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(MediaStreamTrackResourceBase); |
| 64 }; |
| 65 |
| 66 } // namespace proxy |
| 67 } // namespace ppapi |
| 68 |
| 69 #endif // PPAPI_PROXY_MEDIA_STREAM_TRACK_RESOURCE_BASE_H_ |
OLD | NEW |