提交 8a7eba01 编写于 作者: D dongxinli

camera上库

Signed-off-by: Ndongxinli <dongxinli@huawei.com>
上级 e21f53ab
...@@ -96,7 +96,7 @@ export default function cameraEnumTest() { ...@@ -96,7 +96,7 @@ export default function cameraEnumTest() {
*/ */
it('SUB_MULTIMEDIA_CAMERA_ENUM_CAMERATYPE_0100', 2, async function (done) { it('SUB_MULTIMEDIA_CAMERA_ENUM_CAMERATYPE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_CAMERATYPE_0100--------------"); 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_DEFAULT == 0).assertTrue();
expect(camera.CameraType.CAMERA_TYPE_WIDE_ANGLE == 1).assertTrue(); expect(camera.CameraType.CAMERA_TYPE_WIDE_ANGLE == 1).assertTrue();
expect(camera.CameraType.CAMERA_TYPE_ULTRA_WIDE == 2).assertTrue(); expect(camera.CameraType.CAMERA_TYPE_ULTRA_WIDE == 2).assertTrue();
...@@ -301,16 +301,27 @@ export default function cameraEnumTest() { ...@@ -301,16 +301,27 @@ export default function cameraEnumTest() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAERRORCODE_0100', 2, async function (done) { 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(); expect(camera.CameraErrorCode.INVALID_ARGUMENT == 7400101).assertTrue();
console.info(TAG + "--------------INVALID_ARGUMENT--------------");
expect(camera.CameraErrorCode.OPERATION_NOT_ALLOWED == 7400102).assertTrue(); expect(camera.CameraErrorCode.OPERATION_NOT_ALLOWED == 7400102).assertTrue();
console.info(TAG + "--------------OPERATION_NOT_ALLOWED--------------");
expect(camera.CameraErrorCode.SESSION_NOT_CONFIG == 7400103).assertTrue(); expect(camera.CameraErrorCode.SESSION_NOT_CONFIG == 7400103).assertTrue();
console.info(TAG + "--------------SESSION_NOT_CONFIG--------------");
expect(camera.CameraErrorCode.SESSION_NOT_RUNNING == 7400104).assertTrue(); expect(camera.CameraErrorCode.SESSION_NOT_RUNNING == 7400104).assertTrue();
console.info(TAG + "--------------SESSION_NOT_RUNNING--------------");
expect(camera.CameraErrorCode.SESSION_CONFIG_LOCKED == 7400105).assertTrue(); 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.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(); 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(); 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"); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAERRORCODE_0100 ends here");
done(); done();
}) })
......
...@@ -26,7 +26,7 @@ let videoProfile = { ...@@ -26,7 +26,7 @@ let videoProfile = {
audioCodec: 'audio/mp4a-latm', audioCodec: 'audio/mp4a-latm',
audioSampleRate: 48000, audioSampleRate: 48000,
fileFormat: 'mp4', fileFormat: 'mp4',
videoBitrate: 48000, videoBitrate: 2000000,
videoCodec: 'video/mp4v-es', videoCodec: 'video/mp4v-es',
videoFrameWidth: 640, videoFrameWidth: 640,
videoFrameHeight: 480, videoFrameHeight: 480,
...@@ -230,7 +230,7 @@ export default function CameraErrorCodeUsecaseTest() { ...@@ -230,7 +230,7 @@ export default function CameraErrorCodeUsecaseTest() {
async function getvideosurface() { async function getvideosurface() {
await getFd('ErrorCodeCameraOutput.mp4'); await getFd('ErrorCodeCameraOutput.mp4');
videoConfig.url = fdPath; videoConfig.url = fdPath;
media.createVideoRecorder((err, recorder) => { media.createAVRecorder((err, recorder) => {
if (!err) { if (!err) {
console.info(TAG + 'createVideoRecorder called') console.info(TAG + 'createVideoRecorder called')
videoRecorder = recorder videoRecorder = recorder
...@@ -334,7 +334,7 @@ export default function CameraErrorCodeUsecaseTest() { ...@@ -334,7 +334,7 @@ export default function CameraErrorCodeUsecaseTest() {
await releaseInput(); await releaseInput();
} }
if (!isEmpty(mCameraSession)) { if (!isEmpty(mCameraSession)) {
releaseCameraSessionInstance(); await releaseCameraSessionInstance();
} }
}) })
...@@ -1712,6 +1712,10 @@ export default function CameraErrorCodeUsecaseTest() { ...@@ -1712,6 +1712,10 @@ export default function CameraErrorCodeUsecaseTest() {
*/ */
it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETFOCUSPOINT_0100', 0, async function (done) { 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--------------"); console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETFOCUSPOINT_0100--------------");
if(mCameraSession){
mCameraSession.release();
mCameraSession = null;
}
await createInput(0); await createInput(0);
createCameraSessionInstance(); createCameraSessionInstance();
mCameraSession.addInput(mCameraInput); mCameraSession.addInput(mCameraInput);
......
...@@ -40,7 +40,7 @@ let videoProfile = { ...@@ -40,7 +40,7 @@ let videoProfile = {
audioCodec: 'audio/mp4a-latm', audioCodec: 'audio/mp4a-latm',
audioSampleRate: 48000, audioSampleRate: 48000,
fileFormat: 'mp4', fileFormat: 'mp4',
videoBitrate: 48000, videoBitrate: 2000000,
videoCodec: 'video/mp4v-es', videoCodec: 'video/mp4v-es',
videoFrameWidth: 640, videoFrameWidth: 640,
videoFrameHeight: 480, videoFrameHeight: 480,
...@@ -96,10 +96,12 @@ export default function cameraJSUnitOutput() { ...@@ -96,10 +96,12 @@ export default function cameraJSUnitOutput() {
async function getFd(pathName) { async function getFd(pathName) {
let displayName = pathName; let displayName = pathName;
const mediaTest = mediaLibrary.getMediaLibrary(); const mediaTest = mediaLibrary.getMediaLibrary();
console.log(TAG + 'mediaTest: ' + JSON.stringify(mediaTest))
let fileKeyObj = mediaLibrary.FileKey; let fileKeyObj = mediaLibrary.FileKey;
let mediaType = mediaLibrary.MediaType.VIDEO; let mediaType = mediaLibrary.MediaType.VIDEO;
let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO); let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO);
let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath); let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath);
console.log(TAG + 'dataUri id: ' + JSON.stringify(dataUri))
if (dataUri != undefined) { if (dataUri != undefined) {
let args = dataUri.id.toString(); let args = dataUri.id.toString();
let fetchOp = { let fetchOp = {
...@@ -109,6 +111,7 @@ export default function cameraJSUnitOutput() { ...@@ -109,6 +111,7 @@ export default function cameraJSUnitOutput() {
let fetchFileResult = await mediaTest.getFileAssets(fetchOp); let fetchFileResult = await mediaTest.getFileAssets(fetchOp);
fileAsset = await fetchFileResult.getAllObject(); fileAsset = await fetchFileResult.getAllObject();
fdNumber = await fileAsset[0].open('Rw'); fdNumber = await fileAsset[0].open('Rw');
console.log(TAG + 'fdNumber id: ' + JSON.stringify(fdNumber))
fdPath = "fd://" + fdNumber.toString(); fdPath = "fd://" + fdNumber.toString();
} }
} }
...@@ -127,8 +130,9 @@ export default function cameraJSUnitOutput() { ...@@ -127,8 +130,9 @@ export default function cameraJSUnitOutput() {
async function getvideosurface() { async function getvideosurface() {
await getFd('CameraOutput.mp4'); await getFd('CameraOutput.mp4');
videoConfig.url = fdPath; await sleep(2000);
media.createVideoRecorder((err, recorder) => { videoConfig.url = fdPath;
media.createAVRecorder((err, recorder) => {
if (!err) { if (!err) {
console.info(TAG + 'createVideoRecorder called') console.info(TAG + 'createVideoRecorder called')
videoRecorder = recorder videoRecorder = recorder
...@@ -152,7 +156,7 @@ export default function cameraJSUnitOutput() { ...@@ -152,7 +156,7 @@ export default function cameraJSUnitOutput() {
}) })
} }
else { else {
console.info(TAG + 'createVideoRecorder FAILED') console.info(TAG + 'createVideoRecorder FAILED ,Code' + err.code)
} }
}) })
} }
...@@ -195,6 +199,7 @@ export default function cameraJSUnitOutput() { ...@@ -195,6 +199,7 @@ export default function cameraJSUnitOutput() {
beforeAll(async function () { beforeAll(async function () {
await getImageReceiverSurfaceId(); await getImageReceiverSurfaceId();
await getvideosurface(); await getvideosurface();
sleep(2000);
console.info('beforeAll case'); console.info('beforeAll case');
}) })
......
...@@ -42,7 +42,7 @@ let mVideoProfileCfg = { ...@@ -42,7 +42,7 @@ let mVideoProfileCfg = {
audioSampleRate: 48000, audioSampleRate: 48000,
durationTime: 1000, durationTime: 1000,
fileFormat: 'mp4', fileFormat: 'mp4',
videoBitrate: 48000, videoBitrate: 2000000,
videoCodec: 'video/mp4v-es', videoCodec: 'video/mp4v-es',
videoFrameWidth: 640, videoFrameWidth: 640,
videoFrameHeight: 480, videoFrameHeight: 480,
...@@ -111,7 +111,7 @@ export default function cameraManagerTest() { ...@@ -111,7 +111,7 @@ export default function cameraManagerTest() {
console.log(TAG + 'Entering getVideoReceiveSurface') console.log(TAG + 'Entering getVideoReceiveSurface')
await getFd('CameraManager.mp4'); await getFd('CameraManager.mp4');
mVideoConfig.url = mFdPath; mVideoConfig.url = mFdPath;
media.createVideoRecorder((err, recorder) => { media.createAVRecorder((err, recorder) => {
if (!err) { if (!err) {
console.info(TAG + 'Entering create video receiver') console.info(TAG + 'Entering create video receiver')
mVideoRecorder = recorder mVideoRecorder = recorder
......
...@@ -51,7 +51,7 @@ let mVideoProfileCfg = { ...@@ -51,7 +51,7 @@ let mVideoProfileCfg = {
audioSampleRate: 48000, audioSampleRate: 48000,
durationTime: 1000, durationTime: 1000,
fileFormat: 'mp4', fileFormat: 'mp4',
videoBitrate: 48000, videoBitrate: 2000000,
videoCodec: 'video/mp4v-es', videoCodec: 'video/mp4v-es',
videoFrameWidth: 640, videoFrameWidth: 640,
videoFrameHeight: 480, videoFrameHeight: 480,
...@@ -133,7 +133,7 @@ export default function cameraSessionTest() { ...@@ -133,7 +133,7 @@ export default function cameraSessionTest() {
console.log(TAG + 'Entering getVideoReceiveSurface') console.log(TAG + 'Entering getVideoReceiveSurface')
await getFd('CameraSessionBase.mp4'); await getFd('CameraSessionBase.mp4');
mVideoConfig.url = mFdPath; mVideoConfig.url = mFdPath;
media.createVideoRecorder((err, recorder) => { media.createAVRecorder((err, recorder) => {
if (!err) { if (!err) {
console.info(TAG + 'Entering create video receiver') console.info(TAG + 'Entering create video receiver')
mVideoRecorder = recorder mVideoRecorder = recorder
......
...@@ -56,7 +56,7 @@ let mVideoProfileCfg = { ...@@ -56,7 +56,7 @@ let mVideoProfileCfg = {
audioSampleRate: 48000, audioSampleRate: 48000,
durationTime: 1000, durationTime: 1000,
fileFormat: 'mp4', fileFormat: 'mp4',
videoBitrate: 48000, videoBitrate: 2000000,
videoCodec: 'video/mp4v-es', videoCodec: 'video/mp4v-es',
videoFrameWidth: 640, videoFrameWidth: 640,
videoFrameHeight: 480, videoFrameHeight: 480,
...@@ -188,7 +188,7 @@ export default function cameraSessionExposureTest() { ...@@ -188,7 +188,7 @@ export default function cameraSessionExposureTest() {
console.log(TAG + 'Entering getVideoReceiveSurface') console.log(TAG + 'Entering getVideoReceiveSurface')
await getFd('CameraSessionExposure.mp4'); await getFd('CameraSessionExposure.mp4');
mVideoConfig.url = mFdPath; mVideoConfig.url = mFdPath;
media.createVideoRecorder((err, recorder) => { media.createAVRecorder((err, recorder) => {
if (!err) { if (!err) {
console.info(TAG + 'Entering create video receiver') console.info(TAG + 'Entering create video receiver')
mVideoRecorder = recorder mVideoRecorder = recorder
...@@ -1322,7 +1322,7 @@ export default function cameraSessionExposureTest() { ...@@ -1322,7 +1322,7 @@ export default function cameraSessionExposureTest() {
for (let i = 0; i < mCameraNum; i++) { 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 + "]"); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0100 start for camera[" + i + "]");
let exposureBias = mExposureBiasRangeArray[i][0]; 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"); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0100 exposureBias is 0");
} else { } else {
await startCameraSession(i); await startCameraSession(i);
......
...@@ -54,7 +54,7 @@ let mVideoProfileCfg = { ...@@ -54,7 +54,7 @@ let mVideoProfileCfg = {
audioSampleRate: 48000, audioSampleRate: 48000,
durationTime: 1000, durationTime: 1000,
fileFormat: 'mp4', fileFormat: 'mp4',
videoBitrate: 48000, videoBitrate: 2000000,
videoCodec: 'video/mp4v-es', videoCodec: 'video/mp4v-es',
videoFrameWidth: 640, videoFrameWidth: 640,
videoFrameHeight: 480, videoFrameHeight: 480,
...@@ -139,7 +139,7 @@ export default function cameraSessionFlashTest() { ...@@ -139,7 +139,7 @@ export default function cameraSessionFlashTest() {
console.log(TAG + 'Entering getVideoReceiveSurface') console.log(TAG + 'Entering getVideoReceiveSurface')
await getFd('CameraSessionFlush.mp4'); await getFd('CameraSessionFlush.mp4');
mVideoConfig.url = mFdPath; mVideoConfig.url = mFdPath;
media.createVideoRecorder((err, recorder) => { media.createAVRecorder((err, recorder) => {
if (!err) { if (!err) {
console.info(TAG + 'Entering create video receiver') console.info(TAG + 'Entering create video receiver')
mVideoRecorder = recorder mVideoRecorder = recorder
......
...@@ -53,7 +53,7 @@ let mVideoProfileCfg = { ...@@ -53,7 +53,7 @@ let mVideoProfileCfg = {
audioSampleRate: 48000, audioSampleRate: 48000,
durationTime: 1000, durationTime: 1000,
fileFormat: 'mp4', fileFormat: 'mp4',
videoBitrate: 48000, videoBitrate: 2000000,
videoCodec: 'video/mp4v-es', videoCodec: 'video/mp4v-es',
videoFrameWidth: 640, videoFrameWidth: 640,
videoFrameHeight: 480, videoFrameHeight: 480,
...@@ -185,7 +185,7 @@ export default function cameraSessionFocusTest() { ...@@ -185,7 +185,7 @@ export default function cameraSessionFocusTest() {
console.log(TAG + 'Entering getVideoReceiveSurface') console.log(TAG + 'Entering getVideoReceiveSurface')
await getFd('CameraSessionFocus.mp4'); await getFd('CameraSessionFocus.mp4');
mVideoConfig.url = mFdPath; mVideoConfig.url = mFdPath;
media.createVideoRecorder((err, recorder) => { media.createAVRecorder((err, recorder) => {
if (!err) { if (!err) {
console.info(TAG + 'Entering create video receiver') console.info(TAG + 'Entering create video receiver')
mVideoRecorder = recorder mVideoRecorder = recorder
......
...@@ -53,7 +53,7 @@ let mVideoProfileCfg = { ...@@ -53,7 +53,7 @@ let mVideoProfileCfg = {
audioSampleRate: 48000, audioSampleRate: 48000,
durationTime: 1000, durationTime: 1000,
fileFormat: 'mp4', fileFormat: 'mp4',
videoBitrate: 48000, videoBitrate: 2000000,
videoCodec: 'video/mp4v-es', videoCodec: 'video/mp4v-es',
videoFrameWidth: 640, videoFrameWidth: 640,
videoFrameHeight: 480, videoFrameHeight: 480,
...@@ -138,7 +138,7 @@ export default function cameraSessionVideoStabilizationTest() { ...@@ -138,7 +138,7 @@ export default function cameraSessionVideoStabilizationTest() {
console.log(TAG + 'Entering getVideoReceiveSurface') console.log(TAG + 'Entering getVideoReceiveSurface')
await getFd('CameraSessionVideoStabilization.mp4'); await getFd('CameraSessionVideoStabilization.mp4');
mVideoConfig.url = mFdPath; mVideoConfig.url = mFdPath;
media.createVideoRecorder((err, recorder) => { media.createAVRecorder((err, recorder) => {
if (!err) { if (!err) {
console.info(TAG + 'Entering create video receiver') console.info(TAG + 'Entering create video receiver')
mVideoRecorder = recorder mVideoRecorder = recorder
......
...@@ -55,7 +55,7 @@ let mVideoProfileCfg = { ...@@ -55,7 +55,7 @@ let mVideoProfileCfg = {
audioSampleRate: 48000, audioSampleRate: 48000,
durationTime: 1000, durationTime: 1000,
fileFormat: 'mp4', fileFormat: 'mp4',
videoBitrate: 48000, videoBitrate: 2000000,
videoCodec: 'video/mp4v-es', videoCodec: 'video/mp4v-es',
videoFrameWidth: 640, videoFrameWidth: 640,
videoFrameHeight: 480, videoFrameHeight: 480,
...@@ -140,7 +140,7 @@ export default function cameraSessionZoomRatioTest() { ...@@ -140,7 +140,7 @@ export default function cameraSessionZoomRatioTest() {
console.log(TAG + 'Entering getVideoReceiveSurface') console.log(TAG + 'Entering getVideoReceiveSurface')
await getFd('CameraSessionZoomRatio.mp4'); await getFd('CameraSessionZoomRatio.mp4');
mVideoConfig.url = mFdPath; mVideoConfig.url = mFdPath;
media.createVideoRecorder((err, recorder) => { media.createAVRecorder((err, recorder) => {
if (!err) { if (!err) {
console.info(TAG + 'Entering create video receiver') console.info(TAG + 'Entering create video receiver')
mVideoRecorder = recorder mVideoRecorder = recorder
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册