Skip to content

Commit

Permalink
next release
Browse files Browse the repository at this point in the history
  • Loading branch information
UrielCh committed Jul 27, 2022
1 parent 007bfec commit f598808
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## v4.1.3 (2022-07-27)
* refactor debug
* new debug messages
* add firstFrame promise to Minicap and Scrcpy
* improve Minicap and Scrcpy resiliance

## v4.1.2 (2022-07-27)
* minicap kill previous instance on startup
* minicap only upload its binary if thet are missing
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@u4/adbkit",
"version": "4.1.2",
"version": "4.1.3",
"description": "A Typescript client for the Android Debug Bridge.",
"keywords": [
"adb",
Expand Down
12 changes: 12 additions & 0 deletions src/adb/thirdparty/minicap/Minicap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export default class Minicap extends EventEmitter {
private _virtualHigth: Promise<number>;
private _orientation: Promise<number>;
private _bitflags: Promise<number>;
private _firstFrame: Promise<void>;

private setVersion: (version: number) => void;
private setPid: (version: number) => void;
Expand All @@ -47,6 +48,7 @@ export default class Minicap extends EventEmitter {
private setVirtualHigth: (height: number) => void;
private setOrientation: (height: number) => void;
private setBitflags: (height: number) => void;
private setFirstFrame: (() => void) | null;
/**
* closed had been call stop all new activity
*/
Expand All @@ -66,6 +68,7 @@ export default class Minicap extends EventEmitter {
this._virtualHigth = new Promise<number>((resolve) => this.setVirtualHigth = resolve);
this._orientation = new Promise<number>((resolve) => this.setOrientation = resolve);
this._bitflags = new Promise<number>((resolve) => this.setBitflags = resolve);
this._firstFrame = new Promise<void>((resolve) => this.setFirstFrame = resolve);
}

public on = <K extends keyof IEmissions>(event: K, listener: IEmissions[K]): this => super.on(event, listener)
Expand Down Expand Up @@ -105,6 +108,11 @@ export default class Minicap extends EventEmitter {
* Frame tear might be visible. Informative, no action required. Neither of our current two methods exhibit this behavior.
*/
get QuickTear(): Promise<boolean> { return this.bitflags.then(v => !!(v & 4)); }
/**
* Promise to the first emited frame
* can be used to unsure that scrcpy propery start
*/
get firstFrame(): Promise<void> { return this._firstFrame; }

/**
*
Expand Down Expand Up @@ -258,6 +266,10 @@ export default class Minicap extends EventEmitter {
}
}
if (len === 0) {
if (this.setFirstFrame) {
this.setFirstFrame();
this.setFirstFrame = null;
}
this.emit('data', streamChunk);
break;
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/adb/thirdparty/scrcpy/Scrcpy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export default class Scrcpy extends EventEmitter {

/**
* Promise to the first emited frame
* can be nuse to unsure that scrcpy propery start
* can be used to unsure that scrcpy propery start
*/
get firstFrame(): Promise<void> { return this._firstFrame; }

Expand Down

0 comments on commit f598808

Please # to comment.