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

Unified Diff: content/renderer/media/html_video_element_capturer_source.cc

Issue 2150453003: ImageCapture.grabFrame()/<video>.captureStream(), use ABGR pixel format for Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adapted/corrected DLOG message Created 4 years, 5 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
« no previous file with comments | « no previous file | content/renderer/media/image_capture_frame_grabber.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/html_video_element_capturer_source.cc
diff --git a/content/renderer/media/html_video_element_capturer_source.cc b/content/renderer/media/html_video_element_capturer_source.cc
index 88108ee50e587c10a4fd89136333fa3f5d3e2ec1..3df3ea40422c33654f45cb561ab86f606c9ab699 100644
--- a/content/renderer/media/html_video_element_capturer_source.cc
+++ b/content/renderer/media/html_video_element_capturer_source.cc
@@ -147,7 +147,7 @@ void HtmlVideoElementCapturerSource::sendNewFrame() {
DCHECK(!bitmap.drawsNothing());
DCHECK(bitmap.getPixels());
if (bitmap.colorType() != kN32_SkColorType) {
- DLOG(ERROR) << "Only supported capture format is ARGB";
+ DLOG(ERROR) << "Only supported color type is kN32_SkColorType (ARGB/ABGR)";
return;
}
@@ -156,6 +156,10 @@ void HtmlVideoElementCapturerSource::sendNewFrame() {
base::TimeTicks::Now() - base::TimeTicks());
DCHECK(frame);
+ const uint32 source_pixel_format =
+ (kN32_SkColorType == kRGBA_8888_SkColorType) ? libyuv::FOURCC_ABGR
+ : libyuv::FOURCC_ARGB;
+
if (libyuv::ConvertToI420(static_cast<uint8*>(bitmap.getPixels()),
bitmap.getSize(),
frame->data(media::VideoFrame::kYPlane),
@@ -171,7 +175,7 @@ void HtmlVideoElementCapturerSource::sendNewFrame() {
frame->coded_size().width(),
frame->coded_size().height(),
libyuv::kRotate0,
- libyuv::FOURCC_ARGB) == 0) {
+ source_pixel_format) == 0) {
// Success!
io_task_runner_->PostTask(
FROM_HERE, base::Bind(new_frame_callback_, frame, current_time));
« no previous file with comments | « no previous file | content/renderer/media/image_capture_frame_grabber.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698