试图修复FFmpeg录制结束异常的问题

This commit is contained in:
Yutousama 2021-04-22 21:27:20 +08:00
parent d6b0cc9fc3
commit d70c5a7818

View File

@ -165,7 +165,7 @@ public class SaveLive {
Process process=AppTools.exec(exec); Process process=AppTools.exec(exec);
InputStream inputStream = process.getErrorStream(); InputStream inputStream = process.getErrorStream();
byte[] bytes = new byte[2048]; byte[] bytes = new byte[2048];
while (inputStream.read(bytes) > -1) { while (inputStream.read(bytes) > -1&&isSave) {
//System.out.println(new String(bytes,StandardCharsets.UTF_8)); //System.out.println(new String(bytes,StandardCharsets.UTF_8));
if(!isPrint){ if(!isPrint){
com.yutou.bilibili.Tools.Log.i("开始录制:" + roomId); com.yutou.bilibili.Tools.Log.i("开始录制:" + roomId);
@ -173,6 +173,7 @@ public class SaveLive {
isPrint=true; isPrint=true;
} }
} }
process.destroy();
System.out.println("----------------stop ffmpeg"); System.out.println("----------------stop ffmpeg");
inputStream.close(); inputStream.close();
com.yutou.bilibili.Tools.Log.i("录制完成:" + roomId); com.yutou.bilibili.Tools.Log.i("录制完成:" + roomId);