Add release callback and reference count to java EncodedImage class
Callback set by HardwareVideoEncoder, and wired to the codec's releaseOutputBuffer. Intention is to move call of this method to the destructor of a corresponding C++ class in a followup cl, and eliminate an allocation and memcpy in the process. Bug: webrtc:9378 Change-Id: I578480b63b68e6ac7a96cdde36379b3c50f05c3f Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/142160 Commit-Queue: Niels Moller <nisse@webrtc.org> Reviewed-by: Sami Kalliomäki <sakal@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29283}
This commit is contained in:
@ -34,8 +34,12 @@ ScopedJavaLocalRef<jobject> NativeToJavaEncodedImage(
|
||||
ScopedJavaLocalRef<jobject> qp;
|
||||
if (image.qp_ != -1)
|
||||
qp = NativeToJavaInteger(jni, image.qp_);
|
||||
// TODO(bugs.webrtc.org/9378): Keep a reference to the C++ EncodedImage data,
|
||||
// and use the releaseCallback to manage lifetime.
|
||||
return Java_EncodedImage_Constructor(
|
||||
jni, buffer, static_cast<int>(image._encodedWidth),
|
||||
jni, buffer, /*supportsRetain=*/true,
|
||||
/*releaseCallback=*/ScopedJavaGlobalRef<jobject>(nullptr),
|
||||
static_cast<int>(image._encodedWidth),
|
||||
static_cast<int>(image._encodedHeight),
|
||||
image.capture_time_ms_ * rtc::kNumNanosecsPerMillisec, frame_type,
|
||||
static_cast<jint>(image.rotation_), image._completeFrame, qp);
|
||||
|
||||
Reference in New Issue
Block a user