@midscene/playground-app 1.8.2-beta-20260518024627.0 → 1.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,10 +3,7 @@ function toUint8Array(data) {
|
|
|
3
3
|
if (data instanceof ArrayBuffer) return new Uint8Array(data);
|
|
4
4
|
return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
function createScrcpyVideoStream(socket, options = {}) {
|
|
8
|
-
var _options_bufferLimit;
|
|
9
|
-
const bufferLimit = Math.max(1, null != (_options_bufferLimit = options.bufferLimit) ? _options_bufferLimit : DEFAULT_BUFFER_LIMIT);
|
|
6
|
+
function createScrcpyVideoStream(socket) {
|
|
10
7
|
let configurationPacketSent = false;
|
|
11
8
|
let pendingDataPackets = [];
|
|
12
9
|
const transformStream = new TransformStream({
|
|
@@ -18,15 +15,7 @@ function createScrcpyVideoStream(socket, options = {}) {
|
|
|
18
15
|
pendingDataPackets = [];
|
|
19
16
|
return;
|
|
20
17
|
}
|
|
21
|
-
if ('data' === chunk.type && !configurationPacketSent)
|
|
22
|
-
if (pendingDataPackets.length >= bufferLimit) {
|
|
23
|
-
const firstNonKeyframeIdx = pendingDataPackets.findIndex((packet)=>'data' === packet.type && !packet.keyframe);
|
|
24
|
-
if (-1 !== firstNonKeyframeIdx) pendingDataPackets.splice(firstNonKeyframeIdx, 1);
|
|
25
|
-
else pendingDataPackets.shift();
|
|
26
|
-
}
|
|
27
|
-
pendingDataPackets.push(chunk);
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
18
|
+
if ('data' === chunk.type && !configurationPacketSent) return void pendingDataPackets.push(chunk);
|
|
30
19
|
controller.enqueue(chunk);
|
|
31
20
|
}
|
|
32
21
|
});
|
|
@@ -40,10 +29,6 @@ function createScrcpyVideoStream(socket, options = {}) {
|
|
|
40
29
|
type: 'configuration',
|
|
41
30
|
data: payload
|
|
42
31
|
});
|
|
43
|
-
var _controller_desiredSize;
|
|
44
|
-
const desiredSize = null != (_controller_desiredSize = controller.desiredSize) ? _controller_desiredSize : 1;
|
|
45
|
-
const isKeyframe = true === data.keyFrame;
|
|
46
|
-
if (desiredSize <= 0 && !isKeyframe) return;
|
|
47
32
|
controller.enqueue({
|
|
48
33
|
type: 'data',
|
|
49
34
|
data: payload,
|
|
@@ -67,8 +52,6 @@ function createScrcpyVideoStream(socket, options = {}) {
|
|
|
67
52
|
cancel () {
|
|
68
53
|
null == cleanupListeners || cleanupListeners();
|
|
69
54
|
}
|
|
70
|
-
}, {
|
|
71
|
-
highWaterMark: bufferLimit
|
|
72
55
|
});
|
|
73
56
|
return readable.pipeThrough(transformStream);
|
|
74
57
|
}
|
|
@@ -31,10 +31,7 @@ function toUint8Array(data) {
|
|
|
31
31
|
if (data instanceof ArrayBuffer) return new Uint8Array(data);
|
|
32
32
|
return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
function createScrcpyVideoStream(socket, options = {}) {
|
|
36
|
-
var _options_bufferLimit;
|
|
37
|
-
const bufferLimit = Math.max(1, null != (_options_bufferLimit = options.bufferLimit) ? _options_bufferLimit : DEFAULT_BUFFER_LIMIT);
|
|
34
|
+
function createScrcpyVideoStream(socket) {
|
|
38
35
|
let configurationPacketSent = false;
|
|
39
36
|
let pendingDataPackets = [];
|
|
40
37
|
const transformStream = new TransformStream({
|
|
@@ -46,15 +43,7 @@ function createScrcpyVideoStream(socket, options = {}) {
|
|
|
46
43
|
pendingDataPackets = [];
|
|
47
44
|
return;
|
|
48
45
|
}
|
|
49
|
-
if ('data' === chunk.type && !configurationPacketSent)
|
|
50
|
-
if (pendingDataPackets.length >= bufferLimit) {
|
|
51
|
-
const firstNonKeyframeIdx = pendingDataPackets.findIndex((packet)=>'data' === packet.type && !packet.keyframe);
|
|
52
|
-
if (-1 !== firstNonKeyframeIdx) pendingDataPackets.splice(firstNonKeyframeIdx, 1);
|
|
53
|
-
else pendingDataPackets.shift();
|
|
54
|
-
}
|
|
55
|
-
pendingDataPackets.push(chunk);
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
46
|
+
if ('data' === chunk.type && !configurationPacketSent) return void pendingDataPackets.push(chunk);
|
|
58
47
|
controller.enqueue(chunk);
|
|
59
48
|
}
|
|
60
49
|
});
|
|
@@ -68,10 +57,6 @@ function createScrcpyVideoStream(socket, options = {}) {
|
|
|
68
57
|
type: 'configuration',
|
|
69
58
|
data: payload
|
|
70
59
|
});
|
|
71
|
-
var _controller_desiredSize;
|
|
72
|
-
const desiredSize = null != (_controller_desiredSize = controller.desiredSize) ? _controller_desiredSize : 1;
|
|
73
|
-
const isKeyframe = true === data.keyFrame;
|
|
74
|
-
if (desiredSize <= 0 && !isKeyframe) return;
|
|
75
60
|
controller.enqueue({
|
|
76
61
|
type: 'data',
|
|
77
62
|
data: payload,
|
|
@@ -95,8 +80,6 @@ function createScrcpyVideoStream(socket, options = {}) {
|
|
|
95
80
|
cancel () {
|
|
96
81
|
null == cleanupListeners || cleanupListeners();
|
|
97
82
|
}
|
|
98
|
-
}, {
|
|
99
|
-
highWaterMark: bufferLimit
|
|
100
83
|
});
|
|
101
84
|
return readable.pipeThrough(transformStream);
|
|
102
85
|
}
|
|
@@ -13,20 +13,5 @@ interface ScrcpyVideoSocketLike {
|
|
|
13
13
|
off(event: 'disconnect', handler: () => void): void;
|
|
14
14
|
off(event: 'error', handler: (error: Error) => void): void;
|
|
15
15
|
}
|
|
16
|
-
export
|
|
17
|
-
/**
|
|
18
|
-
* Hard cap on packets buffered between the socket and the decoder before we
|
|
19
|
-
* start dropping non-keyframe `data` packets. The socket is push-only — if
|
|
20
|
-
* the WebCodecs decoder briefly stalls (GC pause, low-memory machine), the
|
|
21
|
-
* ReadableStream's internal queue can otherwise grow without bound and the
|
|
22
|
-
* renderer process is killed with `Crashpad_NotConnectedToHandle` on
|
|
23
|
-
* memory-constrained machines (reported on 8 GB Windows).
|
|
24
|
-
*
|
|
25
|
-
* `configuration` packets and keyframes are always preserved so the decoder
|
|
26
|
-
* can recover after a drop — losing them would freeze the picture instead
|
|
27
|
-
* of just dropping a frame.
|
|
28
|
-
*/
|
|
29
|
-
bufferLimit?: number;
|
|
30
|
-
}
|
|
31
|
-
export declare function createScrcpyVideoStream(socket: ScrcpyVideoSocketLike, options?: CreateScrcpyVideoStreamOptions): ReadableStream<ScrcpyMediaStreamPacket>;
|
|
16
|
+
export declare function createScrcpyVideoStream(socket: ScrcpyVideoSocketLike): ReadableStream<ScrcpyMediaStreamPacket>;
|
|
32
17
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midscene/playground-app",
|
|
3
|
-
"version": "1.8.2
|
|
3
|
+
"version": "1.8.2",
|
|
4
4
|
"description": "Reusable React shell for Midscene playground applications",
|
|
5
5
|
"repository": "https://github.com/web-infra-dev/midscene",
|
|
6
6
|
"homepage": "https://midscenejs.com/",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"antd": "^5.21.6",
|
|
29
29
|
"react-resizable-panels": "2.0.22",
|
|
30
30
|
"socket.io-client": "4.8.1",
|
|
31
|
-
"@midscene/
|
|
32
|
-
"@midscene/
|
|
33
|
-
"@midscene/visualizer": "1.8.2
|
|
31
|
+
"@midscene/shared": "1.8.2",
|
|
32
|
+
"@midscene/playground": "1.8.2",
|
|
33
|
+
"@midscene/visualizer": "1.8.2"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@rsbuild/plugin-less": "^1.5.0",
|