OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 void ReturnBuffer(int64 time_stamp) override; | 59 void ReturnBuffer(int64 time_stamp) override; |
60 | 60 |
61 std::string GetSupportedFormats() override; | 61 std::string GetSupportedFormats() override; |
62 | 62 |
63 // Called from VideoCapturerAndroid::NativeObserver on a Java thread. | 63 // Called from VideoCapturerAndroid::NativeObserver on a Java thread. |
64 void OnCapturerStarted(bool success); | 64 void OnCapturerStarted(bool success); |
65 void OnIncomingFrame(void* video_frame, | 65 void OnIncomingFrame(void* video_frame, |
66 int length, | 66 int length, |
67 int rotation, | 67 int rotation, |
68 int64 time_stamp); | 68 int64 time_stamp); |
| 69 void OnOutputFormatRequest(int width, int height, int fps); |
69 protected: | 70 protected: |
70 AndroidVideoCapturerJni(JNIEnv* jni, jobject j_video_capturer); | 71 AndroidVideoCapturerJni(JNIEnv* jni, jobject j_video_capturer); |
71 ~AndroidVideoCapturerJni(); | 72 ~AndroidVideoCapturerJni(); |
72 | 73 |
73 private: | 74 private: |
74 bool Init(jstring device_name); | 75 bool Init(jstring device_name); |
75 | 76 |
76 void OnCapturerStarted_w(bool success); | 77 void OnCapturerStarted_w(bool success); |
77 void OnCapturerStopped_w(); | 78 void OnCapturerStopped_w(); |
78 void OnIncomingFrame_w(void* video_frame, | 79 void OnIncomingFrame_w(void* video_frame, |
79 int length, | 80 int length, |
80 int rotation, | 81 int rotation, |
81 int64 time_stamp); | 82 int64 time_stamp); |
| 83 void OnOutputFormatRequest_w(int width, int height, int fps); |
82 void ReturnBuffer_w(int64 time_stamp); | 84 void ReturnBuffer_w(int64 time_stamp); |
83 | 85 |
84 JNIEnv* jni(); | 86 JNIEnv* jni(); |
85 | 87 |
86 const ScopedGlobalRef<jobject> j_capturer_global_; | 88 const ScopedGlobalRef<jobject> j_capturer_global_; |
87 const ScopedGlobalRef<jclass> j_video_capturer_class_; | 89 const ScopedGlobalRef<jclass> j_video_capturer_class_; |
88 const ScopedGlobalRef<jclass> j_observer_class_; | 90 const ScopedGlobalRef<jclass> j_observer_class_; |
89 volatile bool valid_global_refs_; | 91 volatile bool valid_global_refs_; |
90 jobject j_frame_observer_; | 92 jobject j_frame_observer_; |
91 | 93 |
92 rtc::ThreadChecker thread_checker_; | 94 rtc::ThreadChecker thread_checker_; |
93 | 95 |
94 rtc::Thread* thread_; // The thread where Start is called on. | 96 rtc::Thread* thread_; // The thread where Start is called on. |
95 // |capturer| is a guaranteed to be a valid pointer between a call to | 97 // |capturer| is a guaranteed to be a valid pointer between a call to |
96 // AndroidVideoCapturerDelegate::Start | 98 // AndroidVideoCapturerDelegate::Start |
97 // until AndroidVideoCapturerDelegate::Stop. | 99 // until AndroidVideoCapturerDelegate::Stop. |
98 webrtc::AndroidVideoCapturer* capturer_; | 100 webrtc::AndroidVideoCapturer* capturer_; |
99 rtc::AsyncInvoker invoker_; | 101 rtc::AsyncInvoker invoker_; |
100 | 102 |
101 static jobject application_context_; | 103 static jobject application_context_; |
102 | 104 |
103 DISALLOW_COPY_AND_ASSIGN(AndroidVideoCapturerJni); | 105 DISALLOW_COPY_AND_ASSIGN(AndroidVideoCapturerJni); |
104 }; | 106 }; |
105 | 107 |
106 } // namespace webrtc_jni | 108 } // namespace webrtc_jni |
107 | 109 |
108 #endif // TALK_APP_WEBRTC_JAVA_JNI_ANDROIDVIDEOCAPTURER_JNI_H_ | 110 #endif // TALK_APP_WEBRTC_JAVA_JNI_ANDROIDVIDEOCAPTURER_JNI_H_ |
OLD | NEW |