自定义采集视频通话,其他的都正常,可以进行通话,就是播放的时候颜色不对,如下图
被采集的是蓝色的,通话后显示的却是橙色的了
请问这个是什么原因呢?
采集方法如下
RenderTexture.active = renderTexture;
mTexture.ReadPixels(new Rect(0, 0, renderTexture.width, renderTexture.height), 0, 0);
mTexture.Apply();
RenderTexture.active = null;
byte[] bytes = mTexture.GetRawTextureData();
IRtcEngine rtc = IRtcEngine.QueryEngine();
if (rtc != null)
{
ExternalVideoFrame externalVideoFrame = new ExternalVideoFrame();
externalVideoFrame.type = ExternalVideoFrame.VIDEO_BUFFER_TYPE.VIDEO_BUFFER_RAW_DATA;
externalVideoFrame.format = ExternalVideoFrame.VIDEO_PIXEL_FORMAT.VIDEO_PIXEL_BGRA;
externalVideoFrame.buffer = bytes;
externalVideoFrame.stride = (int)mRect.width;
externalVideoFrame.height = (int)mRect.height;
externalVideoFrame.timestamp = i++;
// 推送外部视频帧。
int a = rtc.PushVideoFrame(externalVideoFrame);
}
这个问题一般是视频帧的格式设置错误导致的。请确保你设置的
AgoraVideoFrame.format
和采集到的视频帧数据格式是一致的。解决了么