From 8a7eba01caf0658aeeba27a8d992f6d1aa3dacb9 Mon Sep 17 00:00:00 2001 From: dongxinli Date: Fri, 2 Jun 2023 18:40:31 +0800 Subject: [PATCH] =?UTF-8?q?camera=E4=B8=8A=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dongxinli --- .../src/main/ets/test/CameraEnumTest.test.ets | 17 ++++++++++++++--- .../test/CameraErrorCodeUsecaseTest.test.ets | 10 +++++++--- .../main/ets/test/CameraJSUnitOutput.test.ets | 13 +++++++++---- .../main/ets/test/CameraManagerTest.test.ets | 4 ++-- .../ets/test/CameraSessionBaseTest.test.ets | 4 ++-- .../ets/test/CameraSessionExposureTest.test.ets | 6 +++--- .../ets/test/CameraSessionFlashTest.test.ets | 4 ++-- .../ets/test/CameraSessionFocusTest.test.ets | 4 ++-- ...CameraSessionVideoStabilizationTest.test.ets | 4 ++-- .../test/CameraSessionZoomRatioTest.test.ets | 4 ++-- 10 files changed, 45 insertions(+), 25 deletions(-) diff --git a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraEnumTest.test.ets b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraEnumTest.test.ets index 5e362356f..67cf45620 100644 --- a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraEnumTest.test.ets +++ b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraEnumTest.test.ets @@ -96,7 +96,7 @@ export default function cameraEnumTest() { */ it('SUB_MULTIMEDIA_CAMERA_ENUM_CAMERATYPE_0100', 2, async function (done) { console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_CAMERATYPE_0100--------------"); - console.info("CameraType: "+ JSON.stringify(camera.CameraType)); + console.info("CameraType: " + JSON.stringify(camera.CameraType)); expect(camera.CameraType.CAMERA_TYPE_DEFAULT == 0).assertTrue(); expect(camera.CameraType.CAMERA_TYPE_WIDE_ANGLE == 1).assertTrue(); expect(camera.CameraType.CAMERA_TYPE_ULTRA_WIDE == 2).assertTrue(); @@ -301,16 +301,27 @@ export default function cameraEnumTest() { * @tc.level : Level 2 */ it('SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAERRORCODE_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAERRORCODE_0100--------------"); + console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAERRORCODE_0100--------------"); expect(camera.CameraErrorCode.INVALID_ARGUMENT == 7400101).assertTrue(); + console.info(TAG + "--------------INVALID_ARGUMENT--------------"); expect(camera.CameraErrorCode.OPERATION_NOT_ALLOWED == 7400102).assertTrue(); + console.info(TAG + "--------------OPERATION_NOT_ALLOWED--------------"); expect(camera.CameraErrorCode.SESSION_NOT_CONFIG == 7400103).assertTrue(); + console.info(TAG + "--------------SESSION_NOT_CONFIG--------------"); expect(camera.CameraErrorCode.SESSION_NOT_RUNNING == 7400104).assertTrue(); + console.info(TAG + "--------------SESSION_NOT_RUNNING--------------"); expect(camera.CameraErrorCode.SESSION_CONFIG_LOCKED == 7400105).assertTrue(); + console.info(TAG + "--------------SESSION_CONFIG_LOCKED--------------"); expect(camera.CameraErrorCode.DEVICE_SETTING_LOCKED == 7400106).assertTrue(); - expect(camera.CameraErrorCode.CONFLICT_CAMERA == 7400107).assertTrue(); + console.info(TAG + "--------------DEVICE_SETTING_LOCKED--------------"); + // expect(camera.CameraErrorCode.CONFLICT_CAMERA == 7400107).assertTrue(); + // console.info(TAG + "--------------CONFLICT_CAMERA--------------"); expect(camera.CameraErrorCode.DEVICE_DISABLED == 7400108).assertTrue(); + console.info(TAG + "--------------DEVICE_DISABLED--------------"); + expect(camera.CameraErrorCode.DEVICE_PREEMPTED == 7400109).assertTrue(); + console.info(TAG + "--------------DEVICE_PREEMPTED --------------"); expect(camera.CameraErrorCode.SERVICE_FATAL_ERROR == 7400201).assertTrue(); + console.info(TAG + "--------------SERVICE_FATAL_ERROR--------------"); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAERRORCODE_0100 ends here"); done(); }) diff --git a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraErrorCodeUsecaseTest.test.ets b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraErrorCodeUsecaseTest.test.ets index 6af2acc5f..d95cde098 100644 --- a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraErrorCodeUsecaseTest.test.ets +++ b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraErrorCodeUsecaseTest.test.ets @@ -26,7 +26,7 @@ let videoProfile = { audioCodec: 'audio/mp4a-latm', audioSampleRate: 48000, fileFormat: 'mp4', - videoBitrate: 48000, + videoBitrate: 2000000, videoCodec: 'video/mp4v-es', videoFrameWidth: 640, videoFrameHeight: 480, @@ -230,7 +230,7 @@ export default function CameraErrorCodeUsecaseTest() { async function getvideosurface() { await getFd('ErrorCodeCameraOutput.mp4'); videoConfig.url = fdPath; - media.createVideoRecorder((err, recorder) => { + media.createAVRecorder((err, recorder) => { if (!err) { console.info(TAG + 'createVideoRecorder called') videoRecorder = recorder @@ -334,7 +334,7 @@ export default function CameraErrorCodeUsecaseTest() { await releaseInput(); } if (!isEmpty(mCameraSession)) { - releaseCameraSessionInstance(); + await releaseCameraSessionInstance(); } }) @@ -1712,6 +1712,10 @@ export default function CameraErrorCodeUsecaseTest() { */ it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETFOCUSPOINT_0100', 0, async function (done) { console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETFOCUSPOINT_0100--------------"); + if(mCameraSession){ + mCameraSession.release(); + mCameraSession = null; + } await createInput(0); createCameraSessionInstance(); mCameraSession.addInput(mCameraInput); diff --git a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraJSUnitOutput.test.ets b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraJSUnitOutput.test.ets index 0007ce520..4e561e104 100644 --- a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraJSUnitOutput.test.ets +++ b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraJSUnitOutput.test.ets @@ -40,7 +40,7 @@ let videoProfile = { audioCodec: 'audio/mp4a-latm', audioSampleRate: 48000, fileFormat: 'mp4', - videoBitrate: 48000, + videoBitrate: 2000000, videoCodec: 'video/mp4v-es', videoFrameWidth: 640, videoFrameHeight: 480, @@ -96,10 +96,12 @@ export default function cameraJSUnitOutput() { async function getFd(pathName) { let displayName = pathName; const mediaTest = mediaLibrary.getMediaLibrary(); + console.log(TAG + 'mediaTest: ' + JSON.stringify(mediaTest)) let fileKeyObj = mediaLibrary.FileKey; let mediaType = mediaLibrary.MediaType.VIDEO; let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO); let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath); + console.log(TAG + 'dataUri id: ' + JSON.stringify(dataUri)) if (dataUri != undefined) { let args = dataUri.id.toString(); let fetchOp = { @@ -109,6 +111,7 @@ export default function cameraJSUnitOutput() { let fetchFileResult = await mediaTest.getFileAssets(fetchOp); fileAsset = await fetchFileResult.getAllObject(); fdNumber = await fileAsset[0].open('Rw'); + console.log(TAG + 'fdNumber id: ' + JSON.stringify(fdNumber)) fdPath = "fd://" + fdNumber.toString(); } } @@ -127,8 +130,9 @@ export default function cameraJSUnitOutput() { async function getvideosurface() { await getFd('CameraOutput.mp4'); - videoConfig.url = fdPath; - media.createVideoRecorder((err, recorder) => { + await sleep(2000); + videoConfig.url = fdPath; + media.createAVRecorder((err, recorder) => { if (!err) { console.info(TAG + 'createVideoRecorder called') videoRecorder = recorder @@ -152,7 +156,7 @@ export default function cameraJSUnitOutput() { }) } else { - console.info(TAG + 'createVideoRecorder FAILED') + console.info(TAG + 'createVideoRecorder FAILED ,Code' + err.code) } }) } @@ -195,6 +199,7 @@ export default function cameraJSUnitOutput() { beforeAll(async function () { await getImageReceiverSurfaceId(); await getvideosurface(); + sleep(2000); console.info('beforeAll case'); }) diff --git a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraManagerTest.test.ets b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraManagerTest.test.ets index e2e7cc76e..7f91638c1 100644 --- a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraManagerTest.test.ets +++ b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraManagerTest.test.ets @@ -42,7 +42,7 @@ let mVideoProfileCfg = { audioSampleRate: 48000, durationTime: 1000, fileFormat: 'mp4', - videoBitrate: 48000, + videoBitrate: 2000000, videoCodec: 'video/mp4v-es', videoFrameWidth: 640, videoFrameHeight: 480, @@ -111,7 +111,7 @@ export default function cameraManagerTest() { console.log(TAG + 'Entering getVideoReceiveSurface') await getFd('CameraManager.mp4'); mVideoConfig.url = mFdPath; - media.createVideoRecorder((err, recorder) => { + media.createAVRecorder((err, recorder) => { if (!err) { console.info(TAG + 'Entering create video receiver') mVideoRecorder = recorder diff --git a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionBaseTest.test.ets b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionBaseTest.test.ets index 090658442..74d3373a7 100644 --- a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionBaseTest.test.ets +++ b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionBaseTest.test.ets @@ -51,7 +51,7 @@ let mVideoProfileCfg = { audioSampleRate: 48000, durationTime: 1000, fileFormat: 'mp4', - videoBitrate: 48000, + videoBitrate: 2000000, videoCodec: 'video/mp4v-es', videoFrameWidth: 640, videoFrameHeight: 480, @@ -133,7 +133,7 @@ export default function cameraSessionTest() { console.log(TAG + 'Entering getVideoReceiveSurface') await getFd('CameraSessionBase.mp4'); mVideoConfig.url = mFdPath; - media.createVideoRecorder((err, recorder) => { + media.createAVRecorder((err, recorder) => { if (!err) { console.info(TAG + 'Entering create video receiver') mVideoRecorder = recorder diff --git a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionExposureTest.test.ets b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionExposureTest.test.ets index 026441d6a..9ec032c8a 100644 --- a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionExposureTest.test.ets +++ b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionExposureTest.test.ets @@ -56,7 +56,7 @@ let mVideoProfileCfg = { audioSampleRate: 48000, durationTime: 1000, fileFormat: 'mp4', - videoBitrate: 48000, + videoBitrate: 2000000, videoCodec: 'video/mp4v-es', videoFrameWidth: 640, videoFrameHeight: 480, @@ -188,7 +188,7 @@ export default function cameraSessionExposureTest() { console.log(TAG + 'Entering getVideoReceiveSurface') await getFd('CameraSessionExposure.mp4'); mVideoConfig.url = mFdPath; - media.createVideoRecorder((err, recorder) => { + media.createAVRecorder((err, recorder) => { if (!err) { console.info(TAG + 'Entering create video receiver') mVideoRecorder = recorder @@ -1322,7 +1322,7 @@ export default function cameraSessionExposureTest() { for (let i = 0; i < mCameraNum; i++) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0100 start for camera[" + i + "]"); let exposureBias = mExposureBiasRangeArray[i][0]; - if (exposureBias == 0) { + if (exposureBias == 0 || isNaN(exposureBias)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0100 exposureBias is 0"); } else { await startCameraSession(i); diff --git a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionFlashTest.test.ets b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionFlashTest.test.ets index 7ba583912..be05515f4 100644 --- a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionFlashTest.test.ets +++ b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionFlashTest.test.ets @@ -54,7 +54,7 @@ let mVideoProfileCfg = { audioSampleRate: 48000, durationTime: 1000, fileFormat: 'mp4', - videoBitrate: 48000, + videoBitrate: 2000000, videoCodec: 'video/mp4v-es', videoFrameWidth: 640, videoFrameHeight: 480, @@ -139,7 +139,7 @@ export default function cameraSessionFlashTest() { console.log(TAG + 'Entering getVideoReceiveSurface') await getFd('CameraSessionFlush.mp4'); mVideoConfig.url = mFdPath; - media.createVideoRecorder((err, recorder) => { + media.createAVRecorder((err, recorder) => { if (!err) { console.info(TAG + 'Entering create video receiver') mVideoRecorder = recorder diff --git a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionFocusTest.test.ets b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionFocusTest.test.ets index 936662a5f..092e539ca 100644 --- a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionFocusTest.test.ets +++ b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionFocusTest.test.ets @@ -53,7 +53,7 @@ let mVideoProfileCfg = { audioSampleRate: 48000, durationTime: 1000, fileFormat: 'mp4', - videoBitrate: 48000, + videoBitrate: 2000000, videoCodec: 'video/mp4v-es', videoFrameWidth: 640, videoFrameHeight: 480, @@ -185,7 +185,7 @@ export default function cameraSessionFocusTest() { console.log(TAG + 'Entering getVideoReceiveSurface') await getFd('CameraSessionFocus.mp4'); mVideoConfig.url = mFdPath; - media.createVideoRecorder((err, recorder) => { + media.createAVRecorder((err, recorder) => { if (!err) { console.info(TAG + 'Entering create video receiver') mVideoRecorder = recorder diff --git a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionVideoStabilizationTest.test.ets b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionVideoStabilizationTest.test.ets index ffff459a7..a903b8896 100644 --- a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionVideoStabilizationTest.test.ets +++ b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionVideoStabilizationTest.test.ets @@ -53,7 +53,7 @@ let mVideoProfileCfg = { audioSampleRate: 48000, durationTime: 1000, fileFormat: 'mp4', - videoBitrate: 48000, + videoBitrate: 2000000, videoCodec: 'video/mp4v-es', videoFrameWidth: 640, videoFrameHeight: 480, @@ -138,7 +138,7 @@ export default function cameraSessionVideoStabilizationTest() { console.log(TAG + 'Entering getVideoReceiveSurface') await getFd('CameraSessionVideoStabilization.mp4'); mVideoConfig.url = mFdPath; - media.createVideoRecorder((err, recorder) => { + media.createAVRecorder((err, recorder) => { if (!err) { console.info(TAG + 'Entering create video receiver') mVideoRecorder = recorder diff --git a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionZoomRatioTest.test.ets b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionZoomRatioTest.test.ets index 103ca7370..0a245e3dd 100644 --- a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionZoomRatioTest.test.ets +++ b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionZoomRatioTest.test.ets @@ -55,7 +55,7 @@ let mVideoProfileCfg = { audioSampleRate: 48000, durationTime: 1000, fileFormat: 'mp4', - videoBitrate: 48000, + videoBitrate: 2000000, videoCodec: 'video/mp4v-es', videoFrameWidth: 640, videoFrameHeight: 480, @@ -140,7 +140,7 @@ export default function cameraSessionZoomRatioTest() { console.log(TAG + 'Entering getVideoReceiveSurface') await getFd('CameraSessionZoomRatio.mp4'); mVideoConfig.url = mFdPath; - media.createVideoRecorder((err, recorder) => { + media.createAVRecorder((err, recorder) => { if (!err) { console.info(TAG + 'Entering create video receiver') mVideoRecorder = recorder -- GitLab