提交 2a98d17e 编写于 作者: F fulizhong

modify testcases Signed-off-by: FULIZHONG<fulizhong1@huawei.com>

Signed-off-by: Nfulizhong <fulizhong@huawei.com>
上级 984837be
...@@ -45,6 +45,7 @@ group("multimedia") { ...@@ -45,6 +45,7 @@ group("multimedia") {
"media/media_js_standard/audioRecorder:audio_recorder_js_hap", "media/media_js_standard/audioRecorder:audio_recorder_js_hap",
"media/media_js_standard/recorderFormat:recorder_format_js_hap", "media/media_js_standard/recorderFormat:recorder_format_js_hap",
"media/media_js_standard/videoPlayer:video_player_js_hap", "media/media_js_standard/videoPlayer:video_player_js_hap",
"media/media_js_standard/videoRecorder:video_recorder_js_hap",
"medialibrary/mediaLibrary_album:mediaLibrary_album_hap", "medialibrary/mediaLibrary_album:mediaLibrary_album_hap",
"medialibrary/mediaLibrary_base:mediaLibrary_base_hap", "medialibrary/mediaLibrary_base:mediaLibrary_base_hap",
"medialibrary/mediaLibrary_favorite:mediaLibrary_favorite_hap", "medialibrary/mediaLibrary_favorite:mediaLibrary_favorite_hap",
......
...@@ -27,48 +27,72 @@ const BITRATE_DELTA_TIME = 20000; ...@@ -27,48 +27,72 @@ const BITRATE_DELTA_TIME = 20000;
const PLAY_TIME = 1000; const PLAY_TIME = 1000;
export async function initCaptureSession(videoOutPut, cameraManager, cameras, cameraID) { export async function initCaptureSession(videoOutPut, cameraManager, cameraDevice, previewOutput) {
let cameraInput = await cameraManager.createCameraInput(cameras[cameraID].cameraId); let cameraInput = await cameraManager.createCameraInput(cameraDevice);
if (cameraInput != null) { if (cameraInput != null) {
console.info('[camera] case createCameraInput success'); console.info('[camera] case createCameraInput success');
} else { } else {
console.info('[camera] case createCameraInput failed'); console.info('[camera] case createCameraInput failed');
return; return;
} }
let captureSession = await camera.createCaptureSession(null); await cameraInput.open((err) => {
if(err){
console.info('[camera] cameraInput open Failed');
return
}
console.info('[camera] cameraInput open success');
})
let captureSession = await cameraManager.createCaptureSession();
await captureSession.beginConfig(); await captureSession.beginConfig();
await captureSession.addInput(cameraInput); await captureSession.addInput(cameraInput);
await captureSession.addOutput(previewOutput);
await captureSession.addOutput(videoOutPut); await captureSession.addOutput(videoOutPut);
await captureSession.commitConfig(); await captureSession.commitConfig();
await captureSession.start();
return captureSession; return captureSession;
} }
export async function stopCaptureSession(captureSession) { export async function stopCaptureSession(captureSession) {
await captureSession.release(); await captureSession.stop().then(() => {
console.info('[camera] case captureSession stop success');
});
await captureSession.release().then(() => {
console.info('[camera] case captureSession release success');
});
} }
export function getTrackArray(videoType, recorderConfigFile) { export function getTrackArray(videoType, recorderConfigFile, sourceType) {
if (videoType == AUDIO_VIDEO_TYPE) { if (videoType == AUDIO_VIDEO_TYPE) {
let audioTrack = new Array(recorderConfigFile.audioBitrate, recorderConfigFile.audioChannels, let audioTrack = new Array(recorderConfigFile.audioBitrate, recorderConfigFile.audioChannels,
'audio/mpeg', recorderConfigFile.audioSampleRate); 'audio/mpeg', recorderConfigFile.audioSampleRate);
let videoTrack = null; let videoTrack = null;
if (recorderConfigFile.videoCodec == 'video/avc') { if (sourceType == media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES) {
videoTrack = new Array('video/x-h264', recorderConfigFile.videoFrameHeight, videoTrack = new Array('video/x-h264', recorderConfigFile.videoFrameHeight,
recorderConfigFile.videoFrameWidth); recorderConfigFile.videoFrameWidth);
} else { } else {
videoTrack = new Array('video/mpeg', recorderConfigFile.videoFrameHeight, if (recorderConfigFile.videoCodec == 'video/avc') {
recorderConfigFile.videoFrameWidth); videoTrack = new Array('video/x-h264', recorderConfigFile.videoFrameHeight,
recorderConfigFile.videoFrameWidth);
} else {
videoTrack = new Array('video/mpeg', recorderConfigFile.videoFrameHeight,
recorderConfigFile.videoFrameWidth);
}
} }
let trackArray = new Array(videoTrack, audioTrack); let trackArray = new Array(videoTrack, audioTrack);
return trackArray; return trackArray;
} else if (videoType == ONLYVIDEO_TYPE) { } else if (videoType == ONLYVIDEO_TYPE) {
let videoTrack = null; let videoTrack = null;
if (recorderConfigFile.videoCodec == 'video/avc') { if (sourceType == media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES) {
videoTrack = new Array('video/x-h264', recorderConfigFile.videoFrameHeight, videoTrack = new Array('video/x-h264', recorderConfigFile.videoFrameHeight,
recorderConfigFile.videoFrameWidth); recorderConfigFile.videoFrameWidth);
} else { } else {
videoTrack = new Array('video/mpeg', recorderConfigFile.videoFrameHeight, if (recorderConfigFile.videoCodec == 'video/avc') {
recorderConfigFile.videoFrameWidth); videoTrack = new Array('video/x-h264', recorderConfigFile.videoFrameHeight,
recorderConfigFile.videoFrameWidth);
} else {
videoTrack = new Array('video/mpeg', recorderConfigFile.videoFrameHeight,
recorderConfigFile.videoFrameWidth);
}
} }
let trackArray = new Array(videoTrack); let trackArray = new Array(videoTrack);
return trackArray; return trackArray;
...@@ -115,6 +139,12 @@ export async function checkVideos(playFdPath, duration, trackArray, playerSurfac ...@@ -115,6 +139,12 @@ export async function checkVideos(playFdPath, duration, trackArray, playerSurfac
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
console.info('[checkVideos] case checkVideos fdPath is :' + playFdPath); console.info('[checkVideos] case checkVideos fdPath is :' + playFdPath);
videoPlayer.on('error', (error) => {
console.info(`case error called,errMessage is ${error.message}`);
expect().assertFail();
return;
});
videoPlayer.url = playFdPath; videoPlayer.url = playFdPath;
let tarckType = undefined; let tarckType = undefined;
if (playerSurfaceId != null) { if (playerSurfaceId != null) {
...@@ -141,20 +171,6 @@ export async function checkVideos(playFdPath, duration, trackArray, playerSurfac ...@@ -141,20 +171,6 @@ export async function checkVideos(playFdPath, duration, trackArray, playerSurfac
expect().assertFail(); expect().assertFail();
} }
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
let startTime = videoPlayer.currentTime;
await videoPlayer.play().then(() => {
console.info('case play called!!');
mediaTestBase.msleep(PLAY_TIME);
expect(videoPlayer.state).assertEqual('playing');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
let endTime = videoPlayer.currentTime;
expect(Math.abs(endTime - startTime - PLAY_TIME)).assertLess(DELTA_TIME);
await videoPlayer.stop().then(() => {
console.info('case stop called!!');
expect(videoPlayer.state).assertEqual('stopped');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoPlayer.release().then(() => { await videoPlayer.release().then(() => {
console.info('case release called!!'); console.info('case release called!!');
......
...@@ -43,6 +43,13 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -43,6 +43,13 @@ describe('VideoRecorderAPICallbackTest', function () {
let fdPath; let fdPath;
let fdObject; let fdObject;
let cameraID = 0; let cameraID = 0;
let playerSurfaceId = '';
let pageId = 0;
let videoProfiles;
let previewProfiles;
let previewOutput;
const pagePath1 = 'pages/surfaceTest/surfaceTest';
const pagePath2 = 'pages/surfaceTest2/surfaceTest2';
let events = require('events'); let events = require('events');
let eventEmitter = new events.EventEmitter(); let eventEmitter = new events.EventEmitter();
...@@ -79,19 +86,42 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -79,19 +86,42 @@ describe('VideoRecorderAPICallbackTest', function () {
console.info('[camera] case getCameraManager failed'); console.info('[camera] case getCameraManager failed');
return; return;
} }
cameras = await cameraManager.getCameras(); await cameraManager.getSupportedCameras().then((cameraDevices)=> {
cameras = cameraDevices;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
if (cameras != null) { if (cameras != null) {
console.info('[camera] case getCameras success'); console.info('[camera] case getCameras success');
} else { } else {
console.info('[camera] case getCameras failed'); console.info('[camera] case getCameras failed');
} }
await cameraManager.getSupportedOutputCapability(cameras[0]).then((cameraoutputcapability) => {
console.info('[camera] case getSupportedOutputCapability success');
videoProfiles = cameraoutputcapability.videoProfiles;
videoProfiles[0].size.height = 480;
videoProfiles[0].size.width = 640;
previewProfiles = cameraoutputcapability.previewProfiles;
previewProfiles[0].size.height = 480;
previewProfiles[0].size.width = 640;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback)
if (previewProfiles[0].format == camera.CameraFormat.CAMERA_FORMAT_YUV_420_SP) {
console.info('[camera] case format is VIDEO_SOURCE_TYPE_SURFACE_YUV');
videoConfig.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV;
} else {
console.info('[camera] case format is VIDEO_SOURCE_TYPE_SURFACE_ES');
videoConfig.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES;
}
fdObject = await mediaTestBase.getFd('recorder_callback_api.mp4'); fdObject = await mediaTestBase.getFd('recorder_callback_api.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
console.info('beforeAll case'); console.info('beforeAll case');
}) })
beforeEach(function () { beforeEach(async function () {
await mediaTestBase.toNewPage(pagePath1, pagePath2, pageId);
pageId = (pageId + 1) % 2;
await mediaTestBase.msleepAsync(1000).then(
() => {}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
playerSurfaceId = globalThis.value;
surfaceID = null; surfaceID = null;
console.info('beforeEach case'); console.info('beforeEach case');
}) })
...@@ -101,7 +131,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -101,7 +131,7 @@ describe('VideoRecorderAPICallbackTest', function () {
}) })
afterAll(async function () { afterAll(async function () {
await mediaTestBase.closeFd(); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
console.info('afterAll case'); console.info('afterAll case');
}) })
...@@ -123,13 +153,15 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -123,13 +153,15 @@ describe('VideoRecorderAPICallbackTest', function () {
eventEmitter.on(START_STREEAM, async (videoRecorder, steps, done) => { eventEmitter.on(START_STREEAM, async (videoRecorder, steps, done) => {
steps.shift(); steps.shift();
videoOutput = await camera.createVideoOutput(surfaceID); videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
if (videoOutput == null) { if (videoOutput == null) {
console.info('[camera] case createVideoOutput failed'); console.info('[camera] case createVideoOutput failed');
} else { } else {
console.info('[camera] case createVideoOutput success'); console.info('[camera] case createVideoOutput success');
} }
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager, cameras, cameraID); previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await videoOutput.start().then(() => { await videoOutput.start().then(() => {
console.info('[camera] case videoOutput start success'); console.info('[camera] case videoOutput start success');
}); });
...@@ -141,10 +173,6 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -141,10 +173,6 @@ describe('VideoRecorderAPICallbackTest', function () {
await videoOutput.stop().then(() => { await videoOutput.stop().then(() => {
console.info('[camera] case videoOutput stop success'); console.info('[camera] case videoOutput stop success');
}); });
await videoOutput.release().then(() => {
console.info('[camera] case videoOutput release success');
});
videoOutput = undefined;
await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.stopCaptureSession(captureSession);
toNextStep(videoRecorder, steps, done); toNextStep(videoRecorder, steps, done);
}); });
......
...@@ -48,6 +48,9 @@ describe('VideoRecorderFuncCallbackTest', function () { ...@@ -48,6 +48,9 @@ describe('VideoRecorderFuncCallbackTest', function () {
let fdObject; let fdObject;
let cameraID = 0; let cameraID = 0;
let pageId = 0; let pageId = 0;
let videoProfiles;
let previewProfiles;
let previewOutput;
let configFile = { let configFile = {
audioBitrate : 48000, audioBitrate : 48000,
audioChannels : 2, audioChannels : 2,
...@@ -101,18 +104,48 @@ describe('VideoRecorderFuncCallbackTest', function () { ...@@ -101,18 +104,48 @@ describe('VideoRecorderFuncCallbackTest', function () {
console.info('[camera] case getCameraManager failed'); console.info('[camera] case getCameraManager failed');
return; return;
} }
cameras = await cameraManager.getCameras(); await cameraManager.getSupportedCameras().then((cameraDevices)=> {
cameras = cameraDevices;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
if (cameras != null) { if (cameras != null) {
console.info('[camera] case getCameras success'); console.info('[camera] case getCameras success');
} else { } else {
console.info('[camera] case getCameras failed'); console.info('[camera] case getCameras failed');
} }
await cameraManager.getSupportedOutputCapability(cameras[0]).then((cameraoutputcapability) => {
console.info('[camera] case getSupportedOutputCapability success');
videoProfiles = cameraoutputcapability.videoProfiles;
videoProfiles[0].size.height = 480;
videoProfiles[0].size.width = 640;
previewProfiles = cameraoutputcapability.previewProfiles;
previewProfiles[0].size.height = 480;
previewProfiles[0].size.width = 640;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback)
if (previewProfiles[0].format == camera.CameraFormat.CAMERA_FORMAT_YUV_420_SP) {
console.info('[camera] case format is VIDEO_SOURCE_TYPE_SURFACE_YUV');
videoConfig.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV;
} else {
console.info('[camera] case format is VIDEO_SOURCE_TYPE_SURFACE_ES');
videoConfig.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES;
}
console.info('beforeAll case'); console.info('beforeAll case');
}) })
beforeEach(async function () { beforeEach(async function () {
await mediaTestBase.toNewPage(pagePath1, pagePath2, pageId); await mediaTestBase.toNewPage(pagePath1, pagePath2, pageId);
pageId = (pageId + 1) % 2; pageId = (pageId + 1) % 2;
if (previewProfiles[0].format == camera.CameraFormat.CAMERA_FORMAT_YUV_420_SP) {
if (pageId == 0) {
configFile.videoCodec = media.CodecMimeType.VIDEO_MPEG4;
onlyVideoProfile.videoCodec = media.CodecMimeType.VIDEO_MPEG4;
} else {
configFile.videoCodec = media.CodecMimeType.VIDEO_AVC;
onlyVideoProfile.videoCodec = media.CodecMimeType.VIDEO_AVC;
}
} else {
configFile.videoCodec = media.CodecMimeType.VIDEO_MPEG4;
onlyVideoProfile.videoCodec = media.CodecMimeType.VIDEO_MPEG4;
}
await mediaTestBase.msleepAsync(1000).then( await mediaTestBase.msleepAsync(1000).then(
() => {}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); () => {}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
playerSurfaceId = globalThis.value; playerSurfaceId = globalThis.value;
...@@ -218,13 +251,15 @@ describe('VideoRecorderFuncCallbackTest', function () { ...@@ -218,13 +251,15 @@ describe('VideoRecorderFuncCallbackTest', function () {
eventEmitter.on(START_EVENT, async (videoRecorder, steps, done) => { eventEmitter.on(START_EVENT, async (videoRecorder, steps, done) => {
steps.shift(); steps.shift();
videoOutput = await camera.createVideoOutput(surfaceID); videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
if (videoOutput == null) { if (videoOutput == null) {
console.info('case createVideoOutput failed'); console.info('case createVideoOutput failed');
} else { } else {
console.info('case createVideoOutput success'); console.info('case createVideoOutput success');
} }
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager, cameras, cameraID); previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await videoOutput.start().then(() => { await videoOutput.start().then(() => {
console.info('case videoOutput start success'); console.info('case videoOutput start success');
}); });
...@@ -300,10 +335,6 @@ describe('VideoRecorderFuncCallbackTest', function () { ...@@ -300,10 +335,6 @@ describe('VideoRecorderFuncCallbackTest', function () {
await videoOutput.stop().then(() => { await videoOutput.stop().then(() => {
console.info('case videoOutput stop success'); console.info('case videoOutput stop success');
}); });
await videoOutput.release().then(() => {
console.info('case videoOutput release success');
});
videoOutput = undefined;
await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.stopCaptureSession(captureSession);
if (typeof (err) == 'undefined') { if (typeof (err) == 'undefined') {
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
...@@ -337,7 +368,7 @@ describe('VideoRecorderFuncCallbackTest', function () { ...@@ -337,7 +368,7 @@ describe('VideoRecorderFuncCallbackTest', function () {
fdObject = await mediaTestBase.getFd('recorder_callback_01.mp4'); fdObject = await mediaTestBase.getFd('recorder_callback_01.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT, CHECK_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT, CHECK_EVENT,
trackArray, RECORDER_TIME, END_EVENT); trackArray, RECORDER_TIME, END_EVENT);
...@@ -356,7 +387,7 @@ describe('VideoRecorderFuncCallbackTest', function () { ...@@ -356,7 +387,7 @@ describe('VideoRecorderFuncCallbackTest', function () {
fdObject = await mediaTestBase.getFd('recorder_callback_02.mp4'); fdObject = await mediaTestBase.getFd('recorder_callback_02.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT,
PAUSE_EVENT, RELEASE_EVENT, CHECK_EVENT, PAUSE_EVENT, RELEASE_EVENT, CHECK_EVENT,
...@@ -376,7 +407,7 @@ describe('VideoRecorderFuncCallbackTest', function () { ...@@ -376,7 +407,7 @@ describe('VideoRecorderFuncCallbackTest', function () {
fdObject = await mediaTestBase.getFd('recorder_callback_03.mp4'); fdObject = await mediaTestBase.getFd('recorder_callback_03.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT,
PAUSE_EVENT, RESUME_EVENT, RELEASE_EVENT, CHECK_EVENT, PAUSE_EVENT, RESUME_EVENT, RELEASE_EVENT, CHECK_EVENT,
...@@ -396,7 +427,7 @@ describe('VideoRecorderFuncCallbackTest', function () { ...@@ -396,7 +427,7 @@ describe('VideoRecorderFuncCallbackTest', function () {
fdObject = await mediaTestBase.getFd('recorder_callback_04.mp4'); fdObject = await mediaTestBase.getFd('recorder_callback_04.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT,
STOP_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT); STOP_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
...@@ -415,7 +446,7 @@ describe('VideoRecorderFuncCallbackTest', function () { ...@@ -415,7 +446,7 @@ describe('VideoRecorderFuncCallbackTest', function () {
fdObject = await mediaTestBase.getFd('recorder_callback_05.mp4'); fdObject = await mediaTestBase.getFd('recorder_callback_05.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT,
RESET_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT); RESET_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
...@@ -434,7 +465,7 @@ describe('VideoRecorderFuncCallbackTest', function () { ...@@ -434,7 +465,7 @@ describe('VideoRecorderFuncCallbackTest', function () {
fdObject = await mediaTestBase.getFd('recorder_callback_06.mp4'); fdObject = await mediaTestBase.getFd('recorder_callback_06.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, PAUSE_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, PAUSE_EVENT,
STOP_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT); STOP_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
...@@ -453,7 +484,7 @@ describe('VideoRecorderFuncCallbackTest', function () { ...@@ -453,7 +484,7 @@ describe('VideoRecorderFuncCallbackTest', function () {
fdObject = await mediaTestBase.getFd('recorder_callback_07.mp4'); fdObject = await mediaTestBase.getFd('recorder_callback_07.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, PAUSE_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, PAUSE_EVENT,
RESET_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT); RESET_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
...@@ -472,7 +503,7 @@ describe('VideoRecorderFuncCallbackTest', function () { ...@@ -472,7 +503,7 @@ describe('VideoRecorderFuncCallbackTest', function () {
fdObject = await mediaTestBase.getFd('recorder_callback_08.mp4'); fdObject = await mediaTestBase.getFd('recorder_callback_08.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, PAUSE_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, PAUSE_EVENT,
RESUME_EVENT, STOP_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME * 2, END_EVENT); RESUME_EVENT, STOP_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME * 2, END_EVENT);
...@@ -491,7 +522,7 @@ describe('VideoRecorderFuncCallbackTest', function () { ...@@ -491,7 +522,7 @@ describe('VideoRecorderFuncCallbackTest', function () {
fdObject = await mediaTestBase.getFd('recorder_callback_09.mp4'); fdObject = await mediaTestBase.getFd('recorder_callback_09.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, PAUSE_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, PAUSE_EVENT,
RESUME_EVENT, RESET_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME * 2, END_EVENT); RESUME_EVENT, RESET_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME * 2, END_EVENT);
...@@ -514,7 +545,7 @@ describe('VideoRecorderFuncCallbackTest', function () { ...@@ -514,7 +545,7 @@ describe('VideoRecorderFuncCallbackTest', function () {
fdObject = await mediaTestBase.getFd('recorder_callback_10.mp4'); fdObject = await mediaTestBase.getFd('recorder_callback_10.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT,
STOP_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT); STOP_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
...@@ -537,7 +568,7 @@ describe('VideoRecorderFuncCallbackTest', function () { ...@@ -537,7 +568,7 @@ describe('VideoRecorderFuncCallbackTest', function () {
fdObject = await mediaTestBase.getFd('recorder_callback_11.mp4'); fdObject = await mediaTestBase.getFd('recorder_callback_11.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT,
STOP_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT); STOP_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
...@@ -560,7 +591,7 @@ describe('VideoRecorderFuncCallbackTest', function () { ...@@ -560,7 +591,7 @@ describe('VideoRecorderFuncCallbackTest', function () {
fdObject = await mediaTestBase.getFd('recorder_callback_12.mp4'); fdObject = await mediaTestBase.getFd('recorder_callback_12.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT,
STOP_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT); STOP_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
...@@ -583,7 +614,7 @@ describe('VideoRecorderFuncCallbackTest', function () { ...@@ -583,7 +614,7 @@ describe('VideoRecorderFuncCallbackTest', function () {
fdObject = await mediaTestBase.getFd('recorder_callback_13.mp4'); fdObject = await mediaTestBase.getFd('recorder_callback_13.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT,
STOP_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT); STOP_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
...@@ -602,7 +633,8 @@ describe('VideoRecorderFuncCallbackTest', function () { ...@@ -602,7 +633,8 @@ describe('VideoRecorderFuncCallbackTest', function () {
fdObject = await mediaTestBase.getFd('recorder_callback_14.mp4'); fdObject = await mediaTestBase.getFd('recorder_callback_14.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
onlyVideoConfig.url = fdPath; onlyVideoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(ONLYVIDEO_TYPE, onlyVideoProfile); let trackArray = videoRecorderBase.getTrackArray(ONLYVIDEO_TYPE, onlyVideoProfile,
onlyVideoConfig.videoSourceType);
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_OLNYVIDEO_EVENT, GETSURFACE_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_OLNYVIDEO_EVENT, GETSURFACE_EVENT,
START_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT); START_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
...@@ -621,7 +653,8 @@ describe('VideoRecorderFuncCallbackTest', function () { ...@@ -621,7 +653,8 @@ describe('VideoRecorderFuncCallbackTest', function () {
fdObject = await mediaTestBase.getFd('recorder_callback_15.mp4'); fdObject = await mediaTestBase.getFd('recorder_callback_15.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
onlyVideoConfig.url = fdPath; onlyVideoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(ONLYVIDEO_TYPE, onlyVideoProfile); let trackArray = videoRecorderBase.getTrackArray(ONLYVIDEO_TYPE, onlyVideoProfile,
onlyVideoConfig.videoSourceType);
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_OLNYVIDEO_EVENT, GETSURFACE_EVENT, START_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_OLNYVIDEO_EVENT, GETSURFACE_EVENT, START_EVENT,
PAUSE_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT); PAUSE_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
...@@ -640,7 +673,8 @@ describe('VideoRecorderFuncCallbackTest', function () { ...@@ -640,7 +673,8 @@ describe('VideoRecorderFuncCallbackTest', function () {
fdObject = await mediaTestBase.getFd('recorder_callback_16.mp4'); fdObject = await mediaTestBase.getFd('recorder_callback_16.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
onlyVideoConfig.url = fdPath; onlyVideoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(ONLYVIDEO_TYPE, onlyVideoProfile); let trackArray = videoRecorderBase.getTrackArray(ONLYVIDEO_TYPE, onlyVideoProfile,
onlyVideoConfig.videoSourceType);
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_OLNYVIDEO_EVENT, GETSURFACE_EVENT, START_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_OLNYVIDEO_EVENT, GETSURFACE_EVENT, START_EVENT,
PAUSE_EVENT, RESUME_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME * 2, END_EVENT); PAUSE_EVENT, RESUME_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME * 2, END_EVENT);
...@@ -659,7 +693,8 @@ describe('VideoRecorderFuncCallbackTest', function () { ...@@ -659,7 +693,8 @@ describe('VideoRecorderFuncCallbackTest', function () {
fdObject = await mediaTestBase.getFd('recorder_callback_17.mp4'); fdObject = await mediaTestBase.getFd('recorder_callback_17.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
onlyVideoConfig.url = fdPath; onlyVideoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(ONLYVIDEO_TYPE, onlyVideoProfile); let trackArray = videoRecorderBase.getTrackArray(ONLYVIDEO_TYPE, onlyVideoProfile,
onlyVideoConfig.videoSourceType);
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_OLNYVIDEO_EVENT, GETSURFACE_EVENT, START_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_OLNYVIDEO_EVENT, GETSURFACE_EVENT, START_EVENT,
STOP_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT); STOP_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
...@@ -678,7 +713,8 @@ describe('VideoRecorderFuncCallbackTest', function () { ...@@ -678,7 +713,8 @@ describe('VideoRecorderFuncCallbackTest', function () {
fdObject = await mediaTestBase.getFd('recorder_callback_18.mp4'); fdObject = await mediaTestBase.getFd('recorder_callback_18.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
onlyVideoConfig.url = fdPath; onlyVideoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(ONLYVIDEO_TYPE, onlyVideoProfile); let trackArray = videoRecorderBase.getTrackArray(ONLYVIDEO_TYPE, onlyVideoProfile,
onlyVideoConfig.videoSourceType);
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_OLNYVIDEO_EVENT, GETSURFACE_EVENT, START_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_OLNYVIDEO_EVENT, GETSURFACE_EVENT, START_EVENT,
RESET_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT); RESET_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
...@@ -699,7 +735,7 @@ describe('VideoRecorderFuncCallbackTest', function () { ...@@ -699,7 +735,7 @@ describe('VideoRecorderFuncCallbackTest', function () {
videoConfig.url = fdPath; videoConfig.url = fdPath;
configFile.audioSampleRate = 48000; configFile.audioSampleRate = 48000;
videoConfig.rotation = 90; videoConfig.rotation = 90;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT,
START_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT); START_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
...@@ -719,7 +755,7 @@ describe('VideoRecorderFuncCallbackTest', function () { ...@@ -719,7 +755,7 @@ describe('VideoRecorderFuncCallbackTest', function () {
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
videoConfig.rotation = 180; videoConfig.rotation = 180;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT,
CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT); CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
...@@ -739,7 +775,7 @@ describe('VideoRecorderFuncCallbackTest', function () { ...@@ -739,7 +775,7 @@ describe('VideoRecorderFuncCallbackTest', function () {
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
videoConfig.rotation = 270; videoConfig.rotation = 270;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT,
CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT); CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
...@@ -759,7 +795,7 @@ describe('VideoRecorderFuncCallbackTest', function () { ...@@ -759,7 +795,7 @@ describe('VideoRecorderFuncCallbackTest', function () {
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
configFile.videoFrameRate = 20; configFile.videoFrameRate = 20;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT,
CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT); CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
...@@ -779,7 +815,7 @@ describe('VideoRecorderFuncCallbackTest', function () { ...@@ -779,7 +815,7 @@ describe('VideoRecorderFuncCallbackTest', function () {
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
configFile.videoFrameRate = 30; configFile.videoFrameRate = 30;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT,
CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT); CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
...@@ -799,7 +835,7 @@ describe('VideoRecorderFuncCallbackTest', function () { ...@@ -799,7 +835,7 @@ describe('VideoRecorderFuncCallbackTest', function () {
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
configFile.videoFrameRate = 60; configFile.videoFrameRate = 60;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT,
CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT); CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
......
...@@ -32,6 +32,8 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -32,6 +32,8 @@ describe('VideoRecorderFuncPromiseTest', function () {
let cameraID = 0; let cameraID = 0;
let playerSurfaceId = ''; let playerSurfaceId = '';
let pageId = 0; let pageId = 0;
let videoProfiles;
let previewProfiles;
const pagePath1 = 'pages/surfaceTest/surfaceTest'; const pagePath1 = 'pages/surfaceTest/surfaceTest';
const pagePath2 = 'pages/surfaceTest2/surfaceTest2'; const pagePath2 = 'pages/surfaceTest2/surfaceTest2';
let configFile = { let configFile = {
...@@ -50,7 +52,7 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -50,7 +52,7 @@ describe('VideoRecorderFuncPromiseTest', function () {
let videoConfig = { let videoConfig = {
audioSourceType : 1, audioSourceType : 1,
videoSourceType : 0, videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES,
profile : configFile, profile : configFile,
url : 'fd://', url : 'fd://',
rotation : 0, rotation : 0,
...@@ -70,7 +72,7 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -70,7 +72,7 @@ describe('VideoRecorderFuncPromiseTest', function () {
} }
let onlyVideoConfig = { let onlyVideoConfig = {
videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV, videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES,
profile : onlyVideoProfile, profile : onlyVideoProfile,
url : 'fd://', url : 'fd://',
rotation : 0, rotation : 0,
...@@ -87,18 +89,50 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -87,18 +89,50 @@ describe('VideoRecorderFuncPromiseTest', function () {
console.info('[camera] case getCameraManager failed'); console.info('[camera] case getCameraManager failed');
return; return;
} }
cameras = await cameraManager.getCameras(); await cameraManager.getSupportedCameras().then((cameraDevices)=> {
cameras = cameraDevices;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
if (cameras != null) { if (cameras != null) {
console.info('[camera] case getCameras success'); console.info('[camera] case getCameras success');
} else { } else {
console.info('[camera] case getCameras failed'); console.info('[camera] case getCameras failed');
} }
await cameraManager.getSupportedOutputCapability(cameras[0]).then((cameraoutputcapability) => {
console.info('[camera] case getSupportedOutputCapability success');
videoProfiles = cameraoutputcapability.videoProfiles;
videoProfiles[0].size.height = 480;
videoProfiles[0].size.width = 640;
previewProfiles = cameraoutputcapability.previewProfiles;
previewProfiles[0].size.height = 480;
previewProfiles[0].size.width = 640;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback)
if (previewProfiles[0].format == camera.CameraFormat.CAMERA_FORMAT_YUV_420_SP) {
console.info('[camera] case format is VIDEO_SOURCE_TYPE_SURFACE_YUV');
videoConfig.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV;
onlyVideoConfig.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV;
} else {
console.info('[camera] case format is VIDEO_SOURCE_TYPE_SURFACE_ES');
videoConfig.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES;
onlyVideoConfig.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES;
}
console.info('beforeAll case'); console.info('beforeAll case');
}) })
beforeEach(async function () { beforeEach(async function () {
await mediaTestBase.toNewPage(pagePath1, pagePath2, pageId); await mediaTestBase.toNewPage(pagePath1, pagePath2, pageId);
pageId = (pageId + 1) % 2; pageId = (pageId + 1) % 2;
if (previewProfiles[0].format == camera.CameraFormat.CAMERA_FORMAT_YUV_420_SP) {
if (pageId == 0) {
configFile.videoCodec = media.CodecMimeType.VIDEO_MPEG4;
onlyVideoProfile.videoCodec = media.CodecMimeType.VIDEO_MPEG4;
} else {
configFile.videoCodec = media.CodecMimeType.VIDEO_AVC;
onlyVideoProfile.videoCodec = media.CodecMimeType.VIDEO_AVC;
}
} else {
configFile.videoCodec = media.CodecMimeType.VIDEO_MPEG4;
onlyVideoProfile.videoCodec = media.CodecMimeType.VIDEO_MPEG4;
}
await mediaTestBase.msleepAsync(1000).then( await mediaTestBase.msleepAsync(1000).then(
() => {}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); () => {}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
playerSurfaceId = globalThis.value; playerSurfaceId = globalThis.value;
...@@ -125,80 +159,9 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -125,80 +159,9 @@ describe('VideoRecorderFuncPromiseTest', function () {
}); });
} }
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_ALL_CAMERAS_0100
* @tc.name : 01.all cameras recordering (promise)
* @tc.desc : Video recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_ALL_CAMERAS_0100', 0, async function (done) {
for (let i = 0; i < 2; i++) {
cameraID = i;
console.info('[camera] case cameraID is :' + cameraID);
let videoRecorder = undefined;
let surfaceID = '';
let videoOutput;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile);
fdObject = await mediaTestBase.getFd('recorder_promise_cameraID_' + cameraID + '.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') {
videoRecorder = recorder;
expect(videoRecorder.state).assertEqual('idle');
} else {
console.info('case recordr is undefined!!');
expect().assertFail();
}
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.prepare(videoConfig).then(() => {
console.info('case prepare called');
expect(videoRecorder.state).assertEqual('prepared');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.getInputSurface().then((outPutSurface) => {
console.info('case getInputSurface called');
surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await camera.createVideoOutput(surfaceID);
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager, cameras, cameraID);
await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => {
expect(videoRecorder.state).assertEqual('playing');
console.info('case start called');
mediaTestBase.msleep(RECORDER_TIME);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.stop().then(() => {
expect(videoRecorder.state).assertEqual('stopped');
console.info('case stop called');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.release().then(() => {
expect(videoRecorder.state).assertEqual('idle');
console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop();
await videoOutput.release().then(() => {
console.info('[camera] case videoOutput release success');
});
videoOutput = undefined;
await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
}
done();
})
/* * /* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_0100 * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_0100
* @tc.name : 02.start->release (promise) * @tc.name : 01.start->release (promise)
* @tc.desc : Video recordr control test * @tc.desc : Video recordr control test
* @tc.size : MediumTest * @tc.size : MediumTest
* @tc.type : Function * @tc.type : Function
...@@ -208,7 +171,8 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -208,7 +171,8 @@ describe('VideoRecorderFuncPromiseTest', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let previewOutput;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
fdObject = await mediaTestBase.getFd('recorder_promise_01.mp4'); fdObject = await mediaTestBase.getFd('recorder_promise_01.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
...@@ -232,8 +196,11 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -232,8 +196,11 @@ describe('VideoRecorderFuncPromiseTest', function () {
expect(videoRecorder.state).assertEqual('prepared'); expect(videoRecorder.state).assertEqual('prepared');
surfaceID = outPutSurface; surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await camera.createVideoOutput(surfaceID);
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager, cameras, cameraID); videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput); await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => { await videoRecorder.start().then(() => {
console.info('case start called'); console.info('case start called');
...@@ -246,10 +213,6 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -246,10 +213,6 @@ describe('VideoRecorderFuncPromiseTest', function () {
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop(); await videoOutput.stop();
await videoOutput.release().then(() => {
console.info('[camera] case videoOutput release success');
});
videoOutput = undefined;
await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
...@@ -268,7 +231,8 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -268,7 +231,8 @@ describe('VideoRecorderFuncPromiseTest', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let previewOutput;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
fdObject = await mediaTestBase.getFd('recorder_promise_02.mp4'); fdObject = await mediaTestBase.getFd('recorder_promise_02.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
...@@ -292,8 +256,10 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -292,8 +256,10 @@ describe('VideoRecorderFuncPromiseTest', function () {
expect(videoRecorder.state).assertEqual('prepared'); expect(videoRecorder.state).assertEqual('prepared');
surfaceID = outPutSurface; surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await camera.createVideoOutput(surfaceID); videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager, cameras, cameraID); previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput); await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => { await videoRecorder.start().then(() => {
console.info('case start called'); console.info('case start called');
...@@ -311,10 +277,6 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -311,10 +277,6 @@ describe('VideoRecorderFuncPromiseTest', function () {
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop(); await videoOutput.stop();
await videoOutput.release().then(() => {
console.info('[camera] case videoOutput release success');
});
videoOutput = undefined;
await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
...@@ -333,7 +295,8 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -333,7 +295,8 @@ describe('VideoRecorderFuncPromiseTest', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let previewOutput;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
fdObject = await mediaTestBase.getFd('recorder_promise_03.mp4'); fdObject = await mediaTestBase.getFd('recorder_promise_03.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
...@@ -357,8 +320,10 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -357,8 +320,10 @@ describe('VideoRecorderFuncPromiseTest', function () {
console.info('case getInputSurface called'); console.info('case getInputSurface called');
surfaceID = outPutSurface; surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await camera.createVideoOutput(surfaceID); videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager, cameras, cameraID); previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput); await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => { await videoRecorder.start().then(() => {
expect(videoRecorder.state).assertEqual('playing'); expect(videoRecorder.state).assertEqual('playing');
...@@ -385,10 +350,6 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -385,10 +350,6 @@ describe('VideoRecorderFuncPromiseTest', function () {
console.info('case release '); console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop(); await videoOutput.stop();
await videoOutput.release().then(() => {
console.info('[camera] case videoOutput release success');
});
videoOutput = undefined;
await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME * 2, trackArray, playerSurfaceId); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME * 2, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
...@@ -407,7 +368,8 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -407,7 +368,8 @@ describe('VideoRecorderFuncPromiseTest', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let previewOutput;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
fdObject = await mediaTestBase.getFd('recorder_promise_04.mp4'); fdObject = await mediaTestBase.getFd('recorder_promise_04.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
...@@ -431,8 +393,10 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -431,8 +393,10 @@ describe('VideoRecorderFuncPromiseTest', function () {
expect(videoRecorder.state).assertEqual('prepared'); expect(videoRecorder.state).assertEqual('prepared');
surfaceID = outPutSurface; surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await camera.createVideoOutput(surfaceID); videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager, cameras, cameraID); previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId);
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput); await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => { await videoRecorder.start().then(() => {
console.info('case start called'); console.info('case start called');
...@@ -444,15 +408,11 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -444,15 +408,11 @@ describe('VideoRecorderFuncPromiseTest', function () {
expect(videoRecorder.state).assertEqual('stopped'); expect(videoRecorder.state).assertEqual('stopped');
console.info('case stop called'); console.info('case stop called');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop();
await videoRecorder.release().then(() => { await videoRecorder.release().then(() => {
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
console.info('case release '); console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.release().then(() => { await videoOutput.stop();
console.info('[camera] case videoOutput release success');
});
videoOutput = undefined;
await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
...@@ -471,7 +431,8 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -471,7 +431,8 @@ describe('VideoRecorderFuncPromiseTest', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let previewOutput;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
fdObject = await mediaTestBase.getFd('recorder_promise_05.mp4'); fdObject = await mediaTestBase.getFd('recorder_promise_05.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
...@@ -495,8 +456,10 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -495,8 +456,10 @@ describe('VideoRecorderFuncPromiseTest', function () {
console.info('case getInputSurface called'); console.info('case getInputSurface called');
surfaceID = outPutSurface; surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await camera.createVideoOutput(surfaceID); videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager, cameras, cameraID); previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput); await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => { await videoRecorder.start().then(() => {
console.info('case start called'); console.info('case start called');
...@@ -508,15 +471,11 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -508,15 +471,11 @@ describe('VideoRecorderFuncPromiseTest', function () {
console.info('case reset called'); console.info('case reset called');
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop();
await videoRecorder.release().then(() => { await videoRecorder.release().then(() => {
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
console.info('case release '); console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.release().then(() => { await videoOutput.stop();
console.info('[camera] case videoOutput release success');
});
videoOutput = undefined;
await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
...@@ -535,7 +494,8 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -535,7 +494,8 @@ describe('VideoRecorderFuncPromiseTest', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let previewOutput;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
fdObject = await mediaTestBase.getFd('recorder_promise_06.mp4'); fdObject = await mediaTestBase.getFd('recorder_promise_06.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
...@@ -559,8 +519,10 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -559,8 +519,10 @@ describe('VideoRecorderFuncPromiseTest', function () {
console.info('case getInputSurface called'); console.info('case getInputSurface called');
surfaceID = outPutSurface; surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await camera.createVideoOutput(surfaceID); videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager, cameras, cameraID); previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput); await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => { await videoRecorder.start().then(() => {
console.info('case start called'); console.info('case start called');
...@@ -584,11 +546,6 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -584,11 +546,6 @@ describe('VideoRecorderFuncPromiseTest', function () {
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
console.info('case release '); console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.release().then(() => {
console.info('[camera] case videoOutput release success');
});
videoOutput = undefined;
await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
...@@ -607,7 +564,8 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -607,7 +564,8 @@ describe('VideoRecorderFuncPromiseTest', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let previewOutput;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
fdObject = await mediaTestBase.getFd('recorder_promise_07.mp4'); fdObject = await mediaTestBase.getFd('recorder_promise_07.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
...@@ -631,8 +589,10 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -631,8 +589,10 @@ describe('VideoRecorderFuncPromiseTest', function () {
console.info('case getInputSurface called'); console.info('case getInputSurface called');
surfaceID = outPutSurface; surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await camera.createVideoOutput(surfaceID); videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager, cameras, cameraID); previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput); await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => { await videoRecorder.start().then(() => {
console.info('case start called'); console.info('case start called');
...@@ -656,10 +616,6 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -656,10 +616,6 @@ describe('VideoRecorderFuncPromiseTest', function () {
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
console.info('case release '); console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.release().then(() => {
console.info('[camera] case videoOutput release success');
});
videoOutput = undefined;
await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
...@@ -678,7 +634,8 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -678,7 +634,8 @@ describe('VideoRecorderFuncPromiseTest', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let previewOutput;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
fdObject = await mediaTestBase.getFd('recorder_promise_08.mp4'); fdObject = await mediaTestBase.getFd('recorder_promise_08.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
...@@ -702,8 +659,10 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -702,8 +659,10 @@ describe('VideoRecorderFuncPromiseTest', function () {
console.info('case getInputSurface called'); console.info('case getInputSurface called');
surfaceID = outPutSurface; surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await camera.createVideoOutput(surfaceID); videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager, cameras, cameraID); previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput); await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => { await videoRecorder.start().then(() => {
console.info('case start called'); console.info('case start called');
...@@ -735,10 +694,6 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -735,10 +694,6 @@ describe('VideoRecorderFuncPromiseTest', function () {
console.info('case release '); console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop(); await videoOutput.stop();
await videoOutput.release().then(() => {
console.info('[camera] case videoOutput release success');
});
videoOutput = undefined;
await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME * 2, trackArray, playerSurfaceId); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME * 2, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
...@@ -757,7 +712,8 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -757,7 +712,8 @@ describe('VideoRecorderFuncPromiseTest', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let previewOutput;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
fdObject = await mediaTestBase.getFd('recorder_promise_09.mp4'); fdObject = await mediaTestBase.getFd('recorder_promise_09.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
...@@ -781,8 +737,10 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -781,8 +737,10 @@ describe('VideoRecorderFuncPromiseTest', function () {
console.info('case getInputSurface called'); console.info('case getInputSurface called');
surfaceID = outPutSurface; surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await camera.createVideoOutput(surfaceID); videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager, cameras, cameraID); previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput); await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => { await videoRecorder.start().then(() => {
console.info('case start called'); console.info('case start called');
...@@ -813,10 +771,6 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -813,10 +771,6 @@ describe('VideoRecorderFuncPromiseTest', function () {
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
console.info('case release '); console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.release().then(() => {
console.info('[camera] case videoOutput release success');
});
videoOutput = undefined;
await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME * 2, trackArray, playerSurfaceId); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME * 2, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
...@@ -836,13 +790,14 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -836,13 +790,14 @@ describe('VideoRecorderFuncPromiseTest', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
let previewOutput;
fdObject = await mediaTestBase.getFd('recorder_promise_10.mp4'); fdObject = await mediaTestBase.getFd('recorder_promise_10.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
configFile.audioBitrate = 8000; configFile.audioBitrate = 8000;
configFile.audioSampleRate = 8000; configFile.audioSampleRate = 8000;
configFile.videoBitrate = 8000; configFile.videoBitrate = 8000;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') { if (typeof (recorder) != 'undefined') {
...@@ -863,8 +818,10 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -863,8 +818,10 @@ describe('VideoRecorderFuncPromiseTest', function () {
expect(videoRecorder.state).assertEqual('prepared'); expect(videoRecorder.state).assertEqual('prepared');
surfaceID = outPutSurface; surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await camera.createVideoOutput(surfaceID); videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager, cameras, cameraID); previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput); await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => { await videoRecorder.start().then(() => {
console.info('case start called'); console.info('case start called');
...@@ -882,10 +839,6 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -882,10 +839,6 @@ describe('VideoRecorderFuncPromiseTest', function () {
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
console.info('case release '); console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.release().then(() => {
console.info('[camera] case videoOutput release success');
});
videoOutput = undefined;
await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
...@@ -905,13 +858,14 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -905,13 +858,14 @@ describe('VideoRecorderFuncPromiseTest', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
let previewOutput;
fdObject = await mediaTestBase.getFd('recorder_promise_11.mp4'); fdObject = await mediaTestBase.getFd('recorder_promise_11.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
configFile.audioBitrate = 16000; configFile.audioBitrate = 16000;
configFile.audioSampleRate = 32000; configFile.audioSampleRate = 32000;
configFile.videoBitrate = 16000; configFile.videoBitrate = 16000;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') { if (typeof (recorder) != 'undefined') {
...@@ -932,8 +886,10 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -932,8 +886,10 @@ describe('VideoRecorderFuncPromiseTest', function () {
expect(videoRecorder.state).assertEqual('prepared'); expect(videoRecorder.state).assertEqual('prepared');
surfaceID = outPutSurface; surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await camera.createVideoOutput(surfaceID); videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager, cameras, cameraID); previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput); await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => { await videoRecorder.start().then(() => {
console.info('case start called'); console.info('case start called');
...@@ -951,10 +907,6 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -951,10 +907,6 @@ describe('VideoRecorderFuncPromiseTest', function () {
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
console.info('case release '); console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.release().then(() => {
console.info('[camera] case videoOutput release success');
});
videoOutput = undefined;
await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
...@@ -974,13 +926,14 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -974,13 +926,14 @@ describe('VideoRecorderFuncPromiseTest', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
let previewOutput;
fdObject = await mediaTestBase.getFd('recorder_promise_12.mp4'); fdObject = await mediaTestBase.getFd('recorder_promise_12.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
configFile.audioBitrate = 32000; configFile.audioBitrate = 32000;
configFile.audioSampleRate = 44100; configFile.audioSampleRate = 44100;
configFile.videoBitrate = 32000; configFile.videoBitrate = 32000;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') { if (typeof (recorder) != 'undefined') {
...@@ -1001,8 +954,10 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1001,8 +954,10 @@ describe('VideoRecorderFuncPromiseTest', function () {
expect(videoRecorder.state).assertEqual('prepared'); expect(videoRecorder.state).assertEqual('prepared');
surfaceID = outPutSurface; surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await camera.createVideoOutput(surfaceID); videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager, cameras, cameraID); previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput); await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => { await videoRecorder.start().then(() => {
console.info('case start called'); console.info('case start called');
...@@ -1020,10 +975,6 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1020,10 +975,6 @@ describe('VideoRecorderFuncPromiseTest', function () {
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
console.info('case release '); console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.release().then(() => {
console.info('[camera] case videoOutput release success');
});
videoOutput = undefined;
await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
...@@ -1043,13 +994,14 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1043,13 +994,14 @@ describe('VideoRecorderFuncPromiseTest', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
let previewOutput;
fdObject = await mediaTestBase.getFd('recorder_promise_13.mp4'); fdObject = await mediaTestBase.getFd('recorder_promise_13.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
configFile.audioBitrate = 112000; configFile.audioBitrate = 112000;
configFile.audioSampleRate = 96000; configFile.audioSampleRate = 96000;
configFile.videoBitrate = 112000; configFile.videoBitrate = 112000;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') { if (typeof (recorder) != 'undefined') {
...@@ -1070,8 +1022,10 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1070,8 +1022,10 @@ describe('VideoRecorderFuncPromiseTest', function () {
expect(videoRecorder.state).assertEqual('prepared'); expect(videoRecorder.state).assertEqual('prepared');
surfaceID = outPutSurface; surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await camera.createVideoOutput(surfaceID); videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager, cameras, cameraID); previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput); await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => { await videoRecorder.start().then(() => {
console.info('case start called'); console.info('case start called');
...@@ -1089,10 +1043,6 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1089,10 +1043,6 @@ describe('VideoRecorderFuncPromiseTest', function () {
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
console.info('case release '); console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.release().then(() => {
console.info('[camera] case videoOutput release success');
});
videoOutput = undefined;
await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
...@@ -1111,10 +1061,12 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1111,10 +1061,12 @@ describe('VideoRecorderFuncPromiseTest', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
let previewOutput;
fdObject = await mediaTestBase.getFd('recorder_promise_14.mp4'); fdObject = await mediaTestBase.getFd('recorder_promise_14.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
onlyVideoConfig.url = fdPath; onlyVideoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(ONLYVIDEO_TYPE, onlyVideoProfile); let trackArray = videoRecorderBase.getTrackArray(ONLYVIDEO_TYPE, onlyVideoProfile,
onlyVideoConfig.videoSourceType);
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') { if (typeof (recorder) != 'undefined') {
...@@ -1134,8 +1086,10 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1134,8 +1086,10 @@ describe('VideoRecorderFuncPromiseTest', function () {
await videoRecorder.getInputSurface().then((outPutSurface) => { await videoRecorder.getInputSurface().then((outPutSurface) => {
surfaceID = outPutSurface; surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await camera.createVideoOutput(surfaceID); videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager, cameras, cameraID); previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput); await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => { await videoRecorder.start().then(() => {
expect(videoRecorder.state).assertEqual('playing'); expect(videoRecorder.state).assertEqual('playing');
...@@ -1147,10 +1101,6 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1147,10 +1101,6 @@ describe('VideoRecorderFuncPromiseTest', function () {
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
console.info('case release '); console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.release().then(() => {
console.info('[camera] case videoOutput release success');
});
videoOutput = undefined;
await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
...@@ -1169,10 +1119,12 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1169,10 +1119,12 @@ describe('VideoRecorderFuncPromiseTest', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
let previewOutput;
fdObject = await mediaTestBase.getFd('recorder_promise_15.mp4'); fdObject = await mediaTestBase.getFd('recorder_promise_15.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
onlyVideoConfig.url = fdPath; onlyVideoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(ONLYVIDEO_TYPE, onlyVideoProfile); let trackArray = videoRecorderBase.getTrackArray(ONLYVIDEO_TYPE, onlyVideoProfile,
onlyVideoConfig.videoSourceType);
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') { if (typeof (recorder) != 'undefined') {
...@@ -1194,8 +1146,10 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1194,8 +1146,10 @@ describe('VideoRecorderFuncPromiseTest', function () {
expect(videoRecorder.state).assertEqual('prepared'); expect(videoRecorder.state).assertEqual('prepared');
surfaceID = outPutSurface; surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await camera.createVideoOutput(surfaceID); videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager, cameras, cameraID); previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput); await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => { await videoRecorder.start().then(() => {
console.info('case start called'); console.info('case start called');
...@@ -1214,10 +1168,6 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1214,10 +1168,6 @@ describe('VideoRecorderFuncPromiseTest', function () {
console.info('case release '); console.info('case release ');
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.release().then(() => {
console.info('[camera] case videoOutput release success');
});
videoOutput = undefined;
await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
...@@ -1236,10 +1186,12 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1236,10 +1186,12 @@ describe('VideoRecorderFuncPromiseTest', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
let previewOutput;
fdObject = await mediaTestBase.getFd('recorder_promise_16.mp4'); fdObject = await mediaTestBase.getFd('recorder_promise_16.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
onlyVideoConfig.url = fdPath; onlyVideoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(ONLYVIDEO_TYPE, onlyVideoProfile); let trackArray = videoRecorderBase.getTrackArray(ONLYVIDEO_TYPE, onlyVideoProfile,
onlyVideoConfig.videoSourceType);
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') { if (typeof (recorder) != 'undefined') {
...@@ -1260,8 +1212,10 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1260,8 +1212,10 @@ describe('VideoRecorderFuncPromiseTest', function () {
console.info('case getInputSurface called'); console.info('case getInputSurface called');
surfaceID = outPutSurface; surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await camera.createVideoOutput(surfaceID); videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager, cameras, cameraID); previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput); await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => { await videoRecorder.start().then(() => {
expect(videoRecorder.state).assertEqual('playing'); expect(videoRecorder.state).assertEqual('playing');
...@@ -1287,10 +1241,6 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1287,10 +1241,6 @@ describe('VideoRecorderFuncPromiseTest', function () {
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
console.info('case release '); console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.release().then(() => {
console.info('[camera] case videoOutput release success');
});
videoOutput = undefined;
await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME * 2, trackArray, playerSurfaceId); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME * 2, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
...@@ -1309,10 +1259,12 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1309,10 +1259,12 @@ describe('VideoRecorderFuncPromiseTest', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
let previewOutput;
fdObject = await mediaTestBase.getFd('recorder_promise_17.mp4'); fdObject = await mediaTestBase.getFd('recorder_promise_17.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
onlyVideoConfig.url = fdPath; onlyVideoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(ONLYVIDEO_TYPE, onlyVideoProfile); let trackArray = videoRecorderBase.getTrackArray(ONLYVIDEO_TYPE, onlyVideoProfile,
onlyVideoConfig.videoSourceType);
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') { if (typeof (recorder) != 'undefined') {
...@@ -1333,8 +1285,10 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1333,8 +1285,10 @@ describe('VideoRecorderFuncPromiseTest', function () {
expect(videoRecorder.state).assertEqual('prepared'); expect(videoRecorder.state).assertEqual('prepared');
surfaceID = outPutSurface; surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await camera.createVideoOutput(surfaceID); videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager, cameras, cameraID); previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput); await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => { await videoRecorder.start().then(() => {
console.info('case start called'); console.info('case start called');
...@@ -1351,10 +1305,6 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1351,10 +1305,6 @@ describe('VideoRecorderFuncPromiseTest', function () {
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
console.info('case release '); console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.release().then(() => {
console.info('[camera] case videoOutput release success');
});
videoOutput = undefined;
await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
...@@ -1373,10 +1323,12 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1373,10 +1323,12 @@ describe('VideoRecorderFuncPromiseTest', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
let previewOutput;
fdObject = await mediaTestBase.getFd('recorder_promise_18.mp4'); fdObject = await mediaTestBase.getFd('recorder_promise_18.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
onlyVideoConfig.url = fdPath; onlyVideoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(ONLYVIDEO_TYPE, onlyVideoProfile); let trackArray = videoRecorderBase.getTrackArray(ONLYVIDEO_TYPE, onlyVideoProfile,
onlyVideoConfig.videoSourceType);
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') { if (typeof (recorder) != 'undefined') {
...@@ -1397,8 +1349,10 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1397,8 +1349,10 @@ describe('VideoRecorderFuncPromiseTest', function () {
console.info('case getInputSurface called'); console.info('case getInputSurface called');
surfaceID = outPutSurface; surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await camera.createVideoOutput(surfaceID); videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager, cameras, cameraID); previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput); await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => { await videoRecorder.start().then(() => {
console.info('case start called'); console.info('case start called');
...@@ -1415,10 +1369,6 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1415,10 +1369,6 @@ describe('VideoRecorderFuncPromiseTest', function () {
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
console.info('case release '); console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.release().then(() => {
console.info('[camera] case videoOutput release success');
});
videoOutput = undefined;
await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
...@@ -1437,12 +1387,13 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1437,12 +1387,13 @@ describe('VideoRecorderFuncPromiseTest', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
let previewOutput;
fdObject = await mediaTestBase.getFd('recorder_promise_19.mp4'); fdObject = await mediaTestBase.getFd('recorder_promise_19.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
configFile.audioSampleRate = 48000; configFile.audioSampleRate = 48000;
videoConfig.rotation = 90; videoConfig.rotation = 90;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') { if (typeof (recorder) != 'undefined') {
...@@ -1461,8 +1412,10 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1461,8 +1412,10 @@ describe('VideoRecorderFuncPromiseTest', function () {
await videoRecorder.getInputSurface().then((outPutSurface) => { await videoRecorder.getInputSurface().then((outPutSurface) => {
surfaceID = outPutSurface; surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await camera.createVideoOutput(surfaceID); videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager, cameras, cameraID); previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput); await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => { await videoRecorder.start().then(() => {
expect(videoRecorder.state).assertEqual('playing'); expect(videoRecorder.state).assertEqual('playing');
...@@ -1474,10 +1427,6 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1474,10 +1427,6 @@ describe('VideoRecorderFuncPromiseTest', function () {
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
console.info('case release '); console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.release().then(() => {
console.info('[camera] case videoOutput release success');
});
videoOutput = undefined;
await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
...@@ -1496,11 +1445,12 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1496,11 +1445,12 @@ describe('VideoRecorderFuncPromiseTest', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
let previewOutput;
fdObject = await mediaTestBase.getFd('recorder_promise_20.mp4'); fdObject = await mediaTestBase.getFd('recorder_promise_20.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
videoConfig.rotation = 180; videoConfig.rotation = 180;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') { if (typeof (recorder) != 'undefined') {
...@@ -1519,8 +1469,10 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1519,8 +1469,10 @@ describe('VideoRecorderFuncPromiseTest', function () {
await videoRecorder.getInputSurface().then((outPutSurface) => { await videoRecorder.getInputSurface().then((outPutSurface) => {
surfaceID = outPutSurface; surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await camera.createVideoOutput(surfaceID); videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager, cameras, cameraID); previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput); await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => { await videoRecorder.start().then(() => {
expect(videoRecorder.state).assertEqual('playing'); expect(videoRecorder.state).assertEqual('playing');
...@@ -1532,10 +1484,6 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1532,10 +1484,6 @@ describe('VideoRecorderFuncPromiseTest', function () {
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
console.info('case release '); console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.release().then(() => {
console.info('[camera] case videoOutput release success');
});
videoOutput = undefined;
await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
...@@ -1554,11 +1502,12 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1554,11 +1502,12 @@ describe('VideoRecorderFuncPromiseTest', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
let previewOutput;
fdObject = await mediaTestBase.getFd('recorder_promise_21.mp4'); fdObject = await mediaTestBase.getFd('recorder_promise_21.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
videoConfig.rotation = 270; videoConfig.rotation = 270;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') { if (typeof (recorder) != 'undefined') {
...@@ -1577,8 +1526,10 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1577,8 +1526,10 @@ describe('VideoRecorderFuncPromiseTest', function () {
await videoRecorder.getInputSurface().then((outPutSurface) => { await videoRecorder.getInputSurface().then((outPutSurface) => {
surfaceID = outPutSurface; surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await camera.createVideoOutput(surfaceID); videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager, cameras, cameraID); previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput); await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => { await videoRecorder.start().then(() => {
expect(videoRecorder.state).assertEqual('playing'); expect(videoRecorder.state).assertEqual('playing');
...@@ -1590,10 +1541,6 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1590,10 +1541,6 @@ describe('VideoRecorderFuncPromiseTest', function () {
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
console.info('case release '); console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.release().then(() => {
console.info('[camera] case videoOutput release success');
});
videoOutput = undefined;
await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
...@@ -1612,11 +1559,12 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1612,11 +1559,12 @@ describe('VideoRecorderFuncPromiseTest', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
let previewOutput;
fdObject = await mediaTestBase.getFd('recorder_promise_22.mp4'); fdObject = await mediaTestBase.getFd('recorder_promise_22.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
configFile.videoFrameRate = 20; configFile.videoFrameRate = 20;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') { if (typeof (recorder) != 'undefined') {
...@@ -1635,8 +1583,10 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1635,8 +1583,10 @@ describe('VideoRecorderFuncPromiseTest', function () {
await videoRecorder.getInputSurface().then((outPutSurface) => { await videoRecorder.getInputSurface().then((outPutSurface) => {
surfaceID = outPutSurface; surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await camera.createVideoOutput(surfaceID); videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager, cameras, cameraID); previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput); await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => { await videoRecorder.start().then(() => {
expect(videoRecorder.state).assertEqual('playing'); expect(videoRecorder.state).assertEqual('playing');
...@@ -1648,10 +1598,6 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1648,10 +1598,6 @@ describe('VideoRecorderFuncPromiseTest', function () {
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
console.info('case release '); console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.release().then(() => {
console.info('[camera] case videoOutput release success');
});
videoOutput = undefined;
await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
...@@ -1670,11 +1616,12 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1670,11 +1616,12 @@ describe('VideoRecorderFuncPromiseTest', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
let previewOutput;
fdObject = await mediaTestBase.getFd('recorder_promise_23.mp4'); fdObject = await mediaTestBase.getFd('recorder_promise_23.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
configFile.videoFrameRate = 30; configFile.videoFrameRate = 30;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') { if (typeof (recorder) != 'undefined') {
...@@ -1693,8 +1640,10 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1693,8 +1640,10 @@ describe('VideoRecorderFuncPromiseTest', function () {
await videoRecorder.getInputSurface().then((outPutSurface) => { await videoRecorder.getInputSurface().then((outPutSurface) => {
surfaceID = outPutSurface; surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await camera.createVideoOutput(surfaceID); videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager, cameras, cameraID); previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput); await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => { await videoRecorder.start().then(() => {
expect(videoRecorder.state).assertEqual('playing'); expect(videoRecorder.state).assertEqual('playing');
...@@ -1706,10 +1655,6 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1706,10 +1655,6 @@ describe('VideoRecorderFuncPromiseTest', function () {
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
console.info('case release '); console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.release().then(() => {
console.info('[camera] case videoOutput release success');
});
videoOutput = undefined;
await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
...@@ -1728,11 +1673,12 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1728,11 +1673,12 @@ describe('VideoRecorderFuncPromiseTest', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
let previewOutput;
fdObject = await mediaTestBase.getFd('recorder_promise_24.mp4'); fdObject = await mediaTestBase.getFd('recorder_promise_24.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString(); fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath; videoConfig.url = fdPath;
configFile.videoFrameRate = 60; configFile.videoFrameRate = 60;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') { if (typeof (recorder) != 'undefined') {
...@@ -1751,8 +1697,10 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1751,8 +1697,10 @@ describe('VideoRecorderFuncPromiseTest', function () {
await videoRecorder.getInputSurface().then((outPutSurface) => { await videoRecorder.getInputSurface().then((outPutSurface) => {
surfaceID = outPutSurface; surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await camera.createVideoOutput(surfaceID); videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager, cameras, cameraID); previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput); await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => { await videoRecorder.start().then(() => {
expect(videoRecorder.state).assertEqual('playing'); expect(videoRecorder.state).assertEqual('playing');
...@@ -1764,10 +1712,6 @@ describe('VideoRecorderFuncPromiseTest', function () { ...@@ -1764,10 +1712,6 @@ describe('VideoRecorderFuncPromiseTest', function () {
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
console.info('case release '); console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.release().then(() => {
console.info('[camera] case videoOutput release success');
});
videoOutput = undefined;
await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册