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

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

Issue 2490153003: [Mojo Video Capture] Replace const scoped_refptr<T>& with scoped_refptr<T> and use std::move (Closed)
Patch Set: fix bots Created 4 years, 1 month 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
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // Decorator for media::VideoFrameReceiver that forwards all incoming calls 88 // Decorator for media::VideoFrameReceiver that forwards all incoming calls
89 // to the Browser IO thread. 89 // to the Browser IO thread.
90 class VideoFrameReceiverOnIOThread : public media::VideoFrameReceiver { 90 class VideoFrameReceiverOnIOThread : public media::VideoFrameReceiver {
91 public: 91 public:
92 explicit VideoFrameReceiverOnIOThread( 92 explicit VideoFrameReceiverOnIOThread(
93 const base::WeakPtr<VideoFrameReceiver>& receiver) 93 const base::WeakPtr<VideoFrameReceiver>& receiver)
94 : receiver_(receiver) {} 94 : receiver_(receiver) {}
95 95
96 void OnIncomingCapturedVideoFrame( 96 void OnIncomingCapturedVideoFrame(
97 std::unique_ptr<media::VideoCaptureDevice::Client::Buffer> buffer, 97 std::unique_ptr<media::VideoCaptureDevice::Client::Buffer> buffer,
98 const scoped_refptr<media::VideoFrame>& frame) override { 98 scoped_refptr<media::VideoFrame> frame) override {
99 BrowserThread::PostTask( 99 BrowserThread::PostTask(
100 BrowserThread::IO, FROM_HERE, 100 BrowserThread::IO, FROM_HERE,
101 base::Bind(&VideoFrameReceiver::OnIncomingCapturedVideoFrame, receiver_, 101 base::Bind(&VideoFrameReceiver::OnIncomingCapturedVideoFrame, receiver_,
102 base::Passed(&buffer), frame)); 102 base::Passed(&buffer), std::move(frame)));
103 } 103 }
104 104
105 void OnError() override { 105 void OnError() override {
106 BrowserThread::PostTask( 106 BrowserThread::PostTask(
107 BrowserThread::IO, FROM_HERE, 107 BrowserThread::IO, FROM_HERE,
108 base::Bind(&VideoFrameReceiver::OnError, receiver_)); 108 base::Bind(&VideoFrameReceiver::OnError, receiver_));
109 } 109 }
110 110
111 void OnLog(const std::string& message) override { 111 void OnLog(const std::string& message) override {
112 BrowserThread::PostTask( 112 BrowserThread::PostTask(
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 VideoCaptureController::GetVideoCaptureFormat() const { 395 VideoCaptureController::GetVideoCaptureFormat() const {
396 DCHECK_CURRENTLY_ON(BrowserThread::IO); 396 DCHECK_CURRENTLY_ON(BrowserThread::IO);
397 return video_capture_format_; 397 return video_capture_format_;
398 } 398 }
399 399
400 VideoCaptureController::~VideoCaptureController() { 400 VideoCaptureController::~VideoCaptureController() {
401 } 401 }
402 402
403 void VideoCaptureController::OnIncomingCapturedVideoFrame( 403 void VideoCaptureController::OnIncomingCapturedVideoFrame(
404 std::unique_ptr<media::VideoCaptureDevice::Client::Buffer> buffer, 404 std::unique_ptr<media::VideoCaptureDevice::Client::Buffer> buffer,
405 const scoped_refptr<VideoFrame>& frame) { 405 scoped_refptr<VideoFrame> frame) {
406 DCHECK_CURRENTLY_ON(BrowserThread::IO); 406 DCHECK_CURRENTLY_ON(BrowserThread::IO);
407 const int buffer_id = buffer->id(); 407 const int buffer_id = buffer->id();
408 DCHECK_NE(buffer_id, media::VideoCaptureBufferPool::kInvalidId); 408 DCHECK_NE(buffer_id, media::VideoCaptureBufferPool::kInvalidId);
409 409
410 int count = 0; 410 int count = 0;
411 if (state_ == VIDEO_CAPTURE_STATE_STARTED) { 411 if (state_ == VIDEO_CAPTURE_STATE_STARTED) {
412 if (!frame->metadata()->HasKey(VideoFrameMetadata::FRAME_RATE)) { 412 if (!frame->metadata()->HasKey(VideoFrameMetadata::FRAME_RATE)) {
413 frame->metadata()->SetDouble(VideoFrameMetadata::FRAME_RATE, 413 frame->metadata()->SetDouble(VideoFrameMetadata::FRAME_RATE,
414 video_capture_format_.frame_rate); 414 video_capture_format_.frame_rate);
415 } 415 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 int session_id, 530 int session_id,
531 const ControllerClients& clients) { 531 const ControllerClients& clients) {
532 for (const auto& client : clients) { 532 for (const auto& client : clients) {
533 if (client->session_id == session_id) 533 if (client->session_id == session_id)
534 return client.get(); 534 return client.get();
535 } 535 }
536 return nullptr; 536 return nullptr;
537 } 537 }
538 538
539 } // namespace content 539 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698