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

Unified Diff: content/browser/media/capture/content_video_capture_device_core.cc

Issue 457823003: Video capture should set visible size and coded size separately. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Actually separate visible and coded size Created 6 years, 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/media/capture/content_video_capture_device_core.cc
diff --git a/content/browser/media/capture/content_video_capture_device_core.cc b/content/browser/media/capture/content_video_capture_device_core.cc
index 8152b3dbe0e9cc19636190fff20137c9555ec88f..5c852d01efe5e6fced23b6f47569db4be591087d 100644
--- a/content/browser/media/capture/content_video_capture_device_core.cc
+++ b/content/browser/media/capture/content_video_capture_device_core.cc
@@ -75,9 +75,14 @@ bool ThreadSafeCaptureOracle::ObserveEventAndDecideCapture(
if (!client_)
return false; // Capture is stopped.
+ // Always round up the coded size to multiples of 16 pixels.
+ // See http://crbug.com/402151.
+ const gfx::Size visible_size = params_.requested_format.frame_size;
+ const gfx::Size coded_size((visible_size.width() + 15) & ~15,
+ (visible_size.height() + 15) & ~15);
+
scoped_refptr<media::VideoCaptureDevice::Client::Buffer> output_buffer =
- client_->ReserveOutputBuffer(video_frame_format_,
- params_.requested_format.frame_size);
+ client_->ReserveOutputBuffer(video_frame_format_, coded_size);
const bool should_capture =
oracle_->ObserveEventAndDecideCapture(event, damage_rect, event_time);
const bool content_is_dirty =
@@ -123,9 +128,9 @@ bool ThreadSafeCaptureOracle::ObserveEventAndDecideCapture(
if (video_frame_format_ != media::VideoFrame::NATIVE_TEXTURE) {
*storage = media::VideoFrame::WrapExternalPackedMemory(
video_frame_format_,
- params_.requested_format.frame_size,
- gfx::Rect(params_.requested_format.frame_size),
- params_.requested_format.frame_size,
+ coded_size,
+ gfx::Rect(visible_size),
+ visible_size,
static_cast<uint8*>(output_buffer->data()),
output_buffer->size(),
base::SharedMemory::NULLHandle(),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698