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

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

Issue 500653003: Video capture frame size: separate coded size and visible size. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix content_unittests build. 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 | content/browser/media/capture/desktop_capture_device_aura.cc » ('j') | 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 2477816798ad8c553f83095a4ffac0b5a75ad525..03efa601aa577afc9f0ed6949c235cda6bda0744 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 multiple 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 | content/browser/media/capture/desktop_capture_device_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698