| 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 336bcd63a7f578d4e757b8de39a5c5d7688dff55..776dea457bfa75eaa85dcfd4589061ff1cbbe66f 100644
|
| --- a/content/browser/media/capture/content_video_capture_device_core.cc
|
| +++ b/content/browser/media/capture/content_video_capture_device_core.cc
|
| @@ -74,8 +74,12 @@ bool ThreadSafeCaptureOracle::ObserveEventAndDecideCapture(
|
| (visible_size.height() + 15) & ~15);
|
|
|
| scoped_ptr<media::VideoCaptureDevice::Client::Buffer> output_buffer(
|
| - client_->ReserveOutputBuffer(params_.requested_format.pixel_format,
|
| - coded_size));
|
| + client_->ReserveOutputBuffer(coded_size,
|
| + (params_.requested_format.pixel_storage !=
|
| + media::PIXEL_STORAGE_TEXTURE)
|
| + ? media::PIXEL_FORMAT_I420
|
| + : media::PIXEL_FORMAT_ARGB,
|
| + params_.requested_format.pixel_storage));
|
| // TODO(miu): Use current buffer pool utilization to drive automatic video
|
| // resolution changes. http://crbug.com/156767.
|
| VLOG(2) << "Current buffer pool utilization is "
|
| @@ -119,9 +123,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,
|
| @@ -231,28 +235,31 @@ 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 &&
|
| - 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;
|
| + if (!(params.requested_format.pixel_storage == media::PIXEL_STORAGE_CPU &&
|
| + params.requested_format.pixel_format == media::PIXEL_FORMAT_I420) &&
|
| + !(params.requested_format.pixel_storage == media::PIXEL_STORAGE_TEXTURE &&
|
| + params.requested_format.pixel_format == media::PIXEL_FORMAT_ARGB)) {
|
| + const std::string error_msg =
|
| + base::StringPrintf("unsupported format %s and storage %s combination.",
|
| + 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;
|
| }
|
|
|
|
|