| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 EXTENSIONS_RENDERER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_VIDEO_E
NCODER_H_ | 5 #ifndef EXTENSIONS_RENDERER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_VIDEO_E
NCODER_H_ |
| 6 #define EXTENSIONS_RENDERER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_VIDEO_E
NCODER_H_ | 6 #define EXTENSIONS_RENDERER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_VIDEO_E
NCODER_H_ |
| 7 | 7 |
| 8 #include "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
| 9 #include "extensions/renderer/api/display_source/wifi_display/wifi_display_media
_encoder.h" | 9 #include "extensions/renderer/api/display_source/wifi_display/wifi_display_media
_encoder.h" |
| 10 #include "media/base/video_frame.h" | 10 #include "media/base/video_frame.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 struct InitParameters { | 37 struct InitParameters { |
| 38 InitParameters(); | 38 InitParameters(); |
| 39 InitParameters(const InitParameters&); | 39 InitParameters(const InitParameters&); |
| 40 ~InitParameters(); | 40 ~InitParameters(); |
| 41 gfx::Size frame_size; | 41 gfx::Size frame_size; |
| 42 int frame_rate; | 42 int frame_rate; |
| 43 int bit_rate; | 43 int bit_rate; |
| 44 wds::H264Profile profile; | 44 wds::H264Profile profile; |
| 45 wds::H264Level level; | 45 wds::H264Level level; |
| 46 // VEA-specific parameters. | 46 // Video Encode Accelerator (VEA) specific parameters. |
| 47 CreateEncodeMemoryCallback create_memory_callback; | 47 CreateEncodeMemoryCallback create_memory_callback; |
| 48 CreateVideoEncodeAcceleratorCallback vea_create_callback; | 48 CreateVideoEncodeAcceleratorCallback vea_create_callback; |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 // A factory method that creates a new encoder instance from the given | 51 // A factory method that creates a new encoder instance from the given |
| 52 // |params|, the encoder instance is returned as an argument of | 52 // |params|, the encoder instance is returned as an argument of |
| 53 // |result_callback| ('nullptr' argument means encoder creation failure). | 53 // |result_callback| ('nullptr' argument means encoder creation failure). |
| 54 static void Create(const InitParameters& params, | 54 static void Create(const InitParameters& params, |
| 55 const VideoEncoderCallback& encoder_callback); | 55 const VideoEncoderCallback& encoder_callback); |
| 56 | 56 |
| 57 // Encodes the given raw frame. The resulting encoded frame is passed | 57 // Encodes the given raw frame. The resulting encoded frame is passed |
| 58 // as an |encoded_callback|'s argument which is set via 'SetCallbacks' | 58 // as an |encoded_callback|'s argument which is set via 'SetCallbacks' |
| 59 // method. | 59 // method. |
| 60 void InsertRawVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame, | 60 void InsertRawVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame, |
| 61 base::TimeTicks reference_time); | 61 base::TimeTicks reference_time); |
| 62 | 62 |
| 63 // Requests the next encoded frame to be an instantaneous decoding refresh | 63 // Requests the next encoded frame to be an instantaneous decoding refresh |
| 64 // (IDR) picture. | 64 // (IDR) picture. |
| 65 void RequestIDRPicture(); | 65 void RequestIDRPicture(); |
| 66 | 66 |
| 67 protected: | 67 protected: |
| 68 // A factory method that creates a new encoder instance which uses Video |
| 69 // Encode Accelerator (VEA) for encoding. |
| 70 static void CreateVEA(const InitParameters& params, |
| 71 const VideoEncoderCallback& encoder_callback); |
| 72 |
| 68 explicit WiFiDisplayVideoEncoder( | 73 explicit WiFiDisplayVideoEncoder( |
| 69 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner); | 74 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner); |
| 70 ~WiFiDisplayVideoEncoder() override; | 75 ~WiFiDisplayVideoEncoder() override; |
| 71 | 76 |
| 72 virtual void InsertFrameOnMediaThread( | 77 virtual void InsertFrameOnMediaThread( |
| 73 scoped_refptr<media::VideoFrame> video_frame, | 78 scoped_refptr<media::VideoFrame> video_frame, |
| 74 base::TimeTicks reference_time, | 79 base::TimeTicks reference_time, |
| 75 bool send_idr) = 0; | 80 bool send_idr) = 0; |
| 76 | 81 |
| 77 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; | 82 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; |
| 78 bool send_idr_; | 83 bool send_idr_; |
| 79 }; | 84 }; |
| 80 | 85 |
| 81 } // namespace extensions | 86 } // namespace extensions |
| 82 | 87 |
| 83 #endif // EXTENSIONS_RENDERER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_VIDE
O_ENCODER_H_ | 88 #endif // EXTENSIONS_RENDERER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_VIDE
O_ENCODER_H_ |
| OLD | NEW |