Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
08d0c727
Commit
08d0c727
authored
6 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
jni: handle real YUV422 video
Change-Id: I39ebed2ee053db5b963c5e550c8452f49492d0e6
parent
2f772e3b
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/jni/videomanager.i
+29
-20
29 additions, 20 deletions
bin/jni/videomanager.i
with
29 additions
and
20 deletions
bin/jni/videomanager.i
+
29
−
20
View file @
08d0c727
...
@@ -161,16 +161,24 @@ JNIEXPORT void JNICALL Java_cx_ring_daemon_RingserviceJNI_captureVideoFrame(JNIE
...
@@ -161,16 +161,24 @@ JNIEXPORT void JNICALL Java_cx_ring_daemon_RingserviceJNI_captureVideoFrame(JNIE
jclass planeClass = jenv->GetObjectClass(yplane);
jclass planeClass = jenv->GetObjectClass(yplane);
jmethodID getBuffer = jenv->GetMethodID(planeClass, "getBuffer", "()Ljava/nio/ByteBuffer;");
jmethodID getBuffer = jenv->GetMethodID(planeClass, "getBuffer", "()Ljava/nio/ByteBuffer;");
jmethodID getRowStride = jenv->GetMethodID(planeClass, "getRowStride", "()I");
jmethodID getRowStride = jenv->GetMethodID(planeClass, "getRowStride", "()I");
jobject ybuffer = jenv->CallObjectMethod(yplane, getBuffer);
jmethodID getPixelStride = jenv->GetMethodID(planeClass, "getPixelStride", "()I");
jobject ubuffer = jenv->CallObjectMethod(uplane, getBuffer);
auto ydata = (uint8_t*)jenv->GetDirectBufferAddress(jenv->CallObjectMethod(yplane, getBuffer));
jobject vbuffer = jenv->CallObjectMethod(vplane, getBuffer);
auto udata = (uint8_t*)jenv->GetDirectBufferAddress(jenv->CallObjectMethod(uplane, getBuffer));
auto ydata = (uint8_t*)jenv->GetDirectBufferAddress(ybuffer);
auto vdata = (uint8_t*)jenv->GetDirectBufferAddress(jenv->CallObjectMethod(vplane, getBuffer));
auto udata = (uint8_t*)jenv->GetDirectBufferAddress(ubuffer);
auto vdata = (uint8_t*)jenv->GetDirectBufferAddress(vbuffer);
auto uvdata = std::min(udata, vdata);
auto ystride = jenv->CallIntMethod(yplane, getRowStride);
auto ystride = jenv->CallIntMethod(yplane, getRowStride);
auto uvstride = jenv->CallIntMethod(uplane, getRowStride);
auto uvstride = jenv->CallIntMethod(uplane, getRowStride);
auto uvpixstride = jenv->CallIntMethod(uplane, getPixelStride);
if (uvpixstride == 1) {
avframe->data[0] = ydata;
avframe->linesize[0] = ystride;
avframe->data[1] = udata;
avframe->linesize[1] = uvstride;
avframe->data[2] = vdata;
avframe->linesize[2] = uvstride;
} else if (uvpixstride == 2) {
// False YUV422, actually NV12 or NV21
auto uvdata = std::min(udata, vdata);
avframe->format = uvdata == udata ? AV_PIX_FMT_NV12 : AV_PIX_FMT_NV21;
avframe->format = uvdata == udata ? AV_PIX_FMT_NV12 : AV_PIX_FMT_NV21;
if (rotation == 0) {
if (rotation == 0) {
avframe->data[0] = ydata;
avframe->data[0] = ydata;
...
@@ -188,6 +196,7 @@ JNIEXPORT void JNICALL Java_cx_ring_daemon_RingserviceJNI_captureVideoFrame(JNIE
...
@@ -188,6 +196,7 @@ JNIEXPORT void JNICALL Java_cx_ring_daemon_RingserviceJNI_captureVideoFrame(JNIE
rotateNV21(ydata, uvdata, ystride, uvstride, ow, oh, rotation, avframe->data[0], avframe->data[1]);
rotateNV21(ydata, uvdata, ystride, uvstride, ow, oh, rotation, avframe->data[0], avframe->data[1]);
jenv->CallVoidMethod(image, jenv->GetMethodID(imageClass, "close", "()V"));
jenv->CallVoidMethod(image, jenv->GetMethodID(imageClass, "close", "()V"));
}
}
}
} else {
} else {
for (int i=0; i<planeCount; i++) {
for (int i=0; i<planeCount; i++) {
jobject plane = jenv->GetObjectArrayElement(planes, i);
jobject plane = jenv->GetObjectArrayElement(planes, i);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment