| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_frame_receiver_on_io_thread.
h" | 5 #include "content/browser/renderer_host/media/video_frame_receiver_on_io_thread.
h" |
| 6 | 6 |
| 7 #include "content/public/browser/browser_thread.h" | 7 #include "content/public/browser/browser_thread.h" |
| 8 | 8 |
| 9 namespace content { | 9 namespace content { |
| 10 | 10 |
| 11 VideoFrameReceiverOnIOThread::VideoFrameReceiverOnIOThread( | 11 VideoFrameReceiverOnIOThread::VideoFrameReceiverOnIOThread( |
| 12 const base::WeakPtr<VideoFrameReceiver>& receiver) | 12 const base::WeakPtr<VideoFrameReceiver>& receiver) |
| 13 : receiver_(receiver) {} | 13 : receiver_(receiver) {} |
| 14 | 14 |
| 15 VideoFrameReceiverOnIOThread::~VideoFrameReceiverOnIOThread() = default; | 15 VideoFrameReceiverOnIOThread::~VideoFrameReceiverOnIOThread() = default; |
| 16 | 16 |
| 17 void VideoFrameReceiverOnIOThread::OnIncomingCapturedVideoFrame( | 17 void VideoFrameReceiverOnIOThread::OnIncomingCapturedVideoFrame( |
| 18 std::unique_ptr<media::VideoCaptureDevice::Client::Buffer> buffer, | 18 media::VideoCaptureDevice::Client::Buffer buffer, |
| 19 scoped_refptr<media::VideoFrame> frame) { | 19 scoped_refptr<media::VideoFrame> frame) { |
| 20 content::BrowserThread::PostTask( | 20 content::BrowserThread::PostTask( |
| 21 content::BrowserThread::IO, FROM_HERE, | 21 content::BrowserThread::IO, FROM_HERE, |
| 22 base::Bind(&VideoFrameReceiver::OnIncomingCapturedVideoFrame, receiver_, | 22 base::Bind(&VideoFrameReceiver::OnIncomingCapturedVideoFrame, receiver_, |
| 23 base::Passed(&buffer), frame)); | 23 base::Passed(&buffer), frame)); |
| 24 } | 24 } |
| 25 | 25 |
| 26 void VideoFrameReceiverOnIOThread::OnError() { | 26 void VideoFrameReceiverOnIOThread::OnError() { |
| 27 content::BrowserThread::PostTask( | 27 content::BrowserThread::PostTask( |
| 28 content::BrowserThread::IO, FROM_HERE, | 28 content::BrowserThread::IO, FROM_HERE, |
| 29 base::Bind(&VideoFrameReceiver::OnError, receiver_)); | 29 base::Bind(&VideoFrameReceiver::OnError, receiver_)); |
| 30 } | 30 } |
| 31 | 31 |
| 32 void VideoFrameReceiverOnIOThread::OnLog(const std::string& message) { | 32 void VideoFrameReceiverOnIOThread::OnLog(const std::string& message) { |
| 33 content::BrowserThread::PostTask( | 33 content::BrowserThread::PostTask( |
| 34 content::BrowserThread::IO, FROM_HERE, | 34 content::BrowserThread::IO, FROM_HERE, |
| 35 base::Bind(&VideoFrameReceiver::OnLog, receiver_, message)); | 35 base::Bind(&VideoFrameReceiver::OnLog, receiver_, message)); |
| 36 } | 36 } |
| 37 | 37 |
| 38 void VideoFrameReceiverOnIOThread::OnBufferDestroyed(int buffer_id_to_drop) { | 38 void VideoFrameReceiverOnIOThread::OnBufferDestroyed(int buffer_id_to_drop) { |
| 39 content::BrowserThread::PostTask( | 39 content::BrowserThread::PostTask( |
| 40 content::BrowserThread::IO, FROM_HERE, | 40 content::BrowserThread::IO, FROM_HERE, |
| 41 base::Bind(&VideoFrameReceiver::OnBufferDestroyed, receiver_, | 41 base::Bind(&VideoFrameReceiver::OnBufferDestroyed, receiver_, |
| 42 buffer_id_to_drop)); | 42 buffer_id_to_drop)); |
| 43 } | 43 } |
| 44 | 44 |
| 45 } // namespace content | 45 } // namespace content |
| OLD | NEW |