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

[REQUEST]: Mipmap support for incoming video streams #1032

Open
colindefais opened this issue May 15, 2024 · 0 comments
Open

[REQUEST]: Mipmap support for incoming video streams #1032

colindefais opened this issue May 15, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@colindefais
Copy link

Is your feature request related to a problem?

I'm always frustrated when streaming screen capture video to my Unity WebRTC project the texture looks pixelated if viewed from far:
image

Describe the solution you'd like

It would be great if we could enable mipmaps on the texture returned by VideoStreamTrack.OnVideoReceived:
image

Describe alternatives you've considered

I have tried to make changes to the package but I only managed to get the first mip level populated (I am not very familiar with low level graphics commands, maybe someone more experimented have an idea where I am wrong)

VideoStreamTrack.CreateRenderTexture():

var tex = new RenderTexture(width, height, 0, format);
tex.useMipMap = true;
tex.autoGenerateMips = false;
tex.Create();

VideoStreamTrack.OnVideoFrameResizeInternal():

var format = WebRTC.GetSupportedGraphicsFormat(SystemInfo.graphicsDeviceType);
Texture = new Texture2D(width, height, format, TextureCreationFlags.MipChain);
track.OnVideoFrameResize(Texture);

VideoDecoderMethods.UpdateRendererTexture():

_command.IssuePluginCustomTextureUpdateV2(callback, texture, rendererId);
Graphics.ExecuteCommandBuffer(_command);
_command.GenerateMips(texture);
_command.Clear();

Additional context

No response

@colindefais colindefais added the enhancement New feature or request label May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants