Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(779)

Unified Diff: media/base/video_frame.cc

Issue 1737253002: Handle Alpha channel in Canvas capture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« media/base/video_frame.h ('K') | « media/base/video_frame.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/video_frame.cc
diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc
index 4dedd82d10b20633d091bd24aebd31b203c32719..1dba90e427bc5eddfe47f28d17ff963630f92efe 100644
--- a/media/base/video_frame.cc
+++ b/media/base/video_frame.cc
@@ -857,6 +857,22 @@ CVPixelBufferRef VideoFrame::cv_pixel_buffer() const {
}
#endif
+bool VideoFrame::DropYV12AAlphaChannel() {
+ if (format_ != PIXEL_FORMAT_YV12A) {
+ LOG(DFATAL) << "Only PIXEL_FORMAT_YV12A format supported: "
+ << VideoPixelFormatToString(format_);
+ return false;
+ }
+ if (storage_type_ != STORAGE_OWNED_MEMORY) {
+ LOG(DFATAL) << "Only STORAGE_OWNED_MEMORY format supported.";
mcasas 2016/02/25 22:06:25 What about ShMeM? I'd say either consider all cas
emircan 2016/02/26 01:33:08 Adding DCHECKs for supported types.
+ return false;
+ }
+ format_ = PIXEL_FORMAT_I420;
+ data_[kAPlane] = nullptr;
+ strides_[kAPlane] = 0;
+ return true;
+}
+
void VideoFrame::AddDestructionObserver(const base::Closure& callback) {
DCHECK(!callback.is_null());
done_callbacks_.push_back(callback);
« media/base/video_frame.h ('K') | « media/base/video_frame.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698