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

Unified Diff: chrome/renderer/media/cast_rtp_stream.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
Index: chrome/renderer/media/cast_rtp_stream.cc
diff --git a/chrome/renderer/media/cast_rtp_stream.cc b/chrome/renderer/media/cast_rtp_stream.cc
index 755cfd372b4f37402b3c3d41be5551e1667c6c50..f5dac133b174d666591f61363f5620984b874006 100644
--- a/chrome/renderer/media/cast_rtp_stream.cc
+++ b/chrome/renderer/media/cast_rtp_stream.cc
@@ -329,6 +329,18 @@ class CastVideoSink : public base::SupportsWeakPtr<CastVideoSink>,
? base::TimeTicks::Now()
: estimated_capture_time;
+ if (!(frame->IsMappable() &&
+ (frame->format() == media::PIXEL_FORMAT_I420 ||
+ frame->format() == media::PIXEL_FORMAT_YV12 ||
+ frame->format() == media::PIXEL_FORMAT_YV12A))) {
+ NOTREACHED();
+ return;
+ }
+
+ // Drop alpha channel since we do not support it yet.
+ if (frame->format() == media::PIXEL_FORMAT_YV12A)
+ frame->DropYV12AAlphaChannel();
+
// Used by chrome/browser/extension/api/cast_streaming/performance_test.cc
TRACE_EVENT_INSTANT2(
"cast_perf_test", "MediaStreamVideoSink::OnVideoFrame",
« no previous file with comments | « no previous file | content/renderer/media/canvas_capture_handler.cc » ('j') | content/renderer/media/canvas_capture_handler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698