daktronics / cef-mixer Goto Github PK
View Code? Open in Web Editor NEWHigh Performance off-screen rendering (OSR) demo using CEF
License: MIT License
High Performance off-screen rendering (OSR) demo using CEF
License: MIT License
Just gave this build a try in our application and in your sample cefmixer
application. In both cases I have excellent performance. Disabling vsync in Chromium definitely helped with responsiveness.
I do have an issue that shows up in both applications though, which is that the --type=renderer
processes are hanging around after the browser process has closed, and they all seem to be spinning on one thread (each taking up 25% on my 4-core CPU). It seems somewhat random when this happens.
Any idea what might be causing this?
Might be worth mentioning that I have an AMD RX 580 graphics card.
As far as I can tell the members added to CefSettings
(shared_texture_enabled
, shared_texture_sync_key
, external_begin_frame_enabled
) don't actually do anything. CefSettingsTraits::set
in cef_types_wrappers.h
don't seem accommodate for these members, so they all get discarded either way.
Any reason for them being there?
Video files played with the <video>
element only shows the first frame in cefmixer
. Using the video link directly seems to work though.
Doesn't work: https://h.ma.pe/webmalpha/
Works: https://h.ma.pe/webmalpha/output.webm
Both seem to work fine in cefclient
with --off-screen-rendering-enabled
.
EDIT: I should note that it shows the same behavior regardless of video container/codec. Alpha or not is irrelevant as well.
Hi, I add some D3D11 Rendering in here, I replace the create_image_layer call with create_d3drender_layer that I wrote. In the end, I render a D3D box into a D3D11Texture and render the texture into Quad.
But there is a problem. When I build with Debug ( I link the release version cef lib in debug mode ), some time the application don't render my box, some time my box show. The times is very random. Is it normal?
After that I try to build Release version, and the box render ,the HTML web page disappear...
I don't know what's happened...
html_layer.cpp
in cefmixer states set the sync key to 0 so Chromium will setup the shared texture with a keyed mutex and sync on key 0
whereas the documentation in cef_types_win.h
states Set to 0 to NOT use a KeyedMutex associated with the shared textures
.
Judging by OffscreenBrowserCompositorOutputSurface::IsValidSyncKey
I'm guessing the one in cef_types_win.h
is incorrect?
... when not using CefBrowserHost::SendExternalBeginFrame
and instead just relying on CEF to do the frame requests itself.
Basically, the implementation of OnAcceleratedPaint
in our own application can sometimes take a while to actually perform the copy from the shared texture. It seems like that delay sometimes causes a blank texture to be copied, resulting in it flickering on and off at random times.
We managed to reproduce the issue with the HUD view in this branch of cefmixer, using .\cefmixer.exe --sleep=30 about:blank
. The branch just removes the usage of SendExternalBeginFrame
and puts a Sleep(...)
in FrameBuffer::on_paint
to simulate some arbitrary delay between OnAcceleratedPaint
being called and the frame actually getting copied. You might have to tweak the length of the sleep in order to reproduce it yourself though.
Here's a small clip showing what it looks like.
Having the application's own vsync on or off doesn't seem to matter, but toggling it can sometimes force the issue to appear.
I think because the 3497 branch has moved on since patch was originally created.
Attached is modified patch for 3497 branch that worked for me as at commit 13f506f9
shared_textures_3497-updated.zip
I try to changed the Cef version to v3.3359.1758 that was compiled by Cef.
I found the class CefRenderHandler contained in file cef_render_handler.h didn't have a member function define:
virtual void OnAcceleratedPaint(CefRefPtr<CefBrowser> browser,PaintElementType ,const RectList& dirtyRects,void* shared_handle,uint64 sync_key) {}
So the IDE return me a error when I inherit from this class, but in your code it is all right.
if using settings ,it can do??
Please update for the latest CEF release(with a new Viz feature)
Hi, I am trying to use it in BGFX project(https://github.com/bkaradzic/bgfx).
But I found the line
Line 253 in 896a609
Hi,
Im try to implement this solution with WPF off-screen application (with is basically d3d9ex).
i managed to render the shared texture (using CEFSHARP) and d3dImage.
the only issue that the frame is flipped and upside down (see attached file).
maybe someone can direct me where in code is the actual rendering to the shared texture ?
i though this is place i need to look for in order to flip the image ( or maybe the origin OGL texture)..
thanks,
b
The link from Step 2 in README.md for x64 sample binary distribution
leads to: https://s3.amazonaws.com/wesselsga/cef/issue_1006/cef_binary_3.3425.1784.gc5ef4df_windows32_minimal.7z
Correct link should be:
https://s3.amazonaws.com/wesselsga/cef/issue_1006/cef_binary_3.3425.1784.gc5ef4df_windows64_minimal.7z
If you don't notice you downloaded 32 bit and continue to step 5, you'll be getting cryptic messages like unresolved external symbol cef_string_utf8_clear
in VS2017 during build.
To support changing video modes dynamically, our application uses WasResized to resize the existing browser view upon detection of a mode change.
However, with this patch set, usage of WasResized (and returning a different resolution in GetViewRect) will stop updating the browser view after resizing it. (OnAcceleratedPaint no longer being called, initial debugging inside Chromium shows that no BeginFrame calls are being generated anymore)
extern "C"
{
__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
}
Is there something for intel GPU like above?
Here is a test build to try on machines that exhibit the issue of freezing after a resize.
If someone, could try this build on another machine exhibiting the issue - it would be greatly appreciated!
Thanks
Excuse me !
can you help me press key event on mixer as default browser ?
me using PreTranslateMessage(MSG* pMsg) on C++/MFC for KEY_DOWN,KEY_UP and broadcast key event for all Layer by code
void Composition::key_press(KeyPress key_event, char key_code) {
decltype(layers_) layers;
{
lock_guard guard(lock_);
layers.assign(layers_.begin(), layers_.end());
}
for (auto const& layer : layers) {
layer->key_press(key_event,key_code);
}
}
WebView class me Using
void WebView::key_press(KeyPress key_event, char key_code) {
auto const browser = safe_browser();
if (browser)
{
CefKeyEvent keyEvent;
keyEvent.type = cef_key_event_type_t::KEYEVENT_CHAR;
keyEvent.windows_key_code = key_code;
browser->GetHost()->SendKeyEvent(keyEvent);
switch (key_event)
{
case KeyPress::Up: keyEvent.type = cef_key_event_type_t::KEYEVENT_KEYUP; break;
case KeyPress::Down: keyEvent.type = cef_key_event_type_t::KEYEVENT_KEYDOWN; break;
case KeyPress::Char: keyEvent.type = cef_key_event_type_t::KEYEVENT_CHAR;
default:break;
}
browser->GetHost()->SendKeyEvent(keyEvent);
}
}
but me press key value is double , and can't using special key same Ctrl+... Shift + ...
Happens on some system, the system where the picture was taken has an AMD Radeon HD7600M & Intel® HD Graphics 4000.
Some other Graphics Units with the same problem:
Nvidia Geforce 9500 GT, Driver version 342.01
Nvidia Geforce 9800 GT, Driver version Unknown
Nvidia Geforce 545 GT, Driver version: 267.95
Nvidia Quadro FX 3800, Driver version: 342.00
AMD Radeon R9 M200X, second GPU: Intel® HD Graphics 4600
ATI Radeon HD 4650, Driver version: Unknown
We currently have logic in our application that assumes the shared texture is copyable using CopySubresourceRegion at the time the browser signals an event (in this case, OnAcceleratedPaint).
However, even if we remove all dirty rectangle logic from our application and copy the full buffer (CopyResource) from the main game thread, it appears the last view change (e.g. keyboard input in a <input>
element) hasn't rendered to the shared texture yet in all cases that OnAcceleratedPaint was called.
I don't see any immediate workaround either other than swapping the buffer any time the keyed mutex is able to be acquired, and not just when signaled by CEF.
Hi,
Visual studio 2019 batch file attached.
Not much, but saves others having to do it.
Thanks for this project - great work.
Cheers,
Steve.
gen_vs2019.zip
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.