未验证 提交 9897505e 编写于 作者: O openharmony_ci 提交者: Gitee

!3780 补充关闭打开文件的fd操作

Merge pull request !3780 from ling990/ling990
......@@ -2145,7 +2145,6 @@ describe('AudioDecoderFormatCompatibilityPromise', function () {
audioDecodeProcessor = null;
}, failCallback).catch(failCatch);
}
await closeFdWrite();
})
afterAll(function() {
......@@ -2189,6 +2188,7 @@ describe('AudioDecoderFormatCompatibilityPromise', function () {
audioDecodeProcessor = null;
}, failCallback).catch(failCatch);
}
await closeFdRead();
await closeFdWrite();
}
......@@ -2233,6 +2233,12 @@ describe('AudioDecoderFormatCompatibilityPromise', function () {
}
}
async function closeFdRead() {
await fileio.close(fdRead).then(() => {
console.info('[fileio] case close fdRead success, fd is ' + fdRead);
}, failCallback).catch(failCatch);
}
function writeFile(buf, len) {
try{
let res = fileio.writeSync(fdWrite, buf, {length: len});
......@@ -2255,7 +2261,7 @@ describe('AudioDecoderFormatCompatibilityPromise', function () {
function getContent(buf, len) {
console.info("case start get content");
let lengthreal = -1;
lengthreal = readStreamSync.readSync(buf,{length:len});
lengthreal = fileio.readSync(fdRead, buf, {length:len});
console.info('case lengthreal is :' + lengthreal);
}
......@@ -2456,7 +2462,6 @@ describe('AudioDecoderFormatCompatibilityPromise', function () {
}, failCallback).catch(failCatch);
await audioDecodeProcessor.configure(mediaDescription).then(() => {
console.log("configure success");
readFile(readPath);
}, failCallback).catch(failCatch);
setCallback(
function(){eventEmitter.emit('nextStep', done);}, done
......
......@@ -75,7 +75,6 @@ describe('AudioEncoderFormatCompatibilityPromise', function () {
audioEncodeProcessor = null;
}, failCallback).catch(failCatch);
}
await closeFdWrite();
})
afterAll(function() {
......@@ -139,6 +138,7 @@ describe('AudioEncoderFormatCompatibilityPromise', function () {
audioEncodeProcessor = null;
}, failCallback).catch(failCatch);
}
await closeFdRead();
await closeFdWrite();
}
......@@ -171,6 +171,12 @@ describe('AudioEncoderFormatCompatibilityPromise', function () {
})
}
async function closeFdRead() {
await fileio.close(fdRead).then(() => {
console.info('[fileio] case close fdRead success, fd is ' + fdRead);
}, failCallback).catch(failCatch);
}
async function closeFdWrite() {
if (fileAssetWrite != null) {
await fileAssetWrite[0].close(fdWrite).then(() => {
......@@ -216,7 +222,7 @@ describe('AudioEncoderFormatCompatibilityPromise', function () {
function getContent(buf, len) {
console.info("case start get content");
let lengthreal = -1;
lengthreal = readStreamSync.readSync(buf,{length:len});
lengthreal = fileio.readSync(fdRead, buf, {length:len});
console.info('case lengthreal is :' + lengthreal);
}
......@@ -419,7 +425,6 @@ describe('AudioEncoderFormatCompatibilityPromise', function () {
}, failCallback).catch(failCatch);
await audioEncodeProcessor.configure(mediaDescription).then(() => {
console.info("case configure success");
readFile(readPath);
}, failCallback).catch(failCatch);
setCallback(function(){eventEmitter.emit('nextStep', done);}, done);
await audioEncodeProcessor.prepare().then(() => {
......
......@@ -155,7 +155,7 @@ describe('AudioDecoderFormatCallback', function () {
function getContent(buf, len) {
console.info("case start get content");
let lengthreal = -1;
lengthreal = readStreamSync.readSync(buf,{length:len});
lengthreal = fileio.readSync(fdRead, buf, {length:len});
console.info('case lengthreal is :' + lengthreal);
}
......@@ -213,6 +213,7 @@ describe('AudioDecoderFormatCallback', function () {
expect(err).assertUndefined();
console.log("case release success");
audioDecodeProcessor = null;
await fileio.close(fdRead);
await closeFdWrite();
done();
})
......@@ -349,7 +350,6 @@ describe('AudioDecoderFormatCallback', function () {
audioDecodeProcessor.configure(mediaDescription, (err) => {
expect(err).assertUndefined();
console.info(`case configure 1`);
readFile(AUDIOPATH1);
eventEmitter.emit('prepare');
})
});
......@@ -469,7 +469,6 @@ describe('AudioDecoderFormatCallback', function () {
audioDecodeProcessor.configure(mediaDescription, (err) => {
expect(err).assertUndefined();
console.info(`case configure 1`);
readFile(AUDIOPATH1);
eventEmitter.emit('prepare');
})
});
......@@ -546,7 +545,6 @@ describe('AudioDecoderFormatCallback', function () {
audioDecodeProcessor.configure(mediaDescription, (err) => {
expect(err).assertUndefined();
console.info(`case configure 1`);
readFile(AUDIOPATH2);
eventEmitter.emit('prepare');
})
});
......@@ -623,7 +621,6 @@ describe('AudioDecoderFormatCallback', function () {
audioDecodeProcessor.configure(mediaDescription, (err) => {
expect(err).assertUndefined();
console.info(`case configure 1`);
readFile(AUDIOPATH2);
eventEmitter.emit('prepare');
})
});
......@@ -687,7 +684,6 @@ describe('AudioDecoderFormatCallback', function () {
audioDecodeProcessor.configure(mediaDescription, (err) => {
expect(err).assertUndefined();
console.info(`case configure 1`);
readFile(AUDIOPATH3);
eventEmitter.emit('prepare');
})
});
......@@ -751,7 +747,6 @@ describe('AudioDecoderFormatCallback', function () {
audioDecodeProcessor.configure(mediaDescription, (err) => {
expect(err).assertUndefined();
console.info(`case configure 1`);
readFile(AUDIOPATH3);
eventEmitter.emit('prepare');
})
});
......@@ -858,7 +853,6 @@ describe('AudioDecoderFormatCallback', function () {
audioDecodeProcessor.configure(mediaDescription, (err) => {
expect(err).assertUndefined();
console.info(`case configure 1`);
readFile(AUDIOPATH4);
eventEmitter.emit('prepare');
})
});
......@@ -965,7 +959,6 @@ describe('AudioDecoderFormatCallback', function () {
audioDecodeProcessor.configure(mediaDescription, (err) => {
expect(err).assertUndefined();
console.info(`case configure 1`);
readFile(AUDIOPATH4);
eventEmitter.emit('prepare');
})
});
......
......@@ -165,7 +165,7 @@ describe('AudioDecoderFormatPromise', function () {
function getContent(buf, len) {
console.info("case start get content");
let lengthreal = -1;
lengthreal = readStreamSync.readSync(buf,{length:len});
lengthreal = fileio.readSync(fdRead, buf, {length:len});
console.info('case lengthreal is :' + lengthreal);
}
......@@ -223,6 +223,7 @@ describe('AudioDecoderFormatPromise', function () {
console.info('release success');
audioDecodeProcessor = null;
}, failCallback).catch(failCatch);
await fileio.close(fdRead);
await closeFdWrite();
done();
}
......@@ -352,7 +353,6 @@ describe('AudioDecoderFormatPromise', function () {
}, failCallback).catch(failCatch);
await audioDecodeProcessor.configure(mediaDescription).then(() => {
console.log("configure success");
readFile(AUDIOPATH1);
}, failCallback).catch(failCatch);
setCallback(savepath, done);
await audioDecodeProcessor.prepare().then(() => {
......@@ -453,7 +453,6 @@ describe('AudioDecoderFormatPromise', function () {
}, failCallback).catch(failCatch);
await audioDecodeProcessor.configure(mediaDescription).then(() => {
console.log("configure success");
readFile(AUDIOPATH1);
}, failCallback).catch(failCatch);
setCallback(savepath, done);
await audioDecodeProcessor.prepare().then(() => {
......@@ -512,7 +511,6 @@ describe('AudioDecoderFormatPromise', function () {
console.log("start configure");
await audioDecodeProcessor.configure(mediaDescription).then(() => {
console.log("configure success");
readFile(AUDIOPATH2);
}, failCallback).catch(failCatch);
setCallback(savepath, done);
await audioDecodeProcessor.prepare().then(() => {
......@@ -571,7 +569,6 @@ describe('AudioDecoderFormatPromise', function () {
console.log("start configure");
await audioDecodeProcessor.configure(mediaDescription).then(() => {
console.log("configure success");
readFile(AUDIOPATH2);
}, failCallback).catch(failCatch);
setCallback(savepath, done);
await audioDecodeProcessor.prepare().then(() => {
......@@ -615,7 +612,6 @@ describe('AudioDecoderFormatPromise', function () {
}, failCallback).catch(failCatch);
await audioDecodeProcessor.configure(mediaDescription).then(() => {
console.log("configure success");
readFile(AUDIOPATH3);
}, failCallback).catch(failCatch);
setCallback(savepath, done);
await audioDecodeProcessor.prepare().then(() => {
......@@ -659,7 +655,6 @@ describe('AudioDecoderFormatPromise', function () {
}, failCallback).catch(failCatch);
await audioDecodeProcessor.configure(mediaDescription).then(() => {
console.log("configure success");
readFile(AUDIOPATH3);
}, failCallback).catch(failCatch);
setCallback(savepath, done);
await audioDecodeProcessor.prepare().then(() => {
......@@ -747,7 +742,6 @@ describe('AudioDecoderFormatPromise', function () {
}, failCallback).catch(failCatch);
await audioDecodeProcessor.configure(mediaDescription).then(() => {
console.log("configure success");
readFile(AUDIOPATH4);
}, failCallback).catch(failCatch);
setCallback(savepath, done);
await audioDecodeProcessor.prepare().then(() => {
......@@ -835,7 +829,6 @@ describe('AudioDecoderFormatPromise', function () {
}, failCallback).catch(failCatch);
await audioDecodeProcessor.configure(mediaDescription).then(() => {
console.log("configure success");
readFile(AUDIOPATH4);
}, failCallback).catch(failCatch);
setCallback(savepath, done);
await audioDecodeProcessor.prepare().then(() => {
......
......@@ -334,7 +334,6 @@ describe('AudioDecoderFuncCallback', function () {
}
}
function writeFile(path, buf, len) {
try{
let res = fileio.writeSync(fdWrite, buf, {length: len});
......@@ -357,7 +356,7 @@ describe('AudioDecoderFuncCallback', function () {
function getContent(buf, len) {
console.info("case start get content");
let lengthreal = -1;
lengthreal = readStreamSync.readSync(buf,{length:len});
lengthreal = fileio.readSync(fdRead, buf, {length:len});
console.info('case lengthreal is :' + lengthreal);
}
......@@ -391,7 +390,6 @@ describe('AudioDecoderFuncCallback', function () {
expect(err).assertUndefined();
console.info("case flush at inputeos success");
resetParam();
readFile(AUDIOPATH);
workdoneAtEOS =true;
})
}
......@@ -408,6 +406,7 @@ describe('AudioDecoderFuncCallback', function () {
expect(err).assertUndefined();
console.log("case release success");
audioDecodeProcessor = null;
await fileio.close(fdRead);
await closeFdWrite();
done();
})
......@@ -539,7 +538,6 @@ describe('AudioDecoderFuncCallback', function () {
audioDecodeProcessor.configure(mediaDescription, (err) => {
expect(err).assertUndefined();
console.info(`case configure 1`);
readFile(AUDIOPATH);
eventEmitter.emit('prepare');
})
});
......@@ -623,7 +621,6 @@ describe('AudioDecoderFuncCallback', function () {
audioDecodeProcessor.configure(mediaDescription, (err) => {
expect(err).assertUndefined();
console.info(`case configure 1`);
readFile(AUDIOPATH);
eventEmitter.emit('prepare');
})
});
......@@ -696,7 +693,6 @@ describe('AudioDecoderFuncCallback', function () {
audioDecodeProcessor.configure(mediaDescription, (err) => {
expect(err).assertUndefined();
console.info(`case configure 1`);
readFile(AUDIOPATH);
eventEmitter.emit('prepare');
})
});
......@@ -768,7 +764,6 @@ describe('AudioDecoderFuncCallback', function () {
audioDecodeProcessor.configure(mediaDescription, (err) => {
expect(err).assertUndefined();
console.info(`case configure 1`);
readFile(AUDIOPATH);
eventEmitter.emit('prepare');
})
});
......@@ -827,7 +822,6 @@ describe('AudioDecoderFuncCallback', function () {
audioDecodeProcessor.configure(mediaDescription, (err) => {
expect(err).assertUndefined();
console.info(`case configure 1`);
readFile(AUDIOPATH);
eventEmitter.emit('prepare');
})
});
......@@ -868,6 +862,7 @@ describe('AudioDecoderFuncCallback', function () {
expect(err).assertUndefined();
console.info(`case release 1`);
audioDecodeProcessor = null;
await fileio.close(fdRead);
await closeFdWrite();
done();
})
......@@ -914,7 +909,6 @@ describe('AudioDecoderFuncCallback', function () {
audioDecodeProcessor.configure(mediaDescription, (err) => {
expect(err).assertUndefined();
console.info(`case configure 1`);
readFile(AUDIOPATH);
eventEmitter.emit('prepare');
})
});
......@@ -939,7 +933,6 @@ describe('AudioDecoderFuncCallback', function () {
expect(err).assertUndefined();
console.info(`stop after 5s`);
resetParam();
readFile(AUDIOPATH);
eventEmitter.emit('restart');
})
})
......@@ -948,7 +941,6 @@ describe('AudioDecoderFuncCallback', function () {
sleep(2000).then(async() => {
resetParam();
await getFdRead(readpath, done);
readFile(readpath);
audioDecodeProcessor.start((err) => {
expect(err).assertUndefined();
console.info(`restart after 2s`);
......@@ -1006,7 +998,6 @@ describe('AudioDecoderFuncCallback', function () {
audioDecodeProcessor.configure(mediaDescription, (err) => {
expect(err).assertUndefined();
console.info(`case configure 1`);
readFile(AUDIOPATH);
eventEmitter.emit('prepare');
})
});
......@@ -1030,6 +1021,7 @@ describe('AudioDecoderFuncCallback', function () {
eventEmitter.on('reconfigure', (mediaDescription2) => {
sleep(10000).then(async() => {
resetParam();
await fileio.close(fdRead);
await closeFdWrite();
audioDecodeProcessor.configure(mediaDescription2, async(err) => {
expect(err).assertUndefined();
......@@ -1040,7 +1032,6 @@ describe('AudioDecoderFuncCallback', function () {
savepath = 'audioDecode_function_callback_06_2.pcm';
await getFdWrite(savepath);
await getFdRead(readpath, done);
readFile(AUDIOPATH2);
workdoneAtEOS = true;
ES = [0, 239, 302, 309, 330, 474, 684, 699, 683, 674, 647, 649, 638, 644, 640,
639, 650, 702, 713, 718, 707, 707, 683, 670, 674, 699, 654, 650, 715, 770,
......@@ -1113,7 +1104,6 @@ describe('AudioDecoderFuncCallback', function () {
audioDecodeProcessor.configure(mediaDescription, (err) => {
expect(err).assertUndefined();
console.info(`case configure 1`);
readFile(AUDIOPATH);
eventEmitter.emit('prepare');
})
});
......@@ -1136,6 +1126,7 @@ describe('AudioDecoderFuncCallback', function () {
});
eventEmitter.on('recreate', () => {
sleep(10000).then(async() => {
await fileio.close(fdRead);
await closeFdWrite();
media.createAudioDecoderByMime('audio/flac', (err, processor) => {
expect(err).assertUndefined();
......@@ -1155,7 +1146,6 @@ describe('AudioDecoderFuncCallback', function () {
savepath = 'audioDecode_function_callback_07_2.pcm';
await getFdWrite(savepath);
await getFdRead(readpath, done);
readFile(AUDIOPATH3);
workdoneAtEOS = true;
ES = [0, 2116, 2093, 2886, 2859, 2798, 2778, 2752, 2752, 2754, 2720, 2898, 2829,
2806, 2796, 2786, 2774, 2758, 2741, 3489, 3342, 3272, 3167, 3048, 3060, 2919,
......
......@@ -343,7 +343,6 @@ describe('AudioDecoderFuncPromise', function () {
}
}
function writeFile(path, buf, len) {
try{
let res = fileio.writeSync(fdWrite, buf, {length: len});
......@@ -366,7 +365,7 @@ describe('AudioDecoderFuncPromise', function () {
function getContent(buf, len) {
console.info("case start get content");
let lengthreal = -1;
lengthreal = readStreamSync.readSync(buf,{length:len});
lengthreal = fileio.readSync(fdRead, buf, {length:len});
console.info('case lengthreal is :' + lengthreal);
}
......@@ -393,7 +392,6 @@ describe('AudioDecoderFuncPromise', function () {
await audioDecodeProcessor.flush().then(() => {
console.info("case flush at inputeos success");
resetParam();
readFile(readpath);
workdoneAtEOS =true;
}, failCallback).catch(failCatch);
}
......@@ -458,6 +456,7 @@ describe('AudioDecoderFuncPromise', function () {
await flushWork(done);
} else if (workdoneAtEOS) {
await doneWork();
await fileio.close(fdRead);
await closeFdWrite();
done();
} else {
......@@ -551,7 +550,6 @@ describe('AudioDecoderFuncPromise', function () {
}, failCallback).catch(failCatch);
await audioDecodeProcessor.configure(mediaDescription).then(() => {
console.info("case configure success");
readFile(AUDIOPATH);
}, failCallback).catch(failCatch);
setCallback(savepath, done);
await audioDecodeProcessor.prepare().then(() => {
......@@ -594,7 +592,6 @@ describe('AudioDecoderFuncPromise', function () {
}, failCallback).catch(failCatch);
await audioDecodeProcessor.configure(mediaDescription).then(() => {
console.info("case configure success");
readFile(AUDIOPATH);
}, failCallback).catch(failCatch);
setCallback(savepath, done);
await audioDecodeProcessor.prepare().then(() => {
......@@ -635,7 +632,6 @@ describe('AudioDecoderFuncPromise', function () {
}, failCallback).catch(failCatch);
await audioDecodeProcessor.configure(mediaDescription).then(() => {
console.info("case configure success");
readFile(AUDIOPATH);
}, failCallback).catch(failCatch);
setCallback(savepath, done);
await audioDecodeProcessor.prepare().then(() => {
......@@ -684,7 +680,6 @@ describe('AudioDecoderFuncPromise', function () {
}, failCallback).catch(failCatch);
await audioDecodeProcessor.configure(mediaDescription).then(() => {
console.info("case configure success");
readFile(AUDIOPATH);
}, failCallback).catch(failCatch);
setCallback(savepath, done);
await audioDecodeProcessor.prepare().then(() => {
......@@ -724,7 +719,6 @@ describe('AudioDecoderFuncPromise', function () {
}, failCallback).catch(failCatch);
await audioDecodeProcessor.configure(mediaDescription).then(() => {
console.info("case configure success");
readFile(AUDIOPATH);
}, failCallback).catch(failCatch);
setCallback(savepath, done);
await audioDecodeProcessor.prepare().then(() => {
......@@ -745,6 +739,7 @@ describe('AudioDecoderFuncPromise', function () {
console.info("case release success");
}, failCallback).catch(failCatch);
audioDecodeProcessor = null;
await fileio.close(fdRead);
await closeFdWrite();
done();
})
......@@ -779,7 +774,6 @@ describe('AudioDecoderFuncPromise', function () {
}, failCallback).catch(failCatch);
await audioDecodeProcessor.configure(mediaDescription).then(() => {
console.info("case configure success");
readFile(AUDIOPATH);
}, failCallback).catch(failCatch);
setCallback(savepath, done);
await audioDecodeProcessor.prepare().then(() => {
......@@ -799,7 +793,6 @@ describe('AudioDecoderFuncPromise', function () {
});
resetParam();
await getFdRead(readpath, done);
readFile(readpath);
await audioDecodeProcessor.start().then(() => {
console.info("case restart after 3s success");
workdoneAtEOS = true;
......@@ -843,7 +836,6 @@ describe('AudioDecoderFuncPromise', function () {
}, failCallback).catch(failCatch);
await audioDecodeProcessor.configure(mediaDescription).then(() => {
console.info("case configure success");
readFile(AUDIOPATH);
}, failCallback).catch(failCatch);
setCallback(savepath, done);
await audioDecodeProcessor.prepare().then(() => {
......@@ -856,6 +848,7 @@ describe('AudioDecoderFuncPromise', function () {
console.info("case start configure 2");
});
resetParam();
await fileio.close(fdRead);
await closeFdWrite();
await audioDecodeProcessor.configure(mediaDescription2).then(() => {
console.info("case configure 2 success");
......@@ -865,7 +858,6 @@ describe('AudioDecoderFuncPromise', function () {
savepath = 'audioDecode_function_promise_06_2.pcm';
await getFdWrite(savepath);
await getFdRead(readpath, done);
readFile(AUDIOPATH2);
workdoneAtEOS = true;
ES = [0, 239, 302, 309, 330, 474, 684, 699, 683, 674, 647, 649, 638, 644, 640,
639, 650, 702, 713, 718, 707, 707, 683, 670, 674, 699, 654, 650, 715, 770,
......@@ -929,7 +921,6 @@ describe('AudioDecoderFuncPromise', function () {
}, failCallback).catch(failCatch);
await audioDecodeProcessor.configure(mediaDescription).then(() => {
console.info("case configure success");
readFile(AUDIOPATH);
}, failCallback).catch(failCatch);
setCallback(savepath, done);
await audioDecodeProcessor.prepare().then(() => {
......@@ -941,6 +932,7 @@ describe('AudioDecoderFuncPromise', function () {
await sleep(10000).then(() => {
console.info("start createaudiodecoder 2");
});
await fileio.close(fdRead);
await closeFdWrite();
await media.createAudioDecoderByMime('audio/flac').then((processor) => {
console.info("case create createAudioDecoder flac success");
......@@ -954,7 +946,6 @@ describe('AudioDecoderFuncPromise', function () {
savepath = 'audioDecode_function_promise_07_2.pcm';
await getFdWrite(savepath);
await getFdRead(readpath, done);
readFile(AUDIOPATH3);
workdoneAtEOS = true;
ES = [0, 2116, 2093, 2886, 2859, 2798, 2778, 2752, 2752, 2754, 2720, 2898, 2829,
2806, 2796, 2786, 2774, 2758, 2741, 3489, 3342, 3272, 3167, 3048, 3060, 2919,
......
......@@ -267,6 +267,7 @@ describe('AudioDecoderReliabilityCallback', function () {
audioDecodeProcessor = null;
}, failCallback).catch(failCatch);
}
await fileio.close(fdRead);
})
afterAll(async function() {
......@@ -319,7 +320,7 @@ describe('AudioDecoderReliabilityCallback', function () {
function getContent(buf, len) {
console.info("case start get content");
let lengthreal = -1;
lengthreal = readStreamSync.readSync(buf,{length:len});
lengthreal = fileio.readSync(fdRead, buf, {length:len});
console.info('case lengthreal is :' + lengthreal);
}
......@@ -368,7 +369,6 @@ describe('AudioDecoderReliabilityCallback', function () {
audioDecodeProcessor.configure(mediaDescription, (err) => {
expect(err).assertUndefined();
console.info(`case configure 1`);
readFile(AUDIOPATH);
nextStep(mySteps, mediaDescription, done);
});
break;
......@@ -387,7 +387,6 @@ describe('AudioDecoderReliabilityCallback', function () {
if (sawOutputEOS) {
resetParam();
await getFdRead(AUDIOPATH, done);
readFile(AUDIOPATH);
workdoneAtEOS = true;
enqueueAllInputs(inputQueue);
}
......@@ -408,7 +407,6 @@ describe('AudioDecoderReliabilityCallback', function () {
if (flushAtEOS) {
resetParam();
await getFdRead(AUDIOPATH, done);
readFile(AUDIOPATH);
workdoneAtEOS = true;
flushAtEOS = false;
}
......
......@@ -271,6 +271,7 @@ describe('AudioDecoderReliabilityPromise', function () {
audioDecodeProcessor = null;
}, failCallback).catch(failCatch);
}
await fileio.close(fdRead);
})
afterAll(async function() {
......@@ -327,6 +328,12 @@ describe('AudioDecoderReliabilityPromise', function () {
})
}
async function closeFdRead() {
await fileio.close(fdRead).then(() => {
console.info('[fileio] case close fdRead success, fd is ' + fdRead);
}, failCallback).catch(failCatch);
}
function readFile(path) {
console.info('case read file start execution');
try{
......@@ -340,7 +347,7 @@ describe('AudioDecoderReliabilityPromise', function () {
function getContent(buf, len) {
console.info("case start get content");
let lengthreal = -1;
lengthreal = readStreamSync.readSync(buf,{length:len});
lengthreal = fileio.readSync(fdRead, buf, {length:len});
console.info('case lengthreal is :' + lengthreal);
}
......@@ -381,7 +388,6 @@ describe('AudioDecoderReliabilityPromise', function () {
console.info(`case to configure`);
audioDecodeProcessor.configure(mediaDescription).then(() => {
console.info(`case configure 1`);
readFile(AUDIOPATH);
nextStep(mySteps, done);
}, failCallback).catch(failCatch);
break;
......@@ -399,7 +405,6 @@ describe('AudioDecoderReliabilityPromise', function () {
if (sawOutputEOS) {
resetParam();
await getFdRead(AUDIOPATH, done);
readFile(AUDIOPATH);
workdoneAtEOS = true;
enqueueAllInputs(inputQueue);
}
......@@ -418,7 +423,6 @@ describe('AudioDecoderReliabilityPromise', function () {
if (flushAtEOS) {
await getFdRead(AUDIOPATH, done);
resetParam();
readFile(AUDIOPATH);
workdoneAtEOS = true;
flushAtEOS = false;
}
......
......@@ -164,7 +164,7 @@ describe('AudioEncoderFuncCallback', function () {
function getContent(buf, len) {
console.info("case start get content");
let lengthreal = -1;
lengthreal = readStreamSync.readSync(buf,{length:len});
lengthreal = fileio.readSync(fdRead, buf, {length:len});
console.info('case lengthreal is :' + lengthreal);
}
......@@ -235,7 +235,6 @@ describe('AudioEncoderFuncCallback', function () {
expect(err).assertUndefined();
console.info("case flush at inputeos success");
resetParam();
readFile(AUDIOPATH);
workdoneAtEOS =true;
})
}
......@@ -251,6 +250,7 @@ describe('AudioEncoderFuncCallback', function () {
expect(err).assertUndefined();
console.log("case release success");
audioEncodeProcessor = null;
await fileio.close(fdRead);
await closeFdWrite();
done();
})
......@@ -384,7 +384,6 @@ describe('AudioEncoderFuncCallback', function () {
audioEncodeProcessor.configure(mediaDescription, (err) => {
expect(err).assertUndefined();
console.info(`case configure 1`);
readFile(AUDIOPATH);
eventEmitter.emit('prepare');
})
});
......@@ -467,7 +466,6 @@ describe('AudioEncoderFuncCallback', function () {
audioEncodeProcessor.configure(mediaDescription, (err) => {
expect(err).assertUndefined();
console.info(`case configure 1`);
readFile(AUDIOPATH);
eventEmitter.emit('prepare');
})
});
......@@ -527,7 +525,6 @@ describe('AudioEncoderFuncCallback', function () {
audioEncodeProcessor.configure(mediaDescription, (err) => {
expect(err).assertUndefined();
console.info(`case configure 1`);
readFile(AUDIOPATH);
eventEmitter.emit('prepare');
})
});
......@@ -598,7 +595,6 @@ describe('AudioEncoderFuncCallback', function () {
audioEncodeProcessor.configure(mediaDescription, (err) => {
expect(err).assertUndefined();
console.info(`case configure 1`);
readFile(AUDIOPATH);
eventEmitter.emit('prepare');
})
});
......@@ -657,7 +653,6 @@ describe('AudioEncoderFuncCallback', function () {
audioEncodeProcessor.configure(mediaDescription, (err) => {
expect(err).assertUndefined();
console.info(`case configure 1`);
readFile(AUDIOPATH);
eventEmitter.emit('prepare');
})
});
......@@ -698,6 +693,7 @@ describe('AudioEncoderFuncCallback', function () {
expect(err).assertUndefined();
console.info(`case release 1`);
audioEncodeProcessor = null;
await fileio.close(fdRead);
await closeFdWrite();
done();
})
......@@ -744,7 +740,6 @@ describe('AudioEncoderFuncCallback', function () {
audioEncodeProcessor.configure(mediaDescription, (err) => {
expect(err).assertUndefined();
console.info(`case configure 1`);
readFile(AUDIOPATH);
eventEmitter.emit('prepare');
})
});
......@@ -769,7 +764,6 @@ describe('AudioEncoderFuncCallback', function () {
expect(err).assertUndefined();
console.info(`stop after 5s`);
resetParam();
readFile(AUDIOPATH);
eventEmitter.emit('restart');
})
})
......@@ -778,7 +772,6 @@ describe('AudioEncoderFuncCallback', function () {
sleep(2000).then(async() => {
resetParam();
await getFdRead(readpath, done);
readFile(readpath);
audioEncodeProcessor.start((err) => {
expect(err).assertUndefined();
console.info(`restart after 2s`);
......@@ -836,7 +829,6 @@ describe('AudioEncoderFuncCallback', function () {
audioEncodeProcessor.configure(mediaDescription, (err) => {
expect(err).assertUndefined();
console.info(`case configure 1`);
readFile(AUDIOPATH);
eventEmitter.emit('prepare');
})
});
......@@ -860,6 +852,7 @@ describe('AudioEncoderFuncCallback', function () {
eventEmitter.on('reconfigure', (mediaDescription2) => {
sleep(10000).then(async() => {
resetParam();
await fileio.close(fdRead);
await closeFdWrite();
audioEncodeProcessor.configure(mediaDescription2, async(err) => {
expect(err).assertUndefined();
......@@ -869,7 +862,6 @@ describe('AudioEncoderFuncCallback', function () {
savepath = 'audioEncode_function_callback_06_2.aac';
await getFdWrite(savepath);
await getFdRead(readpath, done);
readFile(AUDIOPATH);
workdoneAtEOS = true;
hasreconfigured = true;
eventEmitter.emit('prepare');
......
......@@ -174,7 +174,7 @@ describe('AudioEncoderFuncPromise', function () {
function getContent(buf, len) {
console.info("case start get content");
let lengthreal = -1;
lengthreal = readStreamSync.readSync(buf,{length:len});
lengthreal = fileio.readSync(fdRead, buf, {length:len});
console.info('case lengthreal is :' + lengthreal);
}
......@@ -240,7 +240,6 @@ describe('AudioEncoderFuncPromise', function () {
await audioEncodeProcessor.flush().then(() => {
console.info("case flush at inputeos success");
resetParam();
readFile(AUDIOPATH);
workdoneAtEOS =true;
}, failCallback).catch(failCatch);
}
......@@ -306,6 +305,7 @@ describe('AudioEncoderFuncPromise', function () {
await flushWork(done);
} else if (workdoneAtEOS) {
await doneWork();
await fileio.close(fdRead);
await closeFdWrite();
done();
} else {
......@@ -406,7 +406,6 @@ describe('AudioEncoderFuncPromise', function () {
}, failCallback).catch(failCatch);
await audioEncodeProcessor.configure(mediaDescription).then(() => {
console.info("case configure success");
readFile(AUDIOPATH);
}, failCallback).catch(failCatch);
setCallback(savepath, done);
await audioEncodeProcessor.prepare().then(() => {
......@@ -448,7 +447,6 @@ describe('AudioEncoderFuncPromise', function () {
}, failCallback).catch(failCatch);
await audioEncodeProcessor.configure(mediaDescription).then(() => {
console.info("case configure success");
readFile(AUDIOPATH);
}, failCallback).catch(failCatch);
setCallback(savepath, done);
await audioEncodeProcessor.prepare().then(() => {
......@@ -489,7 +487,6 @@ describe('AudioEncoderFuncPromise', function () {
}, failCallback).catch(failCatch);
await audioEncodeProcessor.configure(mediaDescription).then(() => {
console.info("case configure success");
readFile(AUDIOPATH)
}, failCallback).catch(failCatch);
setCallback(savepath, done);
await audioEncodeProcessor.prepare().then(() => {
......@@ -538,7 +535,6 @@ describe('AudioEncoderFuncPromise', function () {
}, failCallback).catch(failCatch);
await audioEncodeProcessor.configure(mediaDescription).then(() => {
console.info("case configure success");
readFile(AUDIOPATH);
}, failCallback).catch(failCatch);
setCallback(savepath, done);
await audioEncodeProcessor.prepare().then(() => {
......@@ -578,7 +574,6 @@ describe('AudioEncoderFuncPromise', function () {
}, failCallback).catch(failCatch);
await audioEncodeProcessor.configure(mediaDescription).then(() => {
console.info("case configure success");
readFile(AUDIOPATH);
}, failCallback).catch(failCatch);
setCallback(savepath, done);
await audioEncodeProcessor.prepare().then(() => {
......@@ -599,6 +594,7 @@ describe('AudioEncoderFuncPromise', function () {
console.info("case release success");
}, failCallback).catch(failCatch);
audioEncodeProcessor = null;
await fileio.close(fdRead);
await closeFdWrite();
done();
})
......@@ -633,7 +629,6 @@ describe('AudioEncoderFuncPromise', function () {
}, failCallback).catch(failCatch);
await audioEncodeProcessor.configure(mediaDescription).then(() => {
console.info("case configure success");
readFile(AUDIOPATH);
}, failCallback).catch(failCatch);
setCallback(savepath, done);
await audioEncodeProcessor.prepare().then(() => {
......@@ -653,7 +648,6 @@ describe('AudioEncoderFuncPromise', function () {
});
resetParam();
await getFdRead(readpath, done);
readFile(readpath);
await audioEncodeProcessor.start().then(() => {
console.info("case restart after 3s success");
workdoneAtEOS = true;
......@@ -692,7 +686,6 @@ describe('AudioEncoderFuncPromise', function () {
}, failCallback).catch(failCatch);
await audioEncodeProcessor.configure(mediaDescription).then(() => {
console.info("case configure success");
readFile(AUDIOPATH);
}, failCallback).catch(failCatch);
setCallback(savepath, done);
await audioEncodeProcessor.prepare().then(() => {
......@@ -710,6 +703,7 @@ describe('AudioEncoderFuncPromise', function () {
console.info("start configure 2");
});
resetParam();
await fileio.close(fdRead);
await closeFdWrite();
await audioEncodeProcessor.configure(mediaDescription2).then(() => {
console.info("configure 2 success");
......@@ -719,7 +713,6 @@ describe('AudioEncoderFuncPromise', function () {
savepath = 'audioEncode_function_promise_06_2.aac';
await getFdWrite(savepath);
await getFdRead(readpath, done);
readFile(AUDIOPATH);
workdoneAtEOS = true;
setCallback(savepath, done);
await audioEncodeProcessor.prepare().then(() => {
......
......@@ -90,6 +90,7 @@ describe('AudioEncoderReliabilityCallback', function () {
}, failCallback).catch(failCatch);
audioEncodeProcessor = null;
}
await fileio.close(fdRead);
})
afterAll(async function() {
......@@ -142,7 +143,7 @@ describe('AudioEncoderReliabilityCallback', function () {
function getContent(buf, len) {
console.info("case start get content");
let lengthreal = -1;
lengthreal = readStreamSync.readSync(buf,{length:len});
lengthreal = fileio.readSync(fdRead, buf, {length:len});
console.info('case lengthreal is :' + lengthreal);
}
......@@ -189,7 +190,6 @@ describe('AudioEncoderReliabilityCallback', function () {
audioEncodeProcessor.configure(mediaDescription, (err) => {
expect(err).assertUndefined();
console.info(`case configure 1`);
readFile(AUDIOPATH);
nextStep(mySteps, mediaDescription, done);
});
break;
......@@ -208,7 +208,6 @@ describe('AudioEncoderReliabilityCallback', function () {
if (sawOutputEOS) {
resetParam();
await getFdRead(AUDIOPATH, done);
readFile(AUDIOPATH);
workdoneAtEOS = true;
enqueueAllInputs(inputQueue);
}
......@@ -229,7 +228,6 @@ describe('AudioEncoderReliabilityCallback', function () {
if (flushAtEOS) {
await getFdRead(AUDIOPATH, done);
resetParam();
readFile(AUDIOPATH);
workdoneAtEOS = true;
flushAtEOS = false;
}
......
......@@ -92,6 +92,7 @@ describe('AudioEncoderReliabilityPromise', function () {
}, failCallback).catch(failCatch);
audioEncodeProcessor = null;
}
await fileio.close(fdRead);
})
afterAll(async function() {
......@@ -159,7 +160,7 @@ describe('AudioEncoderReliabilityPromise', function () {
function getContent(buf, len) {
console.info("case start get content");
let lengthreal = -1;
lengthreal = readStreamSync.readSync(buf,{length:len});
lengthreal = fileio.readSync(fdRead, buf, {length:len});
console.info('case lengthreal is :' + lengthreal);
}
......@@ -200,7 +201,6 @@ describe('AudioEncoderReliabilityPromise', function () {
console.info(`case to configure`);
audioEncodeProcessor.configure(mediaDescription).then(() => {
console.info(`case configure 1`);
readFile(AUDIOPATH);
nextStep(mySteps, done);
}, failCallback).catch(failCatch);
break;
......@@ -218,7 +218,6 @@ describe('AudioEncoderReliabilityPromise', function () {
if (sawOutputEOS) {
resetParam();
await getFdRead(AUDIOPATH, done);
readFile(AUDIOPATH);
workdoneAtEOS = true;
enqueueInputs(inputQueue);
}
......@@ -237,7 +236,6 @@ describe('AudioEncoderReliabilityPromise', function () {
if (flushAtEOS) {
await getFdRead(AUDIOPATH, done);
resetParam();
readFile(AUDIOPATH);
workdoneAtEOS = true;
flushAtEOS = false;
}
......
......@@ -262,6 +262,7 @@ describe('VideoDecoderFormatPromise', function () {
videoDecodeProcessor = null;
}
await router.clear();
await fileio.close(fdRead);
})
afterAll(function() {
......@@ -313,7 +314,7 @@ describe('VideoDecoderFormatPromise', function () {
console.info("case start get content");
console.info("case start get content length is: " + len);
let lengthreal = -1;
lengthreal = readStreamSync.readSync(buf,{length:len});
lengthreal = fileio.readSync(fdRead, buf,{length:len});
console.info('case lengthreal is :' + lengthreal);
}
......@@ -456,7 +457,6 @@ describe('VideoDecoderFormatPromise', function () {
await videoDecodeProcessor.configure(mediaDescription).then(() =>{
console.info('in case : configure success');
readFile(srcPath);
}, failCallback).catch(failCatch);
await videoDecodeProcessor.setOutputSurface(surfaceID, true).then(() => {
......
......@@ -99,7 +99,7 @@ describe('VideoDecoderEnum', function () {
function getContent(buf, len) {
console.info("case start get content");
let lengthreal = -1;
lengthreal = readStreamSync.readSync(buf,{length:len});
lengthreal = fileio.readSync(fdRead, buf, {length:len});
console.info('case lengthreal is :' + lengthreal);
}
......@@ -250,7 +250,6 @@ describe('VideoDecoderEnum', function () {
async function toConfigure(mediaDescription, srcPath) {
await videoDecodeProcessor.configure(mediaDescription).then(() =>{
console.info('in case : configure success');
readFile(srcPath);
}, failCallback).catch(failCatch);
}
async function setSurfaceID(done) {
......
......@@ -125,6 +125,7 @@ describe('VideoDecoderFuncCallbackTest', function () {
}
await router.clear().then(() => {
}, failCallback).catch(failCatch);
await fileio.close(fdRead);
})
afterAll(function() {
......@@ -177,7 +178,7 @@ describe('VideoDecoderFuncCallbackTest', function () {
console.info("case start get content");
console.info("case getcontent length is: "+ len);
let lengthreal = -1;
lengthreal = readStreamSync.readSync(buf,{length:len});
lengthreal = fileio.readSync(fdRead, buf, {length:len});
console.info('case lengthreal is :' + lengthreal);
}
......@@ -266,7 +267,6 @@ describe('VideoDecoderFuncCallbackTest', function () {
videoDecodeProcessor.configure(mediaDescription, (err) => {
expect(err).assertUndefined();
console.info('in case : configure success');
readFile(srcPath);
setCallback(nextStep);
eventEmitter.emit('getVideoDecoderCaps', done);
// eventEmitter.emit('setOutputSurface', done);
......
......@@ -125,6 +125,7 @@ describe('VideoDecoderFuncPromiseTest', function () {
}
await router.clear().then(() => {
}, failCallback).catch(failCatch);
await fileio.close(fdRead);
})
afterAll(function() {
......@@ -174,7 +175,7 @@ describe('VideoDecoderFuncPromiseTest', function () {
console.info("case start get content");
console.info("case start get content length is: " + len);
let lengthreal = -1;
lengthreal = readStreamSync.readSync(buf,{length:len});
lengthreal = fileio.readSync(fdRead, buf, {length:len});
console.info('case lengthreal is :' + lengthreal);
}
......@@ -288,7 +289,6 @@ describe('VideoDecoderFuncPromiseTest', function () {
async function toConfigure(mediaDescription, srcPath) {
await videoDecodeProcessor.configure(mediaDescription).then(() =>{
console.info('in case : configure success');
readFile(srcPath);
}, failCallback).catch(failCatch);
}
async function toSetOutputSurface(isDisplay) {
......
......@@ -109,6 +109,7 @@ describe('VideoDecoderReliCallbackTest', function () {
}
await router.clear().then(() => {
}, failCallback).catch(failCatch);
await fileio.close(fdRead);
})
afterAll(async function() {
......@@ -159,11 +160,11 @@ describe('VideoDecoderReliCallbackTest', function () {
let lengthReal = -1;
try {
if (pos == -1) {
lengthReal = readStreamSync.readSync(buf, {
lengthReal = fileio.readSync(fdRead, buf, {
length: len,
});
} else {
lengthReal = readStreamSync.readSync(buf, {
lengthReal = fileio.readSync(fdRead, buf, {
length: len,
position: pos,
});
......@@ -331,7 +332,6 @@ describe('VideoDecoderReliCallbackTest', function () {
toStart(mySteps, done, true);
} else {
readStreamSync = undefined;
readFile(SRCPATH);
frameCountIn = 0;
frameCountOut = 0;
inputQueue = [];
......
......@@ -109,6 +109,7 @@ describe('VideoDecoderReliPromiseTest', function () {
}
await router.clear().then(() => {
}, failCallback).catch(failCatch);
await fileio.close(fdRead);
})
afterAll(async function() {
......@@ -165,11 +166,11 @@ describe('VideoDecoderReliPromiseTest', function () {
let lengthReal = -1;
try {
if (pos == -1) {
lengthReal = readStreamSync.readSync(buf, {
lengthReal = fileio.readSync(fdRead, buf, {
length: len,
});
} else {
lengthReal = readStreamSync.readSync(buf, {
lengthReal = fileio.readSync(fdRead, buf, {
length: len,
position: pos,
});
......@@ -328,7 +329,6 @@ describe('VideoDecoderReliPromiseTest', function () {
toStart(mySteps, done, callbackExpectFail, failCatch);
} else {
readStreamSync = undefined;
readFile(SRCPATH);
frameCountIn = 0;
frameCountOut = 0;
inputQueue = [];
......
......@@ -140,6 +140,7 @@ describe('VideoDecoderFuncCallbackTest', function () {
}
await router.clear().then(() => {
}, failCallback).catch(failCatch);
await fileio.close(fdRead);
})
afterAll(function() {
......@@ -189,7 +190,7 @@ describe('VideoDecoderFuncCallbackTest', function () {
console.info("case start get content");
console.info("case start get content length is: " + len);
let lengthreal = -1;
lengthreal = readStreamSync.readSync(buf,{length:len});
lengthreal = fileio.readSync(fdRead, buf, {length:len});
console.info('case lengthreal is :' + lengthreal);
}
......@@ -267,7 +268,6 @@ describe('VideoDecoderFuncCallbackTest', function () {
videoDecodeProcessor.configure(mediaDescription, (err) => {
expect(err).assertUndefined();
console.info('in case : configure success');
readFile(srcPath);
setCallback(nextStep);
eventEmitter.emit('setOutputSurface', done);
});
......
......@@ -141,6 +141,7 @@ describe('VideoDecoderFuncPromiseTest', function () {
}
await router.clear().then(() => {
}, failCallback).catch(failCatch);
await fileio.close(fdRead);
})
afterAll(function() {
......@@ -190,7 +191,7 @@ describe('VideoDecoderFuncPromiseTest', function () {
console.info("case start get content");
console.info("case start get content length is: " + len);
let lengthreal = -1;
lengthreal = readStreamSync.readSync(buf,{length:len});
lengthreal = fileio.readSync(fdRead, buf, {length:len});
console.info('case lengthreal is :' + lengthreal);
}
......@@ -282,7 +283,6 @@ describe('VideoDecoderFuncPromiseTest', function () {
async function toConfigure(mediaDescription, srcPath) {
await videoDecodeProcessor.configure(mediaDescription).then(() =>{
console.info('in case : configure success');
readFile(srcPath);
}, failCallback).catch(failCatch);
}
async function toSetOutputSurface(isDisplay) {
......
......@@ -109,6 +109,7 @@ describe('VideoDecoderSoftwareReliCallbackTest', function () {
}
await router.clear().then(() => {
}, failCallback).catch(failCatch);
await fileio.close(fdRead);
})
afterAll(async function() {
......@@ -159,11 +160,11 @@ describe('VideoDecoderSoftwareReliCallbackTest', function () {
let lengthReal = -1;
try {
if (pos == -1) {
lengthReal = readStreamSync.readSync(buf, {
lengthReal = fileio.readSync(fdRead, buf, {
length: len,
});
} else {
lengthReal = readStreamSync.readSync(buf, {
lengthReal = fileio.readSync(fdRead, buf, {
length: len,
position: pos,
});
......@@ -332,7 +333,6 @@ describe('VideoDecoderSoftwareReliCallbackTest', function () {
toStart(mySteps, done, true);
} else {
readStreamSync = undefined;
readFile(SRCPATH);
frameCountIn = 0;
frameCountOut = 0;
inputQueue = [];
......
......@@ -109,6 +109,7 @@ describe('VideoDecoderSoftwareReliPromiseTest', function () {
}
await router.clear().then(() => {
}, failCallback).catch(failCatch);
await fileio.close(fdRead);
})
afterAll(async function() {
......@@ -165,11 +166,11 @@ describe('VideoDecoderSoftwareReliPromiseTest', function () {
let lengthReal = -1;
try {
if (pos == -1) {
lengthReal = readStreamSync.readSync(buf, {
lengthReal = fileio.readSync(fdRead, buf, {
length: len,
});
} else {
lengthReal = readStreamSync.readSync(buf, {
lengthReal = fileio.readSync(fdRead, buf, {
length: len,
position: pos,
});
......@@ -330,7 +331,6 @@ describe('VideoDecoderSoftwareReliPromiseTest', function () {
toStart(mySteps, done, callbackExpectFail, failCatch);
} else {
readStreamSync = undefined;
readFile(SRCPATH);
frameCountIn = 0;
frameCountOut = 0;
inputQueue = [];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册