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

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

Issue 1179323002: Video Capture: extract storage info from pixel format in VideoCaptureFormat. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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: 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 edfe2e50ca0ca1ffcd23e6413a430d8ca093de33..6a6503732cd3506f518275ccba3e98cb12485f5e 100644
--- a/content/browser/media/capture/content_video_capture_device_core.cc
+++ b/content/browser/media/capture/content_video_capture_device_core.cc
@@ -73,9 +73,14 @@ bool ThreadSafeCaptureOracle::ObserveEventAndDecideCapture(
const gfx::Size coded_size((visible_size.width() + 15) & ~15,
(visible_size.height() + 15) & ~15);
+ const media::VideoCaptureFormat requested_format(
+ coded_size, 0.0f,
+ (params_.requested_format.pixel_storage != media::PIXEL_STORAGE_TEXTURE)
+ ? media::PIXEL_FORMAT_I420
+ : media::PIXEL_FORMAT_ARGB,
+ params_.requested_format.pixel_storage);
scoped_ptr<media::VideoCaptureDevice::Client::Buffer> output_buffer(
- client_->ReserveOutputBuffer(params_.requested_format.pixel_format,
- coded_size));
+ client_->ReserveOutputBuffer(requested_format));
const bool should_capture =
oracle_.ObserveEventAndDecideCapture(event, damage_rect, event_time);
const char* event_name =
@@ -113,9 +118,9 @@ bool ThreadSafeCaptureOracle::ObserveEventAndDecideCapture(
TRACE_EVENT_ASYNC_BEGIN2("gpu.capture", "Capture", output_buffer.get(),
"frame_number", frame_number,
"trigger", event_name);
- // NATIVE_TEXTURE frames wrap a texture mailbox, which we don't have at the
- // moment. We do not construct those frames.
- if (params_.requested_format.pixel_format != media::PIXEL_FORMAT_TEXTURE) {
+ // Texture frames wrap a texture mailbox, which we don't have at the moment.
+ // We do not construct those frames.
+ if (params_.requested_format.pixel_storage != media::PIXEL_STORAGE_TEXTURE) {
*storage = media::VideoFrame::WrapExternalData(
media::VideoFrame::I420,
coded_size,
@@ -225,28 +230,29 @@ void ContentVideoCaptureDeviceCore::AllocateAndStart(
return;
}
- if (params.requested_format.frame_rate <= 0) {
- std::string error_msg("Invalid frame_rate: ");
- error_msg += base::DoubleToString(params.requested_format.frame_rate);
- DVLOG(1) << error_msg;
+ if (params.requested_format.frame_rate <= 0.0f) {
+ const std::string error_msg = base::StringPrintf(
+ "Invalid frame_rate: %.3f", params.requested_format.frame_rate);
client->OnError(error_msg);
return;
}
if (params.requested_format.pixel_format != media::PIXEL_FORMAT_I420 &&
miu 2015/06/13 00:41:37 I think you meant for this expression to be: if
mcasas 2015/06/16 23:14:01 Actually I think it would be more accurate to say:
- params.requested_format.pixel_format != media::PIXEL_FORMAT_TEXTURE) {
- std::string error_msg = base::StringPrintf(
- "unsupported format: %d", params.requested_format.pixel_format);
- DVLOG(1) << error_msg;
+ params.requested_format.pixel_storage != media::PIXEL_STORAGE_TEXTURE) {
+ const std::string error_msg =
+ base::StringPrintf("unsupported format: %s or storage: %s",
+ media::VideoCaptureFormat::PixelFormatToString(
+ params.requested_format.pixel_format)
+ .c_str(),
+ media::VideoCaptureFormat::PixelStorageToString(
+ params.requested_format.pixel_storage)
+ .c_str());
client->OnError(error_msg);
return;
}
if (params.requested_format.frame_size.IsEmpty()) {
- std::string error_msg =
- "invalid frame size: " + params.requested_format.frame_size.ToString();
- DVLOG(1) << error_msg;
- client->OnError(error_msg);
+ client->OnError("invalid empty frame size");
return;
}

Powered by Google App Engine
This is Rietveld 408576698