scrcpy
scrcpy copied to clipboard
Flood records in console window: `[server] WARN: Colud not get any audio timestamp`
Environment
- OS: Windows 10 x64
- scrcpy version: 2.0
- installation method: Windows release.
- device model: Motorola G9 Play
- Android version: 11
Flood records in console window (several lines per second(!)):
[server] WARN: Colud not get any audio timestamp
Thank you for your report.
https://github.com/Genymobile/scrcpy/blob/1a80333747de602b03ca7ae6b8e58790eeefc3dc/server/src/main/java/com/genymobile/scrcpy/AudioCapture.java#L125
So this means that audioRecord.read()
always returns 0, which is unexpected.
According to the documentation, this happens when the buffer is not a direct buffer, which is also unexpected (it's a buffer from MediaCodec).
Could you please paste the output of scrcpy -Vdebug
(with just the beginning and the firsts warnings, not the thousand ones :wink:)?
I can reproduce on my Android 11 device by disabling some workarounds:
diff --git a/server/src/main/java/com/genymobile/scrcpy/Server.java b/server/src/main/java/com/genymobile/scrcpy/Server.java
index 5800487da..3e5985ac8 100644
--- a/server/src/main/java/com/genymobile/scrcpy/Server.java
+++ b/server/src/main/java/com/genymobile/scrcpy/Server.java
@@ -83,11 +83,6 @@ public final class Server {
// - <https://github.com/Genymobile/scrcpy/issues/994>
boolean mustFillAppInfo = Build.BRAND.equalsIgnoreCase("meizu");
- // Before Android 11, audio is not supported.
- // Since Android 12, we can properly set a context on the AudioRecord.
- // Only on Android 11 we must fill app info for the AudioRecord to work.
- mustFillAppInfo |= audio && Build.VERSION.SDK_INT == Build.VERSION_CODES.R;
-
if (mustFillAppInfo) {
Workarounds.fillAppInfo();
}
On dev
branch, commit 337d6c2fd351226ede8b7b2b164ffd3d67a6953f avoids to flood the console, but does not fix the audio problem.
Here are the required log entries: scrcpy_debug_log.txt
Oh, these logs show a different issue, it's not "Could not get any audio timestamp" but "Buffering threshold exceeded".
See #3793.
In particular, replace this binary: https://github.com/Genymobile/scrcpy/issues/3793#issuecomment-1465713098
And run scrcpy --audio-output-buffer=10
.