Loading common/config/rush/pnpm-lock.yaml +4 −1 Original line number Diff line number Diff line Loading @@ -380,6 +380,9 @@ importers: ../../libraries/scrcpy: dependencies: '@yume-chan/async': specifier: ^2.2.0 version: 2.2.0 '@yume-chan/no-data-view': specifier: workspace:^0.0.23 version: link:../no-data-view Loading common/config/rush/repo-state.json +1 −1 Original line number Diff line number Diff line // DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush. { "pnpmShrinkwrapHash": "0614fa404f36d8761fbac03dd9201e806b5c468e", "pnpmShrinkwrapHash": "c1a7aa8a614d364cced2ff0b11ae2cd00e133961", "preferredVersionsHash": "bf21a9e8fbc5a3846fb05b4fa0859e0917b2202f" } libraries/adb-scrcpy/src/client.ts +20 −22 Original line number Diff line number Diff line Loading @@ -7,7 +7,6 @@ import type { ScrcpyAudioStreamDisabledMetadata, ScrcpyAudioStreamErroredMetadata, ScrcpyAudioStreamSuccessMetadata, ScrcpyDeviceMessage, ScrcpyDisplay, ScrcpyEncoder, ScrcpyMediaStreamPacket, Loading @@ -17,7 +16,6 @@ import { Av1, DEFAULT_SERVER_PATH, ScrcpyControlMessageWriter, ScrcpyDeviceMessageDeserializeStream, ScrcpyVideoCodecId, h264ParseConfiguration, h265ParseConfiguration, Loading @@ -30,6 +28,7 @@ import type { } from "@yume-chan/stream-extra"; import { AbortController, BufferedReadableStream, DecodeUtf8Stream, InspectStream, PushReadableStream, Loading Loading @@ -290,28 +289,15 @@ export class AdbScrcpyClient { return this.#audioStream; } #controlMessageWriter: ScrcpyControlMessageWriter | undefined; #controller: ScrcpyControlMessageWriter | undefined; /** * Gets the control message writer. * * On server version 1.22 and above, it will be `undefined` if * control is disabled by `options.control: false`. */ get controlMessageWriter() { return this.#controlMessageWriter; } #deviceMessageStream: ReadableStream<ScrcpyDeviceMessage> | undefined; /** * Gets the device message stream. * * On server version 1.22 and above, it will be `undefined` if * control is disabled by `options.control: false`. * * Note: it must be consumed to prevent the connection from being blocked. */ get deviceMessageStream() { return this.#deviceMessageStream; get controller() { return this.#controller; } constructor({ Loading @@ -335,13 +321,25 @@ export class AdbScrcpyClient { : undefined; if (controlStream) { this.#controlMessageWriter = new ScrcpyControlMessageWriter( this.#controller = new ScrcpyControlMessageWriter( controlStream.writable.getWriter(), options, ); this.#deviceMessageStream = controlStream.readable.pipeThrough( new ScrcpyDeviceMessageDeserializeStream(), ); this.#parseDeviceMessages(controlStream.readable).catch(() => {}); } } async #parseDeviceMessages(controlStream: ReadableStream<Uint8Array>) { const buffered = new BufferedReadableStream(controlStream); while (true) { const type = await buffered.readExactly(1); if (!(await this.#options.parseDeviceMessage(type[0]!, buffered))) { buffered .cancel(new Error(`Unknown device message type ${type[0]}`)) .catch(() => {}); break; } } } Loading libraries/scrcpy/package.json +1 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ "prepublishOnly": "npm run build" }, "dependencies": { "@yume-chan/async": "^2.2.0", "@yume-chan/no-data-view": "workspace:^0.0.23", "@yume-chan/stream-extra": "workspace:^0.0.23", "@yume-chan/struct": "workspace:^0.0.23", Loading libraries/scrcpy/src/control/writer.ts +3 −1 Original line number Diff line number Diff line Loading @@ -90,7 +90,9 @@ export class ScrcpyControlMessageWriter { async setClipboard( message: Omit<ScrcpySetClipboardControlMessage, "type">, ) { await this.write(this.#serializer.setClipboard(message)); const [data, promise] = this.#serializer.setClipboard(message); await this.write(data); await promise; } releaseLock() { Loading Loading
common/config/rush/pnpm-lock.yaml +4 −1 Original line number Diff line number Diff line Loading @@ -380,6 +380,9 @@ importers: ../../libraries/scrcpy: dependencies: '@yume-chan/async': specifier: ^2.2.0 version: 2.2.0 '@yume-chan/no-data-view': specifier: workspace:^0.0.23 version: link:../no-data-view Loading
common/config/rush/repo-state.json +1 −1 Original line number Diff line number Diff line // DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush. { "pnpmShrinkwrapHash": "0614fa404f36d8761fbac03dd9201e806b5c468e", "pnpmShrinkwrapHash": "c1a7aa8a614d364cced2ff0b11ae2cd00e133961", "preferredVersionsHash": "bf21a9e8fbc5a3846fb05b4fa0859e0917b2202f" }
libraries/adb-scrcpy/src/client.ts +20 −22 Original line number Diff line number Diff line Loading @@ -7,7 +7,6 @@ import type { ScrcpyAudioStreamDisabledMetadata, ScrcpyAudioStreamErroredMetadata, ScrcpyAudioStreamSuccessMetadata, ScrcpyDeviceMessage, ScrcpyDisplay, ScrcpyEncoder, ScrcpyMediaStreamPacket, Loading @@ -17,7 +16,6 @@ import { Av1, DEFAULT_SERVER_PATH, ScrcpyControlMessageWriter, ScrcpyDeviceMessageDeserializeStream, ScrcpyVideoCodecId, h264ParseConfiguration, h265ParseConfiguration, Loading @@ -30,6 +28,7 @@ import type { } from "@yume-chan/stream-extra"; import { AbortController, BufferedReadableStream, DecodeUtf8Stream, InspectStream, PushReadableStream, Loading Loading @@ -290,28 +289,15 @@ export class AdbScrcpyClient { return this.#audioStream; } #controlMessageWriter: ScrcpyControlMessageWriter | undefined; #controller: ScrcpyControlMessageWriter | undefined; /** * Gets the control message writer. * * On server version 1.22 and above, it will be `undefined` if * control is disabled by `options.control: false`. */ get controlMessageWriter() { return this.#controlMessageWriter; } #deviceMessageStream: ReadableStream<ScrcpyDeviceMessage> | undefined; /** * Gets the device message stream. * * On server version 1.22 and above, it will be `undefined` if * control is disabled by `options.control: false`. * * Note: it must be consumed to prevent the connection from being blocked. */ get deviceMessageStream() { return this.#deviceMessageStream; get controller() { return this.#controller; } constructor({ Loading @@ -335,13 +321,25 @@ export class AdbScrcpyClient { : undefined; if (controlStream) { this.#controlMessageWriter = new ScrcpyControlMessageWriter( this.#controller = new ScrcpyControlMessageWriter( controlStream.writable.getWriter(), options, ); this.#deviceMessageStream = controlStream.readable.pipeThrough( new ScrcpyDeviceMessageDeserializeStream(), ); this.#parseDeviceMessages(controlStream.readable).catch(() => {}); } } async #parseDeviceMessages(controlStream: ReadableStream<Uint8Array>) { const buffered = new BufferedReadableStream(controlStream); while (true) { const type = await buffered.readExactly(1); if (!(await this.#options.parseDeviceMessage(type[0]!, buffered))) { buffered .cancel(new Error(`Unknown device message type ${type[0]}`)) .catch(() => {}); break; } } } Loading
libraries/scrcpy/package.json +1 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ "prepublishOnly": "npm run build" }, "dependencies": { "@yume-chan/async": "^2.2.0", "@yume-chan/no-data-view": "workspace:^0.0.23", "@yume-chan/stream-extra": "workspace:^0.0.23", "@yume-chan/struct": "workspace:^0.0.23", Loading
libraries/scrcpy/src/control/writer.ts +3 −1 Original line number Diff line number Diff line Loading @@ -90,7 +90,9 @@ export class ScrcpyControlMessageWriter { async setClipboard( message: Omit<ScrcpySetClipboardControlMessage, "type">, ) { await this.write(this.#serializer.setClipboard(message)); const [data, promise] = this.#serializer.setClipboard(message); await this.write(data); await promise; } releaseLock() { Loading