Chromium Code Reviews| 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 // VideoCaptureImpl represents a capture device in renderer process. It provides | 5 // VideoCaptureImpl represents a capture device in renderer process. It provides |
| 6 // interfaces for clients to Start/Stop capture. It also communicates to clients | 6 // interfaces for clients to Start/Stop capture. It also communicates to clients |
| 7 // when buffer is ready, state of capture device is changed. | 7 // when buffer is ready, state of capture device is changed. |
| 8 | 8 |
| 9 // VideoCaptureImpl is also a delegate of VideoCaptureMessageFilter which relays | 9 // VideoCaptureImpl is also a delegate of VideoCaptureMessageFilter which relays |
| 10 // operation of a capture device to the browser process and receives responses | 10 // operation of a capture device to the browser process and receives responses |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 32 #include <map> | 32 #include <map> |
| 33 | 33 |
| 34 #include "base/memory/weak_ptr.h" | 34 #include "base/memory/weak_ptr.h" |
| 35 #include "content/common/content_export.h" | 35 #include "content/common/content_export.h" |
| 36 #include "content/common/media/video_capture.h" | 36 #include "content/common/media/video_capture.h" |
| 37 #include "content/renderer/media/video_capture_message_filter.h" | 37 #include "content/renderer/media/video_capture_message_filter.h" |
| 38 #include "media/video/capture/video_capture.h" | 38 #include "media/video/capture/video_capture.h" |
| 39 #include "media/video/capture/video_capture_types.h" | 39 #include "media/video/capture/video_capture_types.h" |
| 40 | 40 |
| 41 namespace base { | 41 namespace base { |
| 42 | |
|
wjia(left Chromium)
2014/02/19 22:05:19
ditto.
sheu
2014/02/19 23:18:35
Done.
| |
| 42 class MessageLoopProxy; | 43 class MessageLoopProxy; |
| 43 } | 44 |
| 45 } // namespace base | |
| 46 | |
| 47 namespace gpu { | |
| 48 | |
| 49 class MailboxHolder; | |
| 50 | |
| 51 } // namespace gpu | |
| 44 | 52 |
| 45 namespace content { | 53 namespace content { |
| 46 | 54 |
| 47 class CONTENT_EXPORT VideoCaptureImpl | 55 class CONTENT_EXPORT VideoCaptureImpl |
| 48 : public media::VideoCapture, public VideoCaptureMessageFilter::Delegate { | 56 : public media::VideoCapture, public VideoCaptureMessageFilter::Delegate { |
| 49 public: | 57 public: |
| 50 VideoCaptureImpl(media::VideoCaptureSessionId session_id, | 58 VideoCaptureImpl(media::VideoCaptureSessionId session_id, |
| 51 VideoCaptureMessageFilter* filter); | 59 VideoCaptureMessageFilter* filter); |
| 52 virtual ~VideoCaptureImpl(); | 60 virtual ~VideoCaptureImpl(); |
| 53 | 61 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 92 void GetDeviceSupportedFormatsOnIOThread( | 100 void GetDeviceSupportedFormatsOnIOThread( |
| 93 const DeviceFormatsCallback& callback); | 101 const DeviceFormatsCallback& callback); |
| 94 void GetDeviceFormatsInUseOnIOThread( | 102 void GetDeviceFormatsInUseOnIOThread( |
| 95 const DeviceFormatsInUseCallback& callback); | 103 const DeviceFormatsInUseCallback& callback); |
| 96 | 104 |
| 97 // VideoCaptureMessageFilter::Delegate interface. | 105 // VideoCaptureMessageFilter::Delegate interface. |
| 98 virtual void OnBufferCreated(base::SharedMemoryHandle handle, | 106 virtual void OnBufferCreated(base::SharedMemoryHandle handle, |
| 99 int length, | 107 int length, |
| 100 int buffer_id) OVERRIDE; | 108 int buffer_id) OVERRIDE; |
| 101 virtual void OnBufferDestroyed(int buffer_id) OVERRIDE; | 109 virtual void OnBufferDestroyed(int buffer_id) OVERRIDE; |
| 102 virtual void OnBufferReceived( | 110 virtual void OnBufferReceived(int buffer_id, |
| 103 int buffer_id, | 111 const media::VideoCaptureFormat& format, |
| 104 base::TimeTicks timestamp, | 112 base::TimeTicks) OVERRIDE; |
| 105 const media::VideoCaptureFormat& format) OVERRIDE; | 113 virtual void OnMailboxBufferReceived(int buffer_id, |
| 114 const gpu::MailboxHolder& mailbox_holder, | |
| 115 const media::VideoCaptureFormat& format, | |
| 116 base::TimeTicks timestamp) OVERRIDE; | |
| 117 OVERRIDE; | |
| 106 virtual void OnStateChanged(VideoCaptureState state) OVERRIDE; | 118 virtual void OnStateChanged(VideoCaptureState state) OVERRIDE; |
| 107 virtual void OnDeviceSupportedFormatsEnumerated( | 119 virtual void OnDeviceSupportedFormatsEnumerated( |
| 108 const media::VideoCaptureFormats& supported_formats) OVERRIDE; | 120 const media::VideoCaptureFormats& supported_formats) OVERRIDE; |
| 109 virtual void OnDeviceFormatsInUseReceived( | 121 virtual void OnDeviceFormatsInUseReceived( |
| 110 const media::VideoCaptureFormats& formats_in_use) OVERRIDE; | 122 const media::VideoCaptureFormats& formats_in_use) OVERRIDE; |
| 111 virtual void OnDelegateAdded(int32 device_id) OVERRIDE; | 123 virtual void OnDelegateAdded(int32 device_id) OVERRIDE; |
| 112 | 124 |
| 113 // Sends an IPC message to browser process when all clients are done with the | 125 // Sends an IPC message to browser process when all clients are done with the |
| 114 // buffer. | 126 // buffer. |
| 115 void OnClientBufferFinished( | 127 void OnClientBufferFinished(int buffer_id, |
| 116 int buffer_id, | 128 const scoped_refptr<ClientBuffer>& buffer, |
| 117 const scoped_refptr<ClientBuffer>& buffer); | 129 scoped_ptr<gpu::MailboxHolder> mailbox_holder); |
| 118 | 130 |
| 119 void StopDevice(); | 131 void StopDevice(); |
| 120 void RestartCapture(); | 132 void RestartCapture(); |
| 121 void StartCaptureInternal(); | 133 void StartCaptureInternal(); |
| 122 | 134 |
| 123 virtual void Send(IPC::Message* message); | 135 virtual void Send(IPC::Message* message); |
| 124 | 136 |
| 125 // Helpers. | 137 // Helpers. |
| 126 bool RemoveClient(media::VideoCapture::EventHandler* handler, | 138 bool RemoveClient(media::VideoCapture::EventHandler* handler, |
| 127 ClientInfo* clients); | 139 ClientInfo* clients); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 // media::VideoFrames constructed in OnBufferReceived() from buffers cached | 175 // media::VideoFrames constructed in OnBufferReceived() from buffers cached |
| 164 // in |client_buffers_|. | 176 // in |client_buffers_|. |
| 165 base::WeakPtrFactory<VideoCaptureImpl> weak_this_factory_; | 177 base::WeakPtrFactory<VideoCaptureImpl> weak_this_factory_; |
| 166 | 178 |
| 167 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImpl); | 179 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImpl); |
| 168 }; | 180 }; |
| 169 | 181 |
| 170 } // namespace content | 182 } // namespace content |
| 171 | 183 |
| 172 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ | 184 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ |
| OLD | NEW |