passing |buffer| by reference in AndroidVideoCapturer::OnIncomingFrame
BUG=webrtc:5062 Review URL: https://codereview.webrtc.org/1414703002 Cr-Commit-Position: refs/heads/master@{#10342}
This commit is contained in:
@ -211,7 +211,7 @@ void AndroidVideoCapturer::OnCapturerStarted(bool success) {
|
||||
}
|
||||
|
||||
void AndroidVideoCapturer::OnIncomingFrame(
|
||||
rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer,
|
||||
const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer,
|
||||
int rotation,
|
||||
int64_t time_stamp) {
|
||||
RTC_CHECK(thread_checker_.CalledOnValidThread());
|
||||
|
@ -67,9 +67,10 @@ class AndroidVideoCapturer : public cricket::VideoCapturer {
|
||||
|
||||
// Called from JNI when a new frame has been captured.
|
||||
// Argument |buffer| is intentionally by value, for use with rtc::Bind.
|
||||
void OnIncomingFrame(rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer,
|
||||
int rotation,
|
||||
int64_t time_stamp);
|
||||
void OnIncomingFrame(
|
||||
const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer,
|
||||
int rotation,
|
||||
int64_t time_stamp);
|
||||
|
||||
// Called from JNI to request a new video format.
|
||||
void OnOutputFormatRequest(int width, int height, int fps);
|
||||
|
@ -118,7 +118,7 @@ template <typename... Args>
|
||||
void AndroidVideoCapturerJni::AsyncCapturerInvoke(
|
||||
const char* method_name,
|
||||
void (webrtc::AndroidVideoCapturer::*method)(Args...),
|
||||
Args... args) {
|
||||
typename Identity<Args>::type... args) {
|
||||
rtc::CritScope cs(&capturer_lock_);
|
||||
if (!invoker_) {
|
||||
LOG(LS_WARNING) << method_name << "() called for closed capturer.";
|
||||
|
@ -71,13 +71,19 @@ class AndroidVideoCapturerJni : public webrtc::AndroidVideoCapturerDelegate {
|
||||
void ReturnBuffer(int64_t time_stamp);
|
||||
JNIEnv* jni();
|
||||
|
||||
// To avoid deducing Args from the 3rd parameter of AsyncCapturerInvoke.
|
||||
template <typename T>
|
||||
struct Identity {
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
// Helper function to make safe asynchronous calls to |capturer_|. The calls
|
||||
// are not guaranteed to be delivered.
|
||||
template <typename... Args>
|
||||
void AsyncCapturerInvoke(
|
||||
const char* method_name,
|
||||
void (webrtc::AndroidVideoCapturer::*method)(Args...),
|
||||
Args... args);
|
||||
typename Identity<Args>::type... args);
|
||||
|
||||
const ScopedGlobalRef<jobject> j_capturer_global_;
|
||||
const ScopedGlobalRef<jclass> j_video_capturer_class_;
|
||||
|
Reference in New Issue
Block a user