Index: media/base/video_util.h |
diff --git a/media/base/video_util.h b/media/base/video_util.h |
index 2dec7e9371013ff3bf0442cb798cef0c90104659..9c18cdcd169026ca45bd4a564b366777e512b80d 100644 |
--- a/media/base/video_util.h |
+++ b/media/base/video_util.h |
@@ -97,6 +97,25 @@ MEDIA_EXPORT void CopyRGBToVideoFrame(const uint8_t* source, |
MEDIA_EXPORT scoped_refptr<VideoFrame> WrapAsI420VideoFrame( |
const scoped_refptr<VideoFrame>& frame); |
+// Copy I420 video frame to match the required coded size and pad the region |
+// outside the visible rect repeatly with the last column / row up to the coded |
+// size of |dst_frame|. Return false when |dst_frame| is empty or visible rect |
+// is empty. |
+// One application is content mirroring using HW encoder. As the required coded |
+// size for encoder is unknown before capturing, memory copy is needed when the |
+// coded size does not match the requirement. Padding can improve the encoding |
+// efficiency in this case, as the encoder will encode the whole coded region. |
+// Performance-wise, this function could be expensive as it does memory copy of |
+// the whole visible rect. |
+// Note: |
+// 1. |src_frame| and |dst_frame| should have same size of visible rect. |
+// 2. The visible rect's origin of |dst_frame| should be (0,0). |
+// 3. |dst_frame|'s coded size (both width and height) should be larger than or |
+// equal to the visible size, since the visible region in both frames should be |
+// identical. |
+MEDIA_EXPORT bool I420CopyWithPadding(const VideoFrame& src_frame, |
+ VideoFrame* dst_frame) WARN_UNUSED_RESULT; |
+ |
} // namespace media |
#endif // MEDIA_BASE_VIDEO_UTIL_H_ |