Chromium Code Reviews| Index: media/base/video_util.cc |
| diff --git a/media/base/video_util.cc b/media/base/video_util.cc |
| index c628673824424e423aef616b1dd2a162a96eaa15..aa527b18dbaeb13b729552d190c910f53d58c75e 100644 |
| --- a/media/base/video_util.cc |
| +++ b/media/base/video_util.cc |
| @@ -14,6 +14,14 @@ |
| namespace media { |
| +namespace { |
| + |
| +// Empty method used for keeping a reference to the original media::VideoFrame. |
| +// The reference to |frame| is kept in the closure that calls this method. |
|
mcasas
2016/02/29 23:48:01
nit: This second sentence doesn't make sense :)
emircan
2016/03/01 20:07:55
Done.
|
| +void ReleaseOriginalFrame(const scoped_refptr<media::VideoFrame>& frame) {} |
|
mcasas
2016/02/29 23:48:01
Can we use base::DeletePointer? [1]
Also, no empt
emircan
2016/03/01 20:07:55
DeletePointer doesn't support ref_ptr as it only e
|
| + |
| +} // namespace |
| + |
| gfx::Size GetNaturalSize(const gfx::Size& visible_size, |
| int aspect_ratio_numerator, |
| int aspect_ratio_denominator) { |
| @@ -316,4 +324,20 @@ void CopyRGBToVideoFrame(const uint8_t* source, |
| uv_stride); |
| } |
| +scoped_refptr<VideoFrame> DropYV12AAlphaChannel( |
| + const scoped_refptr<VideoFrame>& frame) { |
| + DCHECK_EQ(VideoFrame::STORAGE_OWNED_MEMORY, frame->storage_type()); |
| + DCHECK_EQ(PIXEL_FORMAT_YV12A, frame->format()); |
| + |
| + scoped_refptr<media::VideoFrame> wrapped_frame = |
| + media::VideoFrame::WrapVideoFrame(frame, PIXEL_FORMAT_I420, |
| + frame->visible_rect(), |
| + frame->natural_size()); |
| + if (!wrapped_frame) |
| + return nullptr; |
| + wrapped_frame->AddDestructionObserver( |
| + base::Bind(&ReleaseOriginalFrame, frame)); |
| + return wrapped_frame; |
| +} |
| + |
| } // namespace media |