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

Add a new builtin module that allows the creation of a custom MediaStream #8

Merged
merged 2 commits into from
Jan 21, 2021

Conversation

mikepavone
Copy link

This is the electron/chromium half of the new video pipeline. The integration is a little funny due to the way electron handles customizing chromium. Essentially there are patches to the chromium tree which are very flexible, but difficult to maintain and there are builtin node modules. The latter is easier to maintain, but our need to output real MediaStream objects means we can't use the normal context bridge which means we need to handle installing the function into the main context ourselves.

A couple other notes on this:

  • Currently only supports i420 and shared textures (kNative, windows only), but I think that's all we need for our purposes currently
  • Shared texture support needs some work before it works properly, but since those are only useful for screen capture preview, it doesn't block getting an initial version out
  • Exposed interface is purely C, in part because we used to use different compilers for electron and discord_voice. Might not be necessary now that everything is clang

…ream that can accept frames from discord_voice directly
Copy link

@eiz eiz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generally seems 👍 . minor comments

default_app/preload.ts Outdated Show resolved Hide resolved
gpu_memory_buffer_support_->CreateGpuMemoryBufferImplFromHandle(
std::move(buffer_handle), size, gfx::BufferFormat::RGBA_8888,
gfx::BufferUsage::GPU_READ, base::DoNothing());
auto mailbox = sii->CreateSharedImage(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we're not using the shared texture path atm but it's surprising to me that we'd do this bit per-frame. Is it cheap?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about the cost. The shared texture path was very much in the "try to get it to work at all" phase when I paused work on it. Definitely would be better to avoid this setup for textures we've already seen.

discord/discord_video_source.cc Outdated Show resolved Hide resolved
Copy link
Member

@adill adill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbh i'd prefer if this was a chromium patch and exposed by default (it certainly feels "off" to be reaching in to and extending blink like this from electron), however, in the end i don't think it matters much either way. (i.e. so we'd just new DiscordVideoStream(streamId))

keeping a strictly C interface is a good call either way, i'd say 👍

discord/module.cc Outdated Show resolved Hide resolved
discord/discord_video_source.h Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants