| 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_host.h" | 5 #include "content/browser/renderer_host/media/video_capture_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "content/browser/browser_main_loop.h" | 9 #include "content/browser/browser_main_loop.h" |
| 10 #include "content/browser/renderer_host/media/media_stream_manager.h" | 10 #include "content/browser/renderer_host/media/media_stream_manager.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 int buffer_id) { | 62 int buffer_id) { |
| 63 BrowserThread::PostTask( | 63 BrowserThread::PostTask( |
| 64 BrowserThread::IO, FROM_HERE, | 64 BrowserThread::IO, FROM_HERE, |
| 65 base::Bind(&VideoCaptureHost::DoSendFreeBufferOnIOThread, | 65 base::Bind(&VideoCaptureHost::DoSendFreeBufferOnIOThread, |
| 66 this, controller_id, buffer_id)); | 66 this, controller_id, buffer_id)); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void VideoCaptureHost::OnBufferReady( | 69 void VideoCaptureHost::OnBufferReady( |
| 70 const VideoCaptureControllerID& controller_id, | 70 const VideoCaptureControllerID& controller_id, |
| 71 int buffer_id, | 71 int buffer_id, |
| 72 base::Time timestamp, | 72 base::TimeTicks timestamp, |
| 73 const media::VideoCaptureFormat& frame_format) { | 73 const media::VideoCaptureFormat& frame_format) { |
| 74 BrowserThread::PostTask( | 74 BrowserThread::PostTask( |
| 75 BrowserThread::IO, FROM_HERE, | 75 BrowserThread::IO, FROM_HERE, |
| 76 base::Bind(&VideoCaptureHost::DoSendFilledBufferOnIOThread, | 76 base::Bind(&VideoCaptureHost::DoSendFilledBufferOnIOThread, |
| 77 this, controller_id, buffer_id, timestamp, | 77 this, controller_id, buffer_id, timestamp, |
| 78 frame_format)); | 78 frame_format)); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void VideoCaptureHost::OnEnded(const VideoCaptureControllerID& controller_id) { | 81 void VideoCaptureHost::OnEnded(const VideoCaptureControllerID& controller_id) { |
| 82 DVLOG(1) << "VideoCaptureHost::OnEnded"; | 82 DVLOG(1) << "VideoCaptureHost::OnEnded"; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 105 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 105 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 106 | 106 |
| 107 if (entries_.find(controller_id) == entries_.end()) | 107 if (entries_.find(controller_id) == entries_.end()) |
| 108 return; | 108 return; |
| 109 | 109 |
| 110 Send(new VideoCaptureMsg_FreeBuffer(controller_id.device_id, buffer_id)); | 110 Send(new VideoCaptureMsg_FreeBuffer(controller_id.device_id, buffer_id)); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void VideoCaptureHost::DoSendFilledBufferOnIOThread( | 113 void VideoCaptureHost::DoSendFilledBufferOnIOThread( |
| 114 const VideoCaptureControllerID& controller_id, | 114 const VideoCaptureControllerID& controller_id, |
| 115 int buffer_id, base::Time timestamp, | 115 int buffer_id, |
| 116 base::TimeTicks timestamp, |
| 116 const media::VideoCaptureFormat& format) { | 117 const media::VideoCaptureFormat& format) { |
| 117 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 118 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 118 | 119 |
| 119 if (entries_.find(controller_id) == entries_.end()) | 120 if (entries_.find(controller_id) == entries_.end()) |
| 120 return; | 121 return; |
| 121 | 122 |
| 122 Send(new VideoCaptureMsg_BufferReady(controller_id.device_id, buffer_id, | 123 Send(new VideoCaptureMsg_BufferReady(controller_id.device_id, buffer_id, |
| 123 timestamp, format)); | 124 timestamp, format)); |
| 124 } | 125 } |
| 125 | 126 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 return; | 264 return; |
| 264 | 265 |
| 265 if (it->second) { | 266 if (it->second) { |
| 266 media_stream_manager_->video_capture_manager()->StopCaptureForClient( | 267 media_stream_manager_->video_capture_manager()->StopCaptureForClient( |
| 267 it->second.get(), controller_id, this); | 268 it->second.get(), controller_id, this); |
| 268 } | 269 } |
| 269 entries_.erase(it); | 270 entries_.erase(it); |
| 270 } | 271 } |
| 271 | 272 |
| 272 } // namespace content | 273 } // namespace content |
| OLD | NEW |