Comments (17)
Yes it was. This MR is mostly about CI, I should rebase it at some point :)
from gstcefsrc.
OK, with this modification it runs indeed:
use gstreamer as gst;
use gstreamer::glib;
use gstreamer::prelude::*;
fn main() {
gst::init().unwrap();
let pipeline = gst::Pipeline::new(None);
let cefsrc = gst::ElementFactory::make("cefsrc", None).unwrap();
let queue = gst::ElementFactory::make("queue", None).unwrap();
let cefdemux = gst::ElementFactory::make("cefdemux", None).unwrap();
let queue2 = gst::ElementFactory::make("queue", None).unwrap();
let videoconvert = gst::ElementFactory::make("videoconvert", None).unwrap();
let autovideosink = gst::ElementFactory::make("autovideosink", None).unwrap();
cefsrc
.set_property("url", &"https://soundcloud.com/platform/sama")
.unwrap();
pipeline
.add_many(&[
&cefsrc,
&queue,
&cefdemux,
&queue2,
&videoconvert,
&autovideosink,
])
.unwrap();
gst::Element::link_many(&[
&cefsrc,
&queue,
&cefdemux,
&queue2,
&videoconvert,
&autovideosink,
])
.unwrap();
pipeline.set_state(gst::State::Playing).unwrap();
let main_loop = glib::MainLoop::new(None, false);
let bus = pipeline.get_bus().unwrap();
bus.add_watch({
let main_loop = main_loop.clone();
move |_, msg| {
match msg.view() {
gst::MessageView::Eos(..) => main_loop.quit(),
gst::MessageView::Error(err) => {
println!(
"Error from {:?}: {} ({:?})",
err.get_src().map(|s| s.get_path_string()),
err.get_error(),
err.get_debug()
);
main_loop.quit();
}
_ => (),
}
glib::Continue(true)
}
})
.unwrap();
main_loop.run();
pipeline.set_state(gst::State::Null).unwrap();
bus.remove_watch().unwrap();
}
Will work on reduced example now.
from gstcefsrc.
As of the latest commit, cefsrc is usable in Debug mode, including at program destruction :)
from gstcefsrc.
That's probably a CEF / chromium issue. I can't reproduce this with the master branch, the default CEF build and the latest version of gstreamer (in the gst-build devenv). Can you provide more information wrt OS / whether you can reproduce the issue with the example pipeline / whether you've modified your local checkout of gstcefsrc or use your own CEF build?
from gstcefsrc.
I'm using Docker for development and I can confirm that gst-launch command from readme indeed works fine.
I've simplified it to this since I only care about video for now:
gst-launch-1.0 cefsrc url="https://soundcloud.com/platform/sama" ! queue ! cefdemux ! queue ! videoconvert ! autovideosink
Then I've tried to make reduced example, starting with above pipeline created programmatically, but it only shows black screen:
Cargo.toml:
[package]
name = "gstcefsrc-test"
version = "0.1.0"
authors = ["Nazar Mokrynskyi <[email protected]>"]
edition = "2018"
[dependencies]
gstreamer = "0.15.0"
src/main.rs:
use gst::prelude::*;
use gstreamer as gst;
fn main() {
gst::init().unwrap();
let pipeline = gst::Pipeline::new(None);
let cefsrc = gst::ElementFactory::make("cefsrc", None).unwrap();
let queue = gst::ElementFactory::make("queue", None).unwrap();
let cefdemux = gst::ElementFactory::make("cefdemux", None).unwrap();
let queue2 = gst::ElementFactory::make("queue", None).unwrap();
let videoconvert = gst::ElementFactory::make("videoconvert", None).unwrap();
let autovideosink = gst::ElementFactory::make("autovideosink", None).unwrap();
cefsrc
.set_property("url", &"https://soundcloud.com/platform/sama")
.unwrap();
pipeline
.add_many(&[
&cefsrc,
&queue,
&cefdemux,
&queue2,
&videoconvert,
&autovideosink,
])
.unwrap();
gst::Element::link_many(&[
&cefsrc,
&queue,
&cefdemux,
&queue2,
&videoconvert,
&autovideosink,
])
.unwrap();
pipeline.set_state(gst::State::Playing).unwrap();
let bus = pipeline.get_bus().unwrap();
for msg in bus.iter_timed(gst::CLOCK_TIME_NONE) {
match msg.view() {
gst::MessageView::Eos(..) => break,
gst::MessageView::Error(err) => {
println!(
"Error from {:?}: {} ({:?})",
err.get_src().map(|s| s.get_path_string()),
err.get_error(),
err.get_debug()
);
break;
}
_ => (),
}
}
pipeline.set_state(gst::State::Null).unwrap();
}
It seems to be literally the same thing.
Once I have that not showing black screen, I should be able to reduce my use case to a smaller demo. I'm using Rust, so getting segfaults is not quite what I expect 🙂
You can reproduce my current environment by using this Dockerfile:
FROM restreamio/gstreamer:latest-dev
RUN \
apt-get update && apt-get install -y cmake && \
git clone https://github.com/centricular/gstcefsrc.git && \
cd gstcefsrc && \
mkdir build && \
cd build && \
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release .. && \
make -j$(nproc --all)
USER 1000:1000
ENV XDG_RUNTIME_DIR=/run/user/1000
ENV DISPLAY=:0.0
ENV GST_PLUGIN_PATH=/gstcefsrc/build/Release
Build it with docker build -t gstcefsrc-test .
.
Then you should be able to to use even your X session with it (Dockerfile above assumes you have user ID 1000 in Linux):
docker run --rm -it --net host -v /run:/run gstcefsrc-test
After that it should work (may occasionally fail with X errors, but most of the time it works fine).
UPD: OS is Ubuntu 19.10 and packages are as shipped in the repos except GStreamer, its plugins and libnice that are built from source.
from gstcefsrc.
I'm using Rust, so getting segfaults is not quite what I expect 🙂
There's https://github.com/servo/servo/tree/master/ports/gstplugin btw, which is a (more-or-less) pure Rust version of a browser source plugin based on Servo. If you feel like trying it :) It's probably not mature enough yet, but might be fun to try.
from gstcefsrc.
Hey @nazar-pc , the difference between your application and gst-launch is the lack of a GMainLoop. cefsrc uses https://magpcss.org/ceforum/apidocs3/projects/(default)/(_globals).html#CefDoMessageLoopWork() , which is non-blocking but must be called from the main thread of the application, so the source uses g_timeout_add to do so. Without a main loop around, the timeout never gets triggered, hence the black screen.
I can't remember the exact reason why I didn't use CefRunMessageLoop()
at the time but I could look into that, in the meantime you can work around this by running a main loop in your test application, instead of blocking on bus pops.
from gstcefsrc.
I've tried Webkit WPE-based plugin first, but it requires EGL which was not available in my case, so I decided to try this one. I've seen that Servo has something that looks like a plugin, but it is not on crates.io from what I've seen, so probably not very usable. I'll probably give it a try later though.
I'll try to run the main loop and let you know how it goes.
from gstcefsrc.
@nazar-pc , any news on that?
from gstcefsrc.
Not yet, I was busy with other things, will get back to this as soon as I can
from gstcefsrc.
Hm.. there is something weird going on. I'm not getting segfaults on this machine after a few hours trying. This machine is strange though. It reproduces other errors and warnings that the machine I had that segfault on didn't, probably because I'm running Ubuntu daily here.
I'll have to test again on the other machine where I got this segfault initially, probably tomorrow. Though it doesn't make any sense to me since it runs inside of a container...
from gstcefsrc.
After some investigation, I found that I can reproduce a similar crash when cefsrc is built in Debug mode. The initial issue is fixed by setting locales_dir_path
as such (hardcoded):
CefString(&settings.locales_dir_path).FromASCII("/home/meh/devel/gst-build/sandbox/gstcefsrc/build/Debug/locales");
There are however subsequent issues on shutdown. Some refactoring would be needed to address those, this will probably be best done when lifting the main loop requirement, as these tie in to the element's lifecycle as well.
from gstcefsrc.
@nazar-pc , can you confirm you were seeing the issue with a Debug build?
from gstcefsrc.
Yes, that is the difference! I was building it in Debug mode when it crashed and then spent 3 hours trying to find out why it doesn't crash in Release build yesterday.
from gstcefsrc.
I've tried Webkit WPE-based plugin first, but it requires EGL which was not available in my case, so I decided to try this one.
This requirement is optional now, you need gst 1.17, wpebackend-fdo git master (upcoming 1.8.x) though. To use swrast, set LIBGL_ALWAYS_SOFTWARE=true
at runtime.
from gstcefsrc.
you need gst 1.17
Was the change actually merged to master though? https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1267 is still open.
from gstcefsrc.
from gstcefsrc.
Related Issues (20)
- Pipeline hangs (Windows) HOT 11
- Wayland Support HOT 1
- License HOT 3
- Sandbox HOT 6
- registering JS Callbacks using RenderProcessHandler::OnContextCreated() HOT 1
- Leaves 5 processes running after `stop` HOT 7
- Mixing audio and video with `matroskamux` causing deadlocks HOT 40
- Rare negotiation errors are happening between cefsrc and cefdemux HOT 3
- Not compiling on macOS Ventura on MacBook M1
- Broken Linux x64 build HOT 2
- Deadlock when mixing Audio and Video HOT 6
- trying to build for jetson nano HOT 21
- Cef Segmentation fault HOT 5
- Bad audio meta HOT 10
- [Q] what is the purpose of the audiotestsrc ? HOT 4
- cefsrc in headless environment using GPU HOT 8
- No video output with `gtk4paintablesink` and `clappersink` HOT 4
- Plugin files blacklisted but plugin still works HOT 2
- Inconsistant caps
- Ideas on making src element only generate frames when a fresh buffer is created HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gstcefsrc.