Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send uStride and vStride when call GetVideoFrameCache #1153

Merged
merged 1 commit into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions source_code/agora_node_ext/agora_electron_bridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,9 @@ napi_value AgoraElectronBridge::GetVideoFrame(napi_env env,
int height;
int width;
int yStride;
int uStride;
int vStride;


napi_obj_get_property(env, obj, "uid", config.uid);
napi_obj_get_property(env, obj, "videoSourceType", config.video_source_type);
Expand All @@ -410,6 +413,9 @@ napi_value AgoraElectronBridge::GetVideoFrame(napi_env env,
napi_obj_get_property(env, obj, "height", height);
napi_obj_get_property(env, obj, "width", width);
napi_obj_get_property(env, obj, "yStride", yStride);
napi_obj_get_property(env, obj, "uStride", uStride);
napi_obj_get_property(env, obj, "vStride", vStride);


IrisCVideoFrame videoFrame;
videoFrame.yBuffer = (uint8_t *) y_buffer;
Expand All @@ -418,6 +424,8 @@ napi_value AgoraElectronBridge::GetVideoFrame(napi_env env,
videoFrame.height = height;
videoFrame.width = width;
videoFrame.yStride = yStride;
videoFrame.uStride = uStride;
videoFrame.vStride = vStride;
videoFrame.metadata_buffer = nullptr;
videoFrame.metadata_size = 0;
videoFrame.alphaBuffer = nullptr;
Expand All @@ -442,6 +450,8 @@ napi_value AgoraElectronBridge::GetVideoFrame(napi_env env,
napi_obj_set_property(env, retObj, "width", videoFrame.width);
napi_obj_set_property(env, retObj, "height", videoFrame.height);
napi_obj_set_property(env, retObj, "yStride", videoFrame.yStride);
napi_obj_set_property(env, retObj, "uStride", videoFrame.uStride);
napi_obj_set_property(env, retObj, "vStride", videoFrame.vStride);
napi_obj_set_property(env, retObj, "rotation", rotation);
napi_obj_set_property(env, retObj, "timestamp", videoFrame.renderTimeMs);
return retObj;
Expand Down
12 changes: 9 additions & 3 deletions ts/Renderer/RendererManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,14 +373,16 @@ export class RendererManager extends IRendererManager {
break;
case 1: {
// GET_VIDEO_FRAME_CACHE_RETURN_TYPE::RESIZED
const { width, height, yStride } = finalResult;
const { width, height, yStride, uStride, vStride } = finalResult;
const newShareVideoFrame = this.resizeShareVideoFrame(
videoSourceType,
channelId,
uid,
width,
height,
yStride
yStride,
uStride,
vStride
);
rendererItem.shareVideoFrame = newShareVideoFrame;
finalResult = this.msgBridge.GetVideoFrame(newShareVideoFrame);
Expand Down Expand Up @@ -621,7 +623,9 @@ export class RendererManager extends IRendererManager {
uid: number,
width = 0,
height = 0,
yStride = 0
yStride = 0,
uStride = 0,
vStride = 0
): ShareVideoFrame {
return {
videoSourceType,
Expand All @@ -633,6 +637,8 @@ export class RendererManager extends IRendererManager {
width,
height,
yStride,
uStride,
vStride,
};
}

Expand Down
2 changes: 2 additions & 0 deletions ts/Renderer/YUVCanvasRenderer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export class YUVCanvasRenderer extends IRenderer {
width: 0,
height: 0,
yStride: 0,
uStride: 0,
vStride: 0,
yBuffer: new Uint8Array(0),
uBuffer: new Uint8Array(0),
vBuffer: new Uint8Array(0),
Expand Down
10 changes: 10 additions & 0 deletions ts/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,14 @@ export interface ShareVideoFrame {
* @ignore
*/
yStride: number;
/**
* @ignore
*/
uStride: number;
/**
* @ignore
*/
vStride: number;
/**
* @ignore
*/
Expand Down Expand Up @@ -270,6 +278,8 @@ export interface AgoraElectronBridge {
ret: number;
isNewFrame: boolean;
yStride: number;
uStride: number;
vStride: number;
width: number;
height: number;
rotation: number;
Expand Down
Loading