[*] 修复通道删除

This commit is contained in:
acgist
2023-06-02 09:20:40 +08:00
parent becc68b05f
commit d49444ba60
9 changed files with 96 additions and 74 deletions

View File

@@ -159,6 +159,7 @@ public class Recorder {
this.thread.setDaemon(true);
this.thread.setName("TaoyaoRecord");
this.thread.start();
log.info("开始录像:{}", this.folder);
}
/**
@@ -210,14 +211,14 @@ public class Recorder {
* 视频预览截图
*/
private void preview() {
int time = 2;
int time = this.ffmpegProperties.getPreviewTime();
final File file = Paths.get(this.preview).toFile();
while(time > 0 && !(file.exists() && file.length() > 0L)) {
log.debug("视频预览截图{}", this.preview);
do {
log.debug("视频预览:{}", this.preview);
final String previewScript = String.format(this.ffmpegProperties.getPreview(), this.filepath, time, this.preview);
ScriptUtils.execute(previewScript);
time /= 2;
}
} while (time > 0 && !(file.exists() && file.length() > 0L));
}
/**
@@ -227,7 +228,7 @@ public class Recorder {
log.debug("视频时长:{}", this.filepath);
final String durationScript = String.format(this.ffmpegProperties.getDuration(), this.filepath);
final ScriptExecutor executor = ScriptUtils.execute(durationScript);
final Pattern pattern = Pattern.compile(".*duration\\=([0-9\\.]+).*");
final Pattern pattern = Pattern.compile(this.ffmpegProperties.getDurationRegex());
final Matcher matcher = pattern.matcher(executor.getResult());
String duration = null;
if(matcher.find()) {

View File

@@ -148,6 +148,7 @@ public class ControlServerRecordProtocol extends ProtocolControlAdapter implemen
message.setBody(body);
final Client mediaClient = room.getMediaClient();
mediaClient.request(message);
// TODO回写ID格式自动判断
return recorder.getFilepath();
}