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

Side by Side Diff: content/browser/renderer_host/media/video_capture_controller.cc

Issue 2577563002: Add struct traits for base::Value. (Closed)
Patch Set: rebase Created 4 years 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 unified diff | Download patch
« no previous file with comments | « components/typemaps.gni ('k') | content/browser/renderer_host/media/video_capture_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/media/video_capture_controller.h" 5 #include "content/browser/renderer_host/media/video_capture_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 frame_buffer_pool_.get(), frame))) 386 frame_buffer_pool_.get(), frame)))
387 .first; 387 .first;
388 BufferState& buffer_state = it->second; 388 BufferState& buffer_state = it->second;
389 DCHECK(buffer_state.HasZeroConsumerHoldCount()); 389 DCHECK(buffer_state.HasZeroConsumerHoldCount());
390 390
391 if (state_ == VIDEO_CAPTURE_STATE_STARTED) { 391 if (state_ == VIDEO_CAPTURE_STATE_STARTED) {
392 if (!frame->metadata()->HasKey(VideoFrameMetadata::FRAME_RATE)) { 392 if (!frame->metadata()->HasKey(VideoFrameMetadata::FRAME_RATE)) {
393 frame->metadata()->SetDouble(VideoFrameMetadata::FRAME_RATE, 393 frame->metadata()->SetDouble(VideoFrameMetadata::FRAME_RATE,
394 video_capture_format_.frame_rate); 394 video_capture_format_.frame_rate);
395 } 395 }
396 std::unique_ptr<base::DictionaryValue> metadata( 396 std::unique_ptr<base::DictionaryValue> metadata =
397 new base::DictionaryValue()); 397 frame->metadata()->CopyInternalValues();
398 frame->metadata()->MergeInternalValuesInto(metadata.get());
399 398
400 // Only I420 and Y16 pixel formats are currently supported. 399 // Only I420 and Y16 pixel formats are currently supported.
401 DCHECK(frame->format() == media::PIXEL_FORMAT_I420 || 400 DCHECK(frame->format() == media::PIXEL_FORMAT_I420 ||
402 frame->format() == media::PIXEL_FORMAT_Y16) 401 frame->format() == media::PIXEL_FORMAT_Y16)
403 << "Unsupported pixel format: " 402 << "Unsupported pixel format: "
404 << media::VideoPixelFormatToString(frame->format()); 403 << media::VideoPixelFormatToString(frame->format());
405 404
406 // Sanity-checks to confirm |frame| is actually being backed by |buffer|. 405 // Sanity-checks to confirm |frame| is actually being backed by |buffer|.
407 DCHECK(frame->storage_type() == media::VideoFrame::STORAGE_SHMEM); 406 DCHECK(frame->storage_type() == media::VideoFrame::STORAGE_SHMEM);
408 DCHECK(frame->data(media::VideoFrame::kYPlane) >= buffer->data(0) && 407 DCHECK(frame->data(media::VideoFrame::kYPlane) >= buffer->data(0) &&
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 int session_id, 525 int session_id,
527 const ControllerClients& clients) { 526 const ControllerClients& clients) {
528 for (const auto& client : clients) { 527 for (const auto& client : clients) {
529 if (client->session_id == session_id) 528 if (client->session_id == session_id)
530 return client.get(); 529 return client.get();
531 } 530 }
532 return nullptr; 531 return nullptr;
533 } 532 }
534 533
535 } // namespace content 534 } // namespace content
OLDNEW
« no previous file with comments | « components/typemaps.gni ('k') | content/browser/renderer_host/media/video_capture_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698