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

Use pushVideoFrame special card #1869

Open
1 of 5 tasks
Nuyoahhjh opened this issue Jun 26, 2024 · 6 comments
Open
1 of 5 tasks

Use pushVideoFrame special card #1869

Nuyoahhjh opened this issue Jun 26, 2024 · 6 comments
Labels
waiting for customer response waiting for customer response, or closed by no-reponse bot

Comments

@Nuyoahhjh
Copy link

Version of the agora_rtc_engine

6.3.2

Platforms affected

  • Android
  • iOS
  • macOS
  • Windows
  • Web

Steps to reproduce

1, onCaptureVideoFrame to obtain the original data,
2. Push yuv through pushVideoFrame
code:`
_videoFrameObserver = VideoFrameObserver(
onCaptureVideoFrame: (sourceType, videoFrame) {
// print(
// 'Captured video frame from $sourceType size: ${videoFrame.width}x${videoFrame.height} y: ${videoFrame.yBuffer?.length} u:${videoFrame.uBuffer?.length} v:${videoFrame.vBuffer?.length}');
if (!isJoined) {
return;
}
if (videoFrame.yBuffer != null &&
videoFrame.uBuffer != null &&
videoFrame.vBuffer != null &&
videoFrame.width != null &&
videoFrame.height != null) {
// 创建一个新缓冲区来存储拼接后的数据
final int totalLength = videoFrame.yBuffer!.length +
videoFrame.uBuffer!.length +
videoFrame.vBuffer!.length;
final Uint8List yuvBuffer = Uint8List(totalLength);

      // 拼接缓冲区数据
      yuvBuffer.setRange(
          0, videoFrame.yBuffer!.length, videoFrame.yBuffer!);
      yuvBuffer.setRange(
          videoFrame.yBuffer!.length,
          videoFrame.yBuffer!.length + videoFrame.uBuffer!.length,
          videoFrame.uBuffer!);
      yuvBuffer.setRange(
          videoFrame.yBuffer!.length + videoFrame.uBuffer!.length,
          totalLength,
          videoFrame.vBuffer!);
      
      _engine.getMediaEngine().pushVideoFrame(
            frame: ExternalVideoFrame(
              type: VideoBufferType.videoBufferArray,
              format: VideoPixelFormat.videoPixelNv12,
              buffer: yuvBuffer,
              stride: videoFrame.width!,
              height: videoFrame.height!,
              timestamp: videoFrame.renderTimeMs,
            ),
          );
    }
  },
);

`

Expected results

Local preview screen change card
High CPU usage

Actual results

Local preview screen change card
High CPU usage

Code sample

Code sample
[Paste your code here]

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[Paste your output here]
@littleGnAl
Copy link
Collaborator

Why do you need to get the video raw data from the SDK, and then push it back?

@littleGnAl littleGnAl added the waiting for customer response waiting for customer response, or closed by no-reponse bot label Jun 26, 2024
@Nuyoahhjh
Copy link
Author

I need a usb compatible camera here

@github-actions github-actions bot removed the waiting for customer response waiting for customer response, or closed by no-reponse bot label Jun 26, 2024
@Nuyoahhjh
Copy link
Author

@littleGnAl

@littleGnAl
Copy link
Collaborator

I think if you can get the raw data from the onCaptureVideoFrame , it can be previewed with AgoraVideoView or published using the joinChannel function.

@littleGnAl littleGnAl added the waiting for customer response waiting for customer response, or closed by no-reponse bot label Jun 26, 2024
@Nuyoahhjh
Copy link
Author

I think pushVideoFrame is pushing data to the remote end

@github-actions github-actions bot removed the waiting for customer response waiting for customer response, or closed by no-reponse bot label Jun 26, 2024
@littleGnAl
Copy link
Collaborator

You can use joinChannel to publish it to remote users.

@littleGnAl littleGnAl added the waiting for customer response waiting for customer response, or closed by no-reponse bot label Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for customer response waiting for customer response, or closed by no-reponse bot
Projects
None yet
Development

No branches or pull requests

2 participants