| 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 <vector> |
| 9 |
| 8 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| 11 #include "extensions/renderer/api/display_source/wifi_display/wifi_display_eleme
ntary_stream_descriptor.h" |
| 9 #include "extensions/renderer/api/display_source/wifi_display/wifi_display_media
_encoder.h" | 12 #include "extensions/renderer/api/display_source/wifi_display/wifi_display_media
_encoder.h" |
| 10 #include "media/base/video_frame.h" | 13 #include "media/base/video_frame.h" |
| 11 #include "media/video/video_encode_accelerator.h" | 14 #include "media/video/video_encode_accelerator.h" |
| 12 #include "third_party/wds/src/libwds/public/video_format.h" | 15 #include "third_party/wds/src/libwds/public/video_format.h" |
| 13 | 16 |
| 14 namespace extensions { | 17 namespace extensions { |
| 15 | 18 |
| 16 using WiFiDisplayEncodedFrame = WiFiDisplayEncodedUnit; | 19 using WiFiDisplayEncodedFrame = WiFiDisplayEncodedUnit; |
| 17 | 20 |
| 18 // This interface represents H.264 video encoder used by the | 21 // This interface represents H.264 video encoder used by the |
| (...skipping 28 matching lines...) Expand all Loading... |
| 47 CreateEncodeMemoryCallback create_memory_callback; | 50 CreateEncodeMemoryCallback create_memory_callback; |
| 48 CreateVideoEncodeAcceleratorCallback vea_create_callback; | 51 CreateVideoEncodeAcceleratorCallback vea_create_callback; |
| 49 }; | 52 }; |
| 50 | 53 |
| 51 // A factory method that creates a new encoder instance from the given | 54 // A factory method that creates a new encoder instance from the given |
| 52 // |params|, the encoder instance is returned as an argument of | 55 // |params|, the encoder instance is returned as an argument of |
| 53 // |result_callback| ('nullptr' argument means encoder creation failure). | 56 // |result_callback| ('nullptr' argument means encoder creation failure). |
| 54 static void Create(const InitParameters& params, | 57 static void Create(const InitParameters& params, |
| 55 const VideoEncoderCallback& encoder_callback); | 58 const VideoEncoderCallback& encoder_callback); |
| 56 | 59 |
| 60 // WiFiDisplayMediaEncoder |
| 61 WiFiDisplayElementaryStreamInfo CreateElementaryStreamInfo() const final; |
| 62 |
| 57 // Encodes the given raw frame. The resulting encoded frame is passed | 63 // Encodes the given raw frame. The resulting encoded frame is passed |
| 58 // as an |encoded_callback|'s argument which is set via 'SetCallbacks' | 64 // as an |encoded_callback|'s argument which is set via 'SetCallbacks' |
| 59 // method. | 65 // method. |
| 60 void InsertRawVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame, | 66 void InsertRawVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame, |
| 61 base::TimeTicks reference_time); | 67 base::TimeTicks reference_time); |
| 62 | 68 |
| 63 // Requests the next encoded frame to be an instantaneous decoding refresh | 69 // Requests the next encoded frame to be an instantaneous decoding refresh |
| 64 // (IDR) picture. | 70 // (IDR) picture. |
| 65 void RequestIDRPicture(); | 71 void RequestIDRPicture(); |
| 66 | 72 |
| 67 protected: | 73 protected: |
| 68 // A factory method that creates a new encoder instance which uses Video | 74 // A factory method that creates a new encoder instance which uses Video |
| 69 // Encode Accelerator (VEA) for encoding. | 75 // Encode Accelerator (VEA) for encoding. |
| 70 static void CreateVEA(const InitParameters& params, | 76 static void CreateVEA(const InitParameters& params, |
| 71 const VideoEncoderCallback& encoder_callback); | 77 const VideoEncoderCallback& encoder_callback); |
| 72 | 78 |
| 73 explicit WiFiDisplayVideoEncoder( | 79 explicit WiFiDisplayVideoEncoder( |
| 74 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner); | 80 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner); |
| 75 ~WiFiDisplayVideoEncoder() override; | 81 ~WiFiDisplayVideoEncoder() override; |
| 76 | 82 |
| 83 virtual std::vector<WiFiDisplayElementaryStreamDescriptor> |
| 84 CreateElementaryStreamDescriptors() const; |
| 85 |
| 77 virtual void InsertFrameOnMediaThread( | 86 virtual void InsertFrameOnMediaThread( |
| 78 scoped_refptr<media::VideoFrame> video_frame, | 87 scoped_refptr<media::VideoFrame> video_frame, |
| 79 base::TimeTicks reference_time, | 88 base::TimeTicks reference_time, |
| 80 bool send_idr) = 0; | 89 bool send_idr) = 0; |
| 81 | 90 |
| 82 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; | 91 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; |
| 83 bool send_idr_; | 92 bool send_idr_; |
| 84 }; | 93 }; |
| 85 | 94 |
| 86 } // namespace extensions | 95 } // namespace extensions |
| 87 | 96 |
| 88 #endif // EXTENSIONS_RENDERER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_VIDE
O_ENCODER_H_ | 97 #endif // EXTENSIONS_RENDERER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_VIDE
O_ENCODER_H_ |
| OLD | NEW |