OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_VIDEO_CAPTURER_ADAPTER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_VIDEO_CAPTURER_ADAPTER_H_ |
6 #define CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_VIDEO_CAPTURER_ADAPTER_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_VIDEO_CAPTURER_ADAPTER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
12 #include "media/base/video_frame.h" | 12 #include "media/base/video_frame.h" |
13 #include "media/video/capture/video_capture_types.h" | 13 #include "media/video/capture/video_capture_types.h" |
14 #include "third_party/libjingle/source/talk/media/base/videocapturer.h" | 14 #include "third_party/libjingle/source/talk/media/base/videocapturer.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
18 // WebRtcVideoCapturerAdapter implements a simple cricket::VideoCapturer that is | 18 // WebRtcVideoCapturerAdapter implements a simple cricket::VideoCapturer that is |
19 // used for VideoCapturing in libJingle and especially in PeerConnections. | 19 // used for VideoCapturing in libJingle and especially in PeerConnections. |
20 // The class is created and destroyed on the main render thread. | 20 // The class is created and destroyed on the main render thread. |
21 // PeerConnection access cricket::VideoCapturer from a libJingle worker thread. | 21 // PeerConnection access cricket::VideoCapturer from a libJingle worker thread. |
22 class CONTENT_EXPORT WebRtcVideoCapturerAdapter | 22 class CONTENT_EXPORT WebRtcVideoCapturerAdapter |
23 : NON_EXPORTED_BASE(public cricket::VideoCapturer) { | 23 : NON_EXPORTED_BASE(public cricket::VideoCapturer) { |
24 public: | 24 public: |
25 explicit WebRtcVideoCapturerAdapter(bool is_screencast); | 25 explicit WebRtcVideoCapturerAdapter(bool is_screencast); |
26 virtual ~WebRtcVideoCapturerAdapter(); | 26 virtual ~WebRtcVideoCapturerAdapter(); |
27 | 27 |
28 // Sets the requested format. cricket::VideoCapturer may try to scale or | |
29 // crop to this format if the frame delivered in OnFrameCaptured is not in | |
30 // this format. | |
31 // This method is virtual for testing purposes. | |
32 virtual void SetRequestedFormat(const media::VideoCaptureFormat& format); | |
33 | |
34 // This method is virtual for testing purposes. | 28 // This method is virtual for testing purposes. |
35 virtual void OnFrameCaptured(const scoped_refptr<media::VideoFrame>& frame); | 29 virtual void OnFrameCaptured(const scoped_refptr<media::VideoFrame>& frame); |
36 | 30 |
37 private: | 31 private: |
38 // cricket::VideoCapturer implementation. | 32 // cricket::VideoCapturer implementation. |
39 // These methods are accessed from a libJingle worker thread. | 33 // These methods are accessed from a libJingle worker thread. |
40 virtual cricket::CaptureState Start( | 34 virtual cricket::CaptureState Start( |
41 const cricket::VideoFormat& capture_format) OVERRIDE; | 35 const cricket::VideoFormat& capture_format) OVERRIDE; |
42 virtual void Stop() OVERRIDE; | 36 virtual void Stop() OVERRIDE; |
43 virtual bool IsRunning() OVERRIDE; | 37 virtual bool IsRunning() OVERRIDE; |
(...skipping 14 matching lines...) Expand all Loading... |
58 uint8* buffer_; | 52 uint8* buffer_; |
59 size_t buffer_size_; | 53 size_t buffer_size_; |
60 scoped_ptr<cricket::CapturedFrame> captured_frame_; | 54 scoped_ptr<cricket::CapturedFrame> captured_frame_; |
61 | 55 |
62 DISALLOW_COPY_AND_ASSIGN(WebRtcVideoCapturerAdapter); | 56 DISALLOW_COPY_AND_ASSIGN(WebRtcVideoCapturerAdapter); |
63 }; | 57 }; |
64 | 58 |
65 } // namespace content | 59 } // namespace content |
66 | 60 |
67 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_VIDEO_CAPTURER_ADAPTER_H_ | 61 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_VIDEO_CAPTURER_ADAPTER_H_ |
OLD | NEW |