OLD | NEW |
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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 buffer_pool_, frame))) | 429 buffer_pool_, frame))) |
430 .first; | 430 .first; |
431 BufferState& buffer_state = it->second; | 431 BufferState& buffer_state = it->second; |
432 DCHECK(buffer_state.HasZeroConsumerHoldCount()); | 432 DCHECK(buffer_state.HasZeroConsumerHoldCount()); |
433 | 433 |
434 if (state_ == VIDEO_CAPTURE_STATE_STARTED) { | 434 if (state_ == VIDEO_CAPTURE_STATE_STARTED) { |
435 if (!frame->metadata()->HasKey(VideoFrameMetadata::FRAME_RATE)) { | 435 if (!frame->metadata()->HasKey(VideoFrameMetadata::FRAME_RATE)) { |
436 frame->metadata()->SetDouble(VideoFrameMetadata::FRAME_RATE, | 436 frame->metadata()->SetDouble(VideoFrameMetadata::FRAME_RATE, |
437 video_capture_format_.frame_rate); | 437 video_capture_format_.frame_rate); |
438 } | 438 } |
439 std::unique_ptr<base::DictionaryValue> metadata( | 439 std::unique_ptr<base::DictionaryValue> metadata = |
440 new base::DictionaryValue()); | 440 frame->metadata()->CopyInternalValues(); |
441 frame->metadata()->MergeInternalValuesInto(metadata.get()); | |
442 | 441 |
443 // Only I420 and Y16 pixel formats are currently supported. | 442 // Only I420 and Y16 pixel formats are currently supported. |
444 DCHECK(frame->format() == media::PIXEL_FORMAT_I420 || | 443 DCHECK(frame->format() == media::PIXEL_FORMAT_I420 || |
445 frame->format() == media::PIXEL_FORMAT_Y16) | 444 frame->format() == media::PIXEL_FORMAT_Y16) |
446 << "Unsupported pixel format: " | 445 << "Unsupported pixel format: " |
447 << media::VideoPixelFormatToString(frame->format()); | 446 << media::VideoPixelFormatToString(frame->format()); |
448 | 447 |
449 // Sanity-checks to confirm |frame| is actually being backed by |buffer|. | 448 // Sanity-checks to confirm |frame| is actually being backed by |buffer|. |
450 DCHECK(frame->storage_type() == media::VideoFrame::STORAGE_SHMEM); | 449 DCHECK(frame->storage_type() == media::VideoFrame::STORAGE_SHMEM); |
451 DCHECK(frame->data(media::VideoFrame::kYPlane) >= buffer->data(0) && | 450 DCHECK(frame->data(media::VideoFrame::kYPlane) >= buffer->data(0) && |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 int session_id, | 567 int session_id, |
569 const ControllerClients& clients) { | 568 const ControllerClients& clients) { |
570 for (const auto& client : clients) { | 569 for (const auto& client : clients) { |
571 if (client->session_id == session_id) | 570 if (client->session_id == session_id) |
572 return client.get(); | 571 return client.get(); |
573 } | 572 } |
574 return nullptr; | 573 return nullptr; |
575 } | 574 } |
576 | 575 |
577 } // namespace content | 576 } // namespace content |
OLD | NEW |