Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onRecording 回调时间有交错 #7

Open
linyongsheng opened this issue Dec 14, 2017 · 2 comments
Open

onRecording 回调时间有交错 #7

linyongsheng opened this issue Dec 14, 2017 · 2 comments

Comments

@linyongsheng
Copy link

你好 感谢你贡献的代码。发现录制进度回调的实现有点小瑕疵:

private void writeSampleData(int track, MediaCodec.BufferInfo buffer, ByteBuffer encodedData) {
...
if (!eos && mCallback != null) {
      mCallback.onRecording(buffer.presentationTimeUs);
}
...
}

也就是说在写入音频和视频数据都会导致回调,音视和视频各自的时间是线性递增,但是一起回调就有可能有时间交错

@yrom
Copy link
Owner

yrom commented Dec 15, 2017

是有可能发生,其实这里加个回调只是为了外部能够有时长提示而已。。。
你有什么好的建议吗?

@linyongsheng
Copy link
Author

可以考虑保存最近回调的时间,若最新的回调时间大于该值,则允许回调,并更新最近回调时间;若最新回调时间小于该值,则不处理

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants