| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 // PeerConnection. | 41 // PeerConnection. |
| 42 class AndroidVideoCapturer : public cricket::VideoCapturer { | 42 class AndroidVideoCapturer : public cricket::VideoCapturer { |
| 43 public: | 43 public: |
| 44 explicit AndroidVideoCapturer( | 44 explicit AndroidVideoCapturer( |
| 45 const rtc::scoped_refptr<AndroidVideoCapturerDelegate>& delegate); | 45 const rtc::scoped_refptr<AndroidVideoCapturerDelegate>& delegate); |
| 46 virtual ~AndroidVideoCapturer(); | 46 virtual ~AndroidVideoCapturer(); |
| 47 | 47 |
| 48 // Called from JNI when the capturer has been started. | 48 // Called from JNI when the capturer has been started. |
| 49 void OnCapturerStarted(bool success); | 49 void OnCapturerStarted(bool success); |
| 50 | 50 |
| 51 // Called from JNI when a new frame has been captured. | |
| 52 // Argument |buffer| is intentionally by value, for use with rtc::Bind. | |
| 53 void OnIncomingFrame( | |
| 54 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer, | |
| 55 int rotation, | |
| 56 int64_t time_stamp); | |
| 57 | |
| 58 // Called from JNI to request a new video format. | 51 // Called from JNI to request a new video format. |
| 59 void OnOutputFormatRequest(int width, int height, int fps); | 52 void OnOutputFormatRequest(int width, int height, int fps); |
| 60 | 53 |
| 61 AndroidVideoCapturerDelegate* delegate() { return delegate_.get(); } | 54 AndroidVideoCapturerDelegate* delegate() { return delegate_.get(); } |
| 62 | 55 |
| 63 // cricket::VideoCapturer implementation. | 56 // cricket::VideoCapturer implementation. |
| 64 bool GetBestCaptureFormat(const cricket::VideoFormat& desired, | 57 bool GetBestCaptureFormat(const cricket::VideoFormat& desired, |
| 65 cricket::VideoFormat* best_format) override; | 58 cricket::VideoFormat* best_format) override; |
| 66 | 59 |
| 60 // Expose these protected methods as public, to be used by the |
| 61 // AndroidVideoCapturerJni. |
| 62 using VideoCapturer::AdaptFrame; |
| 63 using VideoCapturer::OnFrame; |
| 64 |
| 67 private: | 65 private: |
| 68 // cricket::VideoCapturer implementation. | 66 // cricket::VideoCapturer implementation. |
| 69 // Video frames will be delivered using | 67 // Video frames will be delivered using |
| 70 // cricket::VideoCapturer::SignalFrameCaptured on the thread that calls Start. | 68 // cricket::VideoCapturer::SignalFrameCaptured on the thread that calls Start. |
| 71 cricket::CaptureState Start( | 69 cricket::CaptureState Start( |
| 72 const cricket::VideoFormat& capture_format) override; | 70 const cricket::VideoFormat& capture_format) override; |
| 73 void Stop() override; | 71 void Stop() override; |
| 74 bool IsRunning() override; | 72 bool IsRunning() override; |
| 75 bool IsScreencast() const override { return false; } | 73 bool IsScreencast() const override { return false; } |
| 76 bool GetPreferredFourccs(std::vector<uint32_t>* fourccs) override; | 74 bool GetPreferredFourccs(std::vector<uint32_t>* fourccs) override; |
| 77 | 75 |
| 78 bool running_; | 76 bool running_; |
| 79 rtc::scoped_refptr<AndroidVideoCapturerDelegate> delegate_; | 77 rtc::scoped_refptr<AndroidVideoCapturerDelegate> delegate_; |
| 80 | 78 |
| 81 rtc::ThreadChecker thread_checker_; | 79 rtc::ThreadChecker thread_checker_; |
| 82 | 80 |
| 83 class FrameFactory; | |
| 84 FrameFactory* frame_factory_; // Owned by cricket::VideoCapturer. | |
| 85 | |
| 86 cricket::CaptureState current_state_; | 81 cricket::CaptureState current_state_; |
| 87 }; | 82 }; |
| 88 | 83 |
| 89 } // namespace webrtc | 84 } // namespace webrtc |
| 90 | 85 |
| 91 #endif // WEBRTC_API_ANDROIDVIDEOCAPTURER_H_ | 86 #endif // WEBRTC_API_ANDROIDVIDEOCAPTURER_H_ |
| OLD | NEW |