Skip to content

Commit 49ace71

Browse files
committed
对讲时调用XP2P.dataSend加状态判断保护
Change-Id: I72beedd2452f15d97786adebe1e45a46bc30fe5b
1 parent fed99ec commit 49ace71

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

sdk/video-link-android/src/main/java/com/tencent/iot/video/link/util/audio/AudioRecordUtil.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -231,19 +231,21 @@ public void encodeG711(byte[] data) { }
231231

232232
@Override
233233
public void onFLV(byte[] data) {
234-
XP2P.dataSend(deviceId, data, data.length);
234+
if (recorderState) {
235+
XP2P.dataSend(deviceId, data, data.length);
235236

236-
if (executor.isShutdown()) return;
237-
executor.submit(() -> {
238-
if (fos != null) {
239-
try {
240-
fos.write(data);
241-
fos.flush();
242-
} catch (IOException e) {
243-
e.printStackTrace();
237+
if (executor.isShutdown()) return;
238+
executor.submit(() -> {
239+
if (fos != null) {
240+
try {
241+
fos.write(data);
242+
fos.flush();
243+
} catch (IOException e) {
244+
e.printStackTrace();
245+
}
244246
}
245-
}
246-
});
247+
});
248+
}
247249
}
248250

249251
private class RecordThread extends Thread {

0 commit comments

Comments
 (0)