Compare commits
3 Commits
no_kill_ad
...
fix_audio_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f7869d130 | ||
|
|
0f28d39127 | ||
|
|
2aec7b4c9d |
@@ -30,8 +30,9 @@ To disable only the audio playback, see [no playback](video.md#no-playback).
|
||||
|
||||
To play audio only, disable the video:
|
||||
|
||||
```
|
||||
```bash
|
||||
scrcpy --no-video
|
||||
# interrupt with Ctrl+C
|
||||
```
|
||||
|
||||
Without video, the audio latency is typically not criticial, so it might be
|
||||
|
||||
@@ -168,6 +168,7 @@ the computer. This option is useful when [recording](recording.md) or when
|
||||
```bash
|
||||
scrcpy --v4l2-sink=/dev/video2 --no-playback
|
||||
scrcpy --record=file.mkv --no-playback
|
||||
# interrupt with Ctrl+C
|
||||
```
|
||||
|
||||
It is also possible to disable video and audio playback separately:
|
||||
|
||||
@@ -163,7 +163,7 @@ public final class AudioCapture {
|
||||
// - an estimation from the previous PTS and the packet size as a fallback.
|
||||
//
|
||||
// Therefore, the property that PTS are monotonically increasing is no guaranteed in corner cases, so enforce it.
|
||||
pts = previousPts + 1;
|
||||
pts = previousPts;
|
||||
}
|
||||
previousPts = pts;
|
||||
|
||||
|
||||
@@ -105,8 +105,17 @@ public final class AudioEncoder implements AsyncProcessor {
|
||||
private void outputThread(MediaCodec mediaCodec) throws IOException, InterruptedException {
|
||||
streamer.writeAudioHeader();
|
||||
|
||||
long lastPts = 0;
|
||||
while (!Thread.currentThread().isInterrupted()) {
|
||||
OutputTask task = outputTasks.take();
|
||||
|
||||
if (task.bufferInfo.presentationTimeUs < lastPts) {
|
||||
// Fix PTS if not monotonically increasing
|
||||
task.bufferInfo.presentationTimeUs = lastPts;
|
||||
} else {
|
||||
lastPts = task.bufferInfo.presentationTimeUs;
|
||||
}
|
||||
|
||||
ByteBuffer buffer = mediaCodec.getOutputBuffer(task.index);
|
||||
try {
|
||||
streamer.writePacket(buffer, task.bufferInfo);
|
||||
|
||||
Reference in New Issue
Block a user