Chromium Code Reviews| 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 "base/message_loop/message_loop_proxy.h" | 11 #include "base/message_loop/message_loop_proxy.h" |
| 12 #include "base/threading/thread_checker.h" | 12 #include "base/threading/thread_checker.h" |
| 13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 14 #include "media/base/video_frame.h" | 14 #include "media/base/video_frame.h" |
| 15 #include "media/video/capture/video_capture_types.h" | 15 #include "media/video/capture/video_capture_types.h" |
| 16 #include "third_party/libjingle/source/talk/media/base/videocapturer.h" | 16 #include "third_party/libjingle/source/talk/media/base/videocapturer.h" |
| 17 | 17 |
| 18 namespace content { | 18 namespace content { |
| 19 namespace { | |
|
perkj_chrome
2014/10/16 13:47:31
not compatible with the style guide.
https://engd
magjed_chromium
2014/10/16 14:39:59
Done.
| |
| 20 class MediaVideoFrameFactory; | |
| 21 } | |
| 19 | 22 |
| 20 // WebRtcVideoCapturerAdapter implements a simple cricket::VideoCapturer that is | 23 // WebRtcVideoCapturerAdapter implements a simple cricket::VideoCapturer that is |
| 21 // used for VideoCapturing in libJingle and especially in PeerConnections. | 24 // used for VideoCapturing in libJingle and especially in PeerConnections. |
| 22 // The class is created and destroyed on the main render thread. | 25 // The class is created and destroyed on the main render thread. |
| 23 // PeerConnection access cricket::VideoCapturer from a libJingle worker thread. | 26 // PeerConnection access cricket::VideoCapturer from a libJingle worker thread. |
| 24 // An instance of WebRtcVideoCapturerAdapter is owned by an instance of | 27 // An instance of WebRtcVideoCapturerAdapter is owned by an instance of |
| 25 // webrtc::VideoSourceInterface in libJingle. The implementation of | 28 // webrtc::VideoSourceInterface in libJingle. The implementation of |
| 26 // webrtc::VideoSourceInterface guarantees that this object is not deleted | 29 // webrtc::VideoSourceInterface guarantees that this object is not deleted |
| 27 // while it is still used in libJingle. | 30 // while it is still used in libJingle. |
| 28 class CONTENT_EXPORT WebRtcVideoCapturerAdapter | 31 class CONTENT_EXPORT WebRtcVideoCapturerAdapter |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 41 // These methods are accessed from a libJingle worker thread. | 44 // These methods are accessed from a libJingle worker thread. |
| 42 virtual cricket::CaptureState Start( | 45 virtual cricket::CaptureState Start( |
| 43 const cricket::VideoFormat& capture_format) override; | 46 const cricket::VideoFormat& capture_format) override; |
| 44 virtual void Stop() override; | 47 virtual void Stop() override; |
| 45 virtual bool IsRunning() override; | 48 virtual bool IsRunning() override; |
| 46 virtual bool GetPreferredFourccs(std::vector<uint32>* fourccs) override; | 49 virtual bool GetPreferredFourccs(std::vector<uint32>* fourccs) override; |
| 47 virtual bool GetBestCaptureFormat(const cricket::VideoFormat& desired, | 50 virtual bool GetBestCaptureFormat(const cricket::VideoFormat& desired, |
| 48 cricket::VideoFormat* best_format) override; | 51 cricket::VideoFormat* best_format) override; |
| 49 virtual bool IsScreencast() const override; | 52 virtual bool IsScreencast() const override; |
| 50 | 53 |
| 51 void UpdateI420Buffer(const scoped_refptr<media::VideoFrame>& src); | |
| 52 | |
| 53 // |thread_checker_| is bound to the libjingle worker thread. | 54 // |thread_checker_| is bound to the libjingle worker thread. |
| 54 base::ThreadChecker thread_checker_; | 55 base::ThreadChecker thread_checker_; |
| 55 | 56 |
| 56 const bool is_screencast_; | 57 const bool is_screencast_; |
| 57 bool running_; | 58 bool running_; |
| 58 base::TimeDelta first_frame_timestamp_; | 59 base::TimeDelta first_frame_timestamp_; |
| 59 // |buffer_| used if cropping is needed. It is created only if needed and | 60 |
| 60 // owned by WebRtcVideoCapturerAdapter. If its created, it exists until | 61 // This is an alias to the frame_factory_ in the base class |
| 61 // WebRtcVideoCapturerAdapter is destroyed. | 62 // cricket::VideoCapturer. |
| 62 uint8* buffer_; | 63 MediaVideoFrameFactory* frame_factory_; |
| 63 size_t buffer_size_; | |
| 64 | 64 |
| 65 DISALLOW_COPY_AND_ASSIGN(WebRtcVideoCapturerAdapter); | 65 DISALLOW_COPY_AND_ASSIGN(WebRtcVideoCapturerAdapter); |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 } // namespace content | 68 } // namespace content |
| 69 | 69 |
| 70 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_VIDEO_CAPTURER_ADAPTER_H_ | 70 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_VIDEO_CAPTURER_ADAPTER_H_ |
| OLD | NEW |