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

camera上库

Signed-off-by: Ndongxinli <dongxinli@huawei.com>
上级 e21f53ab
......@@ -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();
})
......
......@@ -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);
......
......@@ -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');
})
......
......@@ -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
......
......@@ -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
......
......@@ -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);
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册