trtc-electron-sdk 9.3.301 → 9.5.0-beta.0

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.
@@ -74,7 +74,6 @@ class Renderer {
74
74
  this.yuv = null;
75
75
  this.element = null;
76
76
  this.canvas = null;
77
- this.view = null;
78
77
  }
79
78
  refreshCanvas() {
80
79
  }
@@ -109,11 +108,49 @@ class Renderer {
109
108
  this.canvas.style.transform = 'rotateY(180deg)';
110
109
  }
111
110
  }
111
+ _adjustImageData(imageData) {
112
+ const { width, height, yUint8Array, uUint8Array, vUint8Array } = imageData;
113
+ const widthBase = 8;
114
+ const w8Modulo = width % widthBase;
115
+ if (w8Modulo !== 0) {
116
+ const newWidth = width - w8Modulo;
117
+ const newYSize = newWidth * height;
118
+ const newYArrayBuffer = new ArrayBuffer(newYSize);
119
+ const newYUint8Array = new Uint8Array(newYArrayBuffer);
120
+ let oldIndex = -1, newIndex = -1;
121
+ for (let h = 0; h < height; h += 1) {
122
+ for (let w = 0; w < newWidth; w += 1) {
123
+ oldIndex = width * h + w;
124
+ newIndex = newWidth * h + w;
125
+ newYUint8Array[newIndex] = yUint8Array[oldIndex];
126
+ }
127
+ }
128
+ const oldChromaWidth = width / 2;
129
+ const newChromaWidth = newWidth / 2;
130
+ const chromaHeight = height / 2;
131
+ const newChromaSize = newChromaWidth * chromaHeight;
132
+ const newUArrayBuffer = new ArrayBuffer(newChromaSize);
133
+ const newUInt8Array = new Uint8Array(newUArrayBuffer);
134
+ const newVArrayBuffer = new ArrayBuffer(newChromaSize);
135
+ const newVInt8Array = new Uint8Array(newVArrayBuffer);
136
+ for (let h = 0; h < chromaHeight; h += 1) {
137
+ for (let w = 0; w < newChromaWidth; w += 1) {
138
+ oldIndex = oldChromaWidth * h + w;
139
+ newIndex = newChromaWidth * h + w;
140
+ newUInt8Array[newIndex] = uUint8Array[oldIndex];
141
+ newVInt8Array[newIndex] = vUint8Array[oldIndex];
142
+ }
143
+ }
144
+ return Object.assign(Object.assign({}, imageData), { width: newWidth, height, yUint8Array: newYUint8Array, uUint8Array: newUInt8Array, vUint8Array: newVInt8Array });
145
+ }
146
+ return imageData;
147
+ }
112
148
  drawFrame(imageData) {
113
149
  if (!this.ready) {
114
150
  this.ready = true;
115
151
  this.event.emit('ready');
116
152
  }
153
+ imageData = this._adjustImageData(imageData);
117
154
  const mirror = 0;
118
155
  const contentWidth = imageData.width;
119
156
  const contentHeight = imageData.height;
package/liteav/trtc.js CHANGED
@@ -1300,7 +1300,7 @@ class TRTCCloud extends events_1.EventEmitter {
1300
1300
  */
1301
1301
  startPublishCDNStream(param) {
1302
1302
  if (param instanceof trtc_define_1.TRTCPublishCDNParam) {
1303
- this.rtcCloud.startPublishCDNStream(param.appId, param.bizId, param.url);
1303
+ this.rtcCloud.startPublishCDNStream(param.appId, param.bizId, param.url, param.streamId);
1304
1304
  }
1305
1305
  else {
1306
1306
  console.error('startPublishCDNStream, param is not instanceof TRTCPublishCDNParam!');
@@ -3322,7 +3322,7 @@ class TRTCCloud extends events_1.EventEmitter {
3322
3322
  let ulen = width * height / 4;
3323
3323
  let ydata = new Uint8Array(data, 0, ylen);
3324
3324
  let udata = new Uint8Array(data, ylen, ulen);
3325
- let vdata = new Uint8Array(data, ylen + ulen, data.le);
3325
+ let vdata = new Uint8Array(data, ylen + ulen, ulen);
3326
3326
  renderer.drawFrame({
3327
3327
  width: width,
3328
3328
  height: height,
@@ -507,7 +507,8 @@ export declare class TRTCPublishCDNParam {
507
507
  appId: number;
508
508
  bizId: number;
509
509
  url: null | string;
510
- constructor(appId?: number, bizId?: number, url?: null | string);
510
+ streamId: string;
511
+ constructor(appId?: number, bizId?: number, url?: null | string, streamId?: string);
511
512
  }
512
513
  /**
513
514
  * 5.13 录音参数
@@ -1067,10 +1067,11 @@ exports.TRTCTranscodingConfig = TRTCTranscodingConfig;
1067
1067
  *
1068
1068
  */
1069
1069
  class TRTCPublishCDNParam {
1070
- constructor(appId = 0, bizId = 0, url = null) {
1070
+ constructor(appId = 0, bizId = 0, url = null, streamId = '') {
1071
1071
  this.appId = appId;
1072
1072
  this.bizId = bizId;
1073
1073
  this.url = url;
1074
+ this.streamId = streamId;
1074
1075
  }
1075
1076
  }
1076
1077
  exports.TRTCPublishCDNParam = TRTCPublishCDNParam;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trtc-electron-sdk",
3
- "version": "9.3.301",
3
+ "version": "9.5.0-beta.0",
4
4
  "description": "trtc electron sdk",
5
5
  "main": "./liteav/trtc.js",
6
6
  "types": "./liteav/trtc.d.ts",