| 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_TRACK_RESOURCE_BASE_H_ | 5 #ifndef PPAPI_PROXY_MEDIA_STREAM_TRACK_RESOURCE_BASE_H_ |
| 6 #define PPAPI_PROXY_MEDIA_STREAM_TRACK_RESOURCE_BASE_H_ | 6 #define PPAPI_PROXY_MEDIA_STREAM_TRACK_RESOURCE_BASE_H_ |
| 7 | 7 |
| 8 #include "ppapi/proxy/plugin_resource.h" | 8 #include "ppapi/proxy/plugin_resource.h" |
| 9 #include "ppapi/proxy/ppapi_proxy_export.h" | 9 #include "ppapi/proxy/ppapi_proxy_export.h" |
| 10 #include "ppapi/shared_impl/media_stream_frame_buffer.h" | 10 #include "ppapi/shared_impl/media_stream_buffer_manager.h" |
| 11 | 11 |
| 12 namespace ppapi { | 12 namespace ppapi { |
| 13 namespace proxy { | 13 namespace proxy { |
| 14 | 14 |
| 15 class PPAPI_PROXY_EXPORT MediaStreamTrackResourceBase | 15 class PPAPI_PROXY_EXPORT MediaStreamTrackResourceBase |
| 16 : public PluginResource, | 16 : public PluginResource, |
| 17 public MediaStreamFrameBuffer::Delegate { | 17 public MediaStreamBufferManager::Delegate { |
| 18 protected: | 18 protected: |
| 19 MediaStreamTrackResourceBase(Connection connection, | 19 MediaStreamTrackResourceBase(Connection connection, |
| 20 PP_Instance instance, | 20 PP_Instance instance, |
| 21 int pending_renderer_id, | 21 int pending_renderer_id, |
| 22 const std::string& id); | 22 const std::string& id); |
| 23 | 23 |
| 24 virtual ~MediaStreamTrackResourceBase(); | 24 virtual ~MediaStreamTrackResourceBase(); |
| 25 | 25 |
| 26 std::string id() const { return id_; } | 26 std::string id() const { return id_; } |
| 27 | 27 |
| 28 bool has_ended() const { return has_ended_; } | 28 bool has_ended() const { return has_ended_; } |
| 29 | 29 |
| 30 MediaStreamFrameBuffer* frame_buffer() { return &frame_buffer_; } | 30 MediaStreamBufferManager* buffer_manager() { return &buffer_manager_; } |
| 31 | 31 |
| 32 void CloseInternal(); | 32 void CloseInternal(); |
| 33 | 33 |
| 34 // Sends a frame index to the corresponding PepperMediaStreamTrackHostBase | 34 // Sends a buffer index to the corresponding PepperMediaStreamTrackHostBase |
| 35 // via an IPC message. The host adds the frame index into its | 35 // via an IPC message. The host adds the buffer index into its |
| 36 // |frame_buffer_| for reading or writing. Also see |MediaStreamFrameBuffer|. | 36 // |buffer_manager_| for reading or writing. |
| 37 void SendEnqueueFrameMessageToHost(int32_t index); | 37 // Also see |MediaStreamBufferManager|. |
| 38 void SendEnqueueBufferMessageToHost(int32_t index); |
| 38 | 39 |
| 39 // PluginResource overrides: | 40 // PluginResource overrides: |
| 40 virtual void OnReplyReceived(const ResourceMessageReplyParams& params, | 41 virtual void OnReplyReceived(const ResourceMessageReplyParams& params, |
| 41 const IPC::Message& msg) OVERRIDE; | 42 const IPC::Message& msg) OVERRIDE; |
| 42 | 43 |
| 43 private: | 44 private: |
| 44 // Message handlers: | 45 // Message handlers: |
| 45 void OnPluginMsgInitFrames(const ResourceMessageReplyParams& params, | 46 void OnPluginMsgInitBuffers(const ResourceMessageReplyParams& params, |
| 46 int32_t number_of_frames, | 47 int32_t number_of_buffers, |
| 47 int32_t frame_size); | 48 int32_t buffer_size); |
| 48 void OnPluginMsgEnqueueFrame(const ResourceMessageReplyParams& params, | 49 void OnPluginMsgEnqueueBuffer(const ResourceMessageReplyParams& params, |
| 49 int32_t index); | 50 int32_t index); |
| 50 | 51 |
| 51 MediaStreamFrameBuffer frame_buffer_; | 52 MediaStreamBufferManager buffer_manager_; |
| 52 | 53 |
| 53 std::string id_; | 54 std::string id_; |
| 54 | 55 |
| 55 bool has_ended_; | 56 bool has_ended_; |
| 56 | 57 |
| 57 DISALLOW_COPY_AND_ASSIGN(MediaStreamTrackResourceBase); | 58 DISALLOW_COPY_AND_ASSIGN(MediaStreamTrackResourceBase); |
| 58 }; | 59 }; |
| 59 | 60 |
| 60 } // namespace proxy | 61 } // namespace proxy |
| 61 } // namespace ppapi | 62 } // namespace ppapi |
| 62 | 63 |
| 63 #endif // PPAPI_PROXY_MEDIA_STREAM_TRACK_RESOURCE_BASE_H_ | 64 #endif // PPAPI_PROXY_MEDIA_STREAM_TRACK_RESOURCE_BASE_H_ |
| OLD | NEW |