为修复宁夏短视频拍照翻转的bug 临时修改方法

lowmem
liuguijing 2 months ago
parent 7e57c3cc08
commit 2d0fe6609b

@ -2497,7 +2497,16 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector<
}
}
int orientation = mPhotoInfo.orientation == 0 ? -1 : (mPhotoInfo.orientation - 1) * 90;
//为修复宁夏短视频拍照翻转的bug 临时修改方法
// int orientation = mPhotoInfo.orientation == 0 ? -1 : (mPhotoInfo.orientation - 1) * 90;
int orientation = -1;
if (mPhotoInfo.cameraId == 0) {
orientation = -1;
} else if (mPhotoInfo.cameraId == 1) {
orientation = 0;
} else if (mPhotoInfo.cameraId == 2) {
orientation =-3;
}
jboolean photoOrVideo = mPhotoInfo.mediaType == 0 ? JNI_TRUE : JNI_FALSE;
env->CallVoidMethod(m_javaService, mStartRecordingMid, photoOrVideo, mPhotoInfo.cameraId, (uint64_t)mPhotoInfo.photoId,
mPhotoInfo.duration, mPhotoInfo.width, mPhotoInfo.height, mPhotoInfo.duration, orientation,

@ -769,7 +769,10 @@ public class Camera2VideoActivity extends AppCompatActivity {
@Override
public void run() {
Log.i("OSD", "Record Stop " + Long.toString(mDuration));
mGPUCameraRecorder.stop();
if (mGPUCameraRecorder != null) {
mGPUCameraRecorder.stop();
}
int aa = 0;
}

@ -30,7 +30,7 @@ public class GPUCameraRecorderBuilder {
private int cameraHeight = 720;
private GlFilter glFilter;
private long duration;
private int rotation;
public GPUCameraRecorderBuilder(Activity activity, GLSurfaceView glSurfaceView) {
this.activity = activity;
this.glSurfaceView = glSurfaceView;
@ -84,6 +84,10 @@ public class GPUCameraRecorderBuilder {
return this;
}
public GPUCameraRecorderBuilder rotation(int d) {
this.rotation = d;
return this;
}
public GPUCameraRecorderBuilder recordNoFilter(boolean recordNoFilter) {
this.recordNoFilter = recordNoFilter;
return this;
@ -98,11 +102,17 @@ public class GPUCameraRecorderBuilder {
boolean isLandscapeDevice = resources.getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
int degrees = 0;
// if (isLandscapeDevice) {
// int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();
// Log.d("GPUCameraRecorder", "Surface.ROTATION_90 = " + Surface.ROTATION_90 + " rotation = " + rotation);
// degrees = 90 * (rotation - 2);
// }
if (isLandscapeDevice) {
int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();
Log.d("GPUCameraRecorder", "Surface.ROTATION_90 = " + Surface.ROTATION_90 + " rotation = " + rotation);
degrees = 90 * (rotation - 2);
Log.d("GPUCameraRecorder", "测试测试rotation" + rotation);
degrees = rotation * 90;
}
Log.d("GPUCameraRecorder", "测试测试" + degrees);
GPUCameraRecorder GPUCameraRecorder = new GPUCameraRecorder(
cameraRecordListener,

Loading…
Cancel
Save