| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_SOURCE_HOST_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_SOURCE_HOST_H_ |
| 6 #define CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_SOURCE_HOST_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_SOURCE_HOST_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> |
| 11 |
| 10 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" | 13 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 15 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
| 16 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
| 17 #include "ppapi/c/pp_time.h" | 18 #include "ppapi/c/pp_time.h" |
| 18 #include "ppapi/c/ppb_image_data.h" | 19 #include "ppapi/c/ppb_image_data.h" |
| 19 #include "ppapi/host/host_message_context.h" | 20 #include "ppapi/host/host_message_context.h" |
| 20 #include "ppapi/host/resource_host.h" | 21 #include "ppapi/host/resource_host.h" |
| 21 | 22 |
| 22 struct PP_ImageDataDesc; | 23 struct PP_ImageDataDesc; |
| 23 | 24 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // Sends the reply to a GetFrame message from the plugin. A reply is always | 57 // Sends the reply to a GetFrame message from the plugin. A reply is always |
| 57 // sent and last_frame_, reply_context_, and get_frame_pending_ are all reset. | 58 // sent and last_frame_, reply_context_, and get_frame_pending_ are all reset. |
| 58 void SendGetFrameReply(); | 59 void SendGetFrameReply(); |
| 59 // Sends the reply to a GetFrame message from the plugin in case of an error. | 60 // Sends the reply to a GetFrame message from the plugin in case of an error. |
| 60 void SendGetFrameErrorReply(int32_t error); | 61 void SendGetFrameErrorReply(int32_t error); |
| 61 | 62 |
| 62 void Close(); | 63 void Close(); |
| 63 | 64 |
| 64 ppapi::host::ReplyMessageContext reply_context_; | 65 ppapi::host::ReplyMessageContext reply_context_; |
| 65 | 66 |
| 66 scoped_ptr<VideoTrackToPepperAdapter> frame_source_; | 67 std::unique_ptr<VideoTrackToPepperAdapter> frame_source_; |
| 67 scoped_refptr<FrameReceiver> frame_receiver_; | 68 scoped_refptr<FrameReceiver> frame_receiver_; |
| 68 std::string stream_url_; | 69 std::string stream_url_; |
| 69 scoped_refptr<media::VideoFrame> last_frame_; | 70 scoped_refptr<media::VideoFrame> last_frame_; |
| 70 // An internal frame buffer to avoid reallocations. It is only allocated if | 71 // An internal frame buffer to avoid reallocations. It is only allocated if |
| 71 // scaling is needed. | 72 // scaling is needed. |
| 72 scoped_refptr<media::VideoFrame> scaled_frame_; | 73 scoped_refptr<media::VideoFrame> scaled_frame_; |
| 73 bool get_frame_pending_; | 74 bool get_frame_pending_; |
| 74 // We use only one ImageData resource in order to avoid allocating | 75 // We use only one ImageData resource in order to avoid allocating |
| 75 // shared memory repeatedly. We send the same one each time the plugin | 76 // shared memory repeatedly. We send the same one each time the plugin |
| 76 // requests a frame. For this to work, the plugin must finish using | 77 // requests a frame. For this to work, the plugin must finish using |
| 77 // the ImageData it receives prior to calling GetFrame, and not access | 78 // the ImageData it receives prior to calling GetFrame, and not access |
| 78 // the ImageData until it gets its next callback to GetFrame. | 79 // the ImageData until it gets its next callback to GetFrame. |
| 79 scoped_refptr<PPB_ImageData_Impl> shared_image_; | 80 scoped_refptr<PPB_ImageData_Impl> shared_image_; |
| 80 PP_ImageDataDesc shared_image_desc_; | 81 PP_ImageDataDesc shared_image_desc_; |
| 81 | 82 |
| 82 base::WeakPtrFactory<PepperVideoSourceHost> weak_factory_; | 83 base::WeakPtrFactory<PepperVideoSourceHost> weak_factory_; |
| 83 | 84 |
| 84 DISALLOW_COPY_AND_ASSIGN(PepperVideoSourceHost); | 85 DISALLOW_COPY_AND_ASSIGN(PepperVideoSourceHost); |
| 85 }; | 86 }; |
| 86 | 87 |
| 87 } // namespace content | 88 } // namespace content |
| 88 | 89 |
| 89 #endif // CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_SOURCE_HOST_H_ | 90 #endif // CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_SOURCE_HOST_H_ |
| OLD | NEW |