EricssonResearch / openwebrtc

A cross-platform WebRTC client framework based on GStreamer
http://www.openwebrtc.org
BSD 2-Clause "Simplified" License
1.8k stars 537 forks source link

Raspberry Pi support #172

Open stefanalund opened 9 years ago

stefanalund commented 9 years ago

Make OpenWebRTC run on Raspberry Pi. This is a placeholder for people interested (seems to be many :)). We have done some hacks but nothing that is yet ready to land as another supported platform.

img_0048

sdroege commented 9 years ago

Relevant to this are also @ford-prefect 's changes to support compressed video

ford-prefect commented 9 years ago

Just dumping what I have so far for compressed support:

  1. The interapp* GStreamer elements will be required. The elements need quite a bit of work before going upstream, but can be used to at least demonstrate what we want: https://github.com/ford-prefect/gst-plugins-bad/tree/interapp
  2. Patches to OpenWebRTC itself: https://github.com/ford-prefect/openwebrtc/commits/compressed -- the last patch in that tree is a hack that forces sending of 1280x720 H.264 video as an example. To be more usable, we'd need to support reconfiguration of Owr sources, to be able to deal with requests for compressed or non-compressed media.

To actually make this work on the RPi, presumably we'd also need to swap out the use of v4l2src with the rpicamsrc.

clementperon commented 9 years ago

I have also a compressed media src (H264 and Opus) i will try your patches.

@ford-prefect: just try but doesn't work i think owr_transport_agent.c or _owr_payload_create_encoder should also be patched. I mean if the source is already in the good format no need to create an encoder. (i didn't compile any video or audio encoder)

clementperon commented 9 years ago

I'm trying to do the same for Opus encoding the pipeline looks like successfully created but nothing works. EDIT : Oups my bad my queue is paused :/ @ford-prefect : interapp works for audio too ?

Source Pipeline source Transport Pipeline transport

ford-prefect commented 9 years ago

Yes, I've tested with Opus and Vorbis, and it did work (the gstinterapptest in the gst-plugin-bad/gst/inter repo tests audio). It looks like the buffers are going into interappsink but not coming out interappsrc.

Could you run with GST_DEBUG=default:5 and see if there are messages from gstintersurface.c that suggest what's going on?

One possibility is that the keyframe buffers are not marked appropriately. Putting an opusparse element after your interappsrc might help in that case.

clementperon commented 9 years ago

Same as h264parse i added an opusparse.

@ford-prefect I have an error gstsegment invalid position

0:01:02.634802582   593   0x72e0c0 DEBUG                default /home/clement/linux-wbp//system/gstreamer//./gst/gstsegment.c:483:gst_segment_to_running_time: invalid position (-1)
0:01:02.635916686   593   0x72e0c0 DEBUG                default /home/clement/linux-wbp//system/gstreamer-plugins//gst-plugins-bad//./gst/inter/gstintersurface.c:252:gst_deferred_client_push_buffer: Got new keyf
rame, dropping previous GOP (if any)
0:01:02.641259393   593   0x72e0c0 DEBUG                default /home/clement/linux-wbp//system/gstreamer//./gst/gstsegment.c:483:gst_segment_to_running_time: invalid position (-1)
0:01:02.642457493   593   0x72e0c0 DEBUG                default /home/clement/linux-wbp//system/gstreamer-plugins//gst-plugins-bad//./gst/inter/gstintersurface.c:252:gst_deferred_client_push_buffer: Got new keyf
rame, dropping previous GOP (if any)
0:01:02.643565520   593   0x72e0c0 DEBUG                default /home/clement/linux-wbp//system/gstreamer//./gst/gstsegment.c:483:gst_segment_to_running_time: invalid position (-1)
0:01:02.659275196   593   0x72de30 DEBUG                default /home/clement/linux-wbp//system/gstreamer//./gst/gstsegment.c:483:gst_segment_to_running_time: invalid position (-1)
0:01:02.665075089   593   0x72e0c0 DEBUG                default /home/clement/linux-wbp//system/gstreamer-plugins//gst-plugins-bad//./gst/inter/gstintersurface.c:252:gst_deferred_client_push_buffer: Got new keyf
rame, dropping previous GOP (if any)
0:01:02.666970262   593   0x72e0c0 DEBUG                default /home/clement/linux-wbp//system/gstreamer//./gst/gstsegment.c:483:gst_segment_to_running_time: invalid position (-1)
0:01:02.668079320   593   0x72e0c0 DEBUG                default /home/clement/linux-wbp//system/gstreamer-plugins//gst-plugins-bad//./gst/inter/gstintersurface.c:252:gst_deferred_client_push_buffer: Got new keyf
rame, dropping previous GOP (if any)
0:01:02.672660789   593   0x72de30 DEBUG                default /home/clement/linux-wbp//system/gstreamer//./gst/gstsegment.c:483:gst_segment_to_running_time: invalid position (-1)
0:01:03.024832389   593   0x72e0c0 DEBUG                default /home/clement/linux-wbp//system/gstreamer//./gst/gstsegment.c:483:gst_segment_to_running_time: invalid position (-1)
0:01:03.025988031   593   0x72e0c0 DEBUG                default /home/clement/linux-wbp//system/gstreamer-plugins//gst-plugins-bad//./gst/inter/gstintersurface.c:252:gst_deferred_client_push_buffer: Got new keyf
rame, dropping previous GOP (if any)
0:01:03.027231517   593   0x72e0c0 DEBUG                default /home/clement/linux-wbp//system/gstreamer//./gst/gstsegment.c:483:gst_segment_to_running_time: invalid position (-1)
0:01:03.028308220   593   0x72e0c0 DEBUG                default /home/clement/linux-wbp//system/gstreamer-plugins//gst-plugins-bad//./gst/inter/gstintersurface.c:252:gst_deferred_client_push_buffer: Got new keyf
rame, dropping previous GOP (if any)
0:01:03.038233675   593   0x72e0c0 DEBUG                default /home/clement/linux-wbp//system/gstreamer//./gst/gstsegment.c:483:gst_segment_to_running_time: invalid position (-1)
0:01:03.039764882   593   0x72e0c0 DEBUG                default /home/clement/linux-wbp//system/gstreamer-plugins//gst-plugins-bad//./gst/inter/gstintersurface.c:252:gst_deferred_client_push_buffer: Got new keyf
rame, dropping previous GOP (if any)
0:01:03.045095858   593   0x72e0c0 DEBUG                default /home/clement/linux-wbp//system/gstreamer//./gst/gstsegment.c:483:gst_segment_to_running_time: invalid position (-1)
0:01:03.047208165   593   0x72e0c0 DEBUG                default /home/clement/linux-wbp//system/gstreamer-plugins//gst-plugins-bad//./gst/inter/gstintersurface.c:252:gst_deferred_client_push_buffer: Got new keyf
rame, dropping previous GOP (if any)
0:01:03.052804420   593   0x72de30 DEBUG                default /home/clement/linux-wbp//system/gstreamer//./gst/gstsegment.c:483:gst_segment_to_running_time: invalid position (-1)
0:01:03.054056413   593   0x72de30 DEBUG                default /home/clement/linux-wbp//system/gstreamer//./gst/gstsegment.c:483:gst_segment_to_running_time: invalid position (-1)
0:01:03.055302113   593   0x72de30 DEBUG                default /home/clement/linux-wbp//system/gstreamer//./gst/gstsegment.c:483:gst_segment_to_running_time: invalid position (-1)
0:01:03.048535996   593   0x72e0c0 DEBUG                default /home/clement/linux-wbp//system/gstreamer//./gst/gstsegment.c:483:gst_segment_to_running_time: invalid position (-1)
0:01:03.061604269   593   0x72e0c0 DEBUG                default /home/clement/linux-wbp//system/gstreamer-plugins//gst-plugins-bad//./gst/inter/gstintersurface.c:252:gst_deferred_client_push_buffer: Got new keyf
rame, dropping previous GOP (if any)
0:01:03.062743634   593   0x72e0c0 DEBUG                default /home/clement/linux-wbp//system/gstreamer//./gst/gstsegment.c:483:gst_segment_to_running_time: invalid position (-1)
0:01:03.063815151   593   0x72e0c0 DEBUG                default /home/clement/linux-wbp//system/gstreamer-plugins//gst-plugins-bad//./gst/inter/gstintersurface.c:252:gst_deferred_client_push_buffer: Got new keyf
rame, dropping previous GOP (if any)
0:01:03.065261689   593   0x72e0c0 DEBUG                default /home/clement/linux-wbp//system/gstreamer//./gst/gstsegment.c:483:gst_segment_to_running_time: invalid position (-1)
0:01:03.066555617   593   0x72e0c0 DEBUG                default /home/clement/linux-wbp//system/gstreamer-plugins//gst-plugins-bad//./gst/inter/gstintersurface.c:252:gst_deferred_client_push_buffer: Got new keyf
rame, dropping previous GOP (if any)
0:01:03.067693034   593   0x72e0c0 DEBUG                default /home/clement/linux-wbp//system/gstreamer//./gst/gstsegment.c:483:gst_segment_to_running_time: invalid position (-1)
0:01:03.412937834   593   0x72e0c0 DEBUG                default /home/clement/linux-wbp//system/gstreamer-plugins//gst-plugins-bad//./gst/inter/gstintersurface.c:252:gst_deferred_client_push_buffer: Got new keyf
rame, dropping previous GOP (if any)
0:01:03.414113803   593   0x72e0c0 DEBUG                default /home/clement/linux-wbp//system/gstreamer//./gst/gstsegment.c:483:gst_segment_to_running_time: invalid position (-1)
0:01:03.415180889   593   0x72e0c0 DEBUG                default /home/clement/linux-wbp//system/gstreamer-plugins//gst-plugins-bad//./gst/inter/gstintersurface.c:252:gst_deferred_client_push_buffer: Got new keyf
rame, dropping previous GOP (if any)
0:01:03.072710927   593   0x72de30 DEBUG                default /home/clement/linux-wbp//system/gstreamer//./gst/gstsegment.c:483:gst_segment_to_running_time: invalid position (-1)
0:01:03.421616476   593   0x72de30 DEBUG                default /home/clement/linux-wbp//system/gstreamer//./gst/gstsegment.c:483:gst_segment_to_running_time: invalid position (-1)
0:01:03.422786051   593   0x72de30 DEBUG                default /home/clement/linux-wbp//system/gstreamer//./gst/gstsegment.c:483:gst_segment_to_running_time: invalid position (-1)
0:01:03.423897262   593   0x72de30 DEBUG                default /home/clement/linux-wbp//system/gstreamer//./gst/gstsegment.c:483:gst_segment_to_running_time: invalid position (-1)
0:01:03.416293220   593   0x72e0c0 DEBUG                default /home/clement/linux-wbp//system/gstreamer//./gst/gstsegment.c:483:gst_segment_to_running_time: invalid position (-1)
0:01:03.430524127   593   0x72e0c0 DEBUG                default /home/clement/linux-wbp//system/gstreamer-plugins//gst-plugins-bad//./gst/inter/gstintersurface.c:252:gst_deferred_client_push_buffer: Got new keyf
rame, dropping previous GOP (if any)
0:01:03.431671696   593   0x72e0c0 DEBUG                default /home/clement/linux-wbp//system/gstreamer//./gst/gstsegment.c:483:gst_segment_to_running_time: invalid position (-1)
0:01:03.436844558   593   0x72de30 DEBUG                default /home/clement/linux-wbp//system/gstreamer//./gst/gstsegment.c:483:gst_segment_to_running_time: invalid position (-1)
0:01:03.438221269   593   0x72de30 DEBUG                default /home/clement/linux-wbp//system/gstreamer//./gst/gstsegment.c:483:gst_segment_to_running_time: invalid position (-1)
0:01:03.439580282   593   0x72e0c0 DEBUG                default /home/clement/linux-wbp//system/gstreamer-plugins//gst-plugins-bad//./gst/inter/gstintersurface.c:252:gst_deferred_client_push_buffer: Got new keyf
rame, dropping previous GOP (if any)

source graph

This the function called to push a buffer in my appsrc.

static gboolean gst_appsrc_push_audio(unsigned char *inBuf, unsigned int size, void *user_data) {
    GstFlowReturn ret;
    OwrLocalMediaSourcePrivate *priv = OWR_LOCAL_MEDIA_SOURCE_GET_PRIVATE(user_data);
    GstElement* appsrc = priv->source;

    if(!appsrc){
        return FALSE;
    } 

    if(GST_STATE(appsrc) != GST_STATE_PLAYING){
        g_print("Appsrc not playing ignore callback\n");
        return FALSE;
    }

    GstBuffer *buffer = gst_buffer_new_allocate (NULL, size, NULL);
    gst_buffer_fill (buffer, 0, inBuf, size);

    ret = gst_app_src_push_buffer(GST_APP_SRC(appsrc), buffer);

    if (ret != GST_FLOW_OK) {
        g_error("PUSH AUDIO NOT OK\n");
        return FALSE;
    }

    return TRUE;
}
clementperon commented 9 years ago

@ford-prefect Try also with h.264 but same issue, maybe it's comming from my appsrc module. Do you have an idea ?

source graph

ford-prefect commented 9 years ago

Could you post the verbose logs for the h.264 case too?

clementperon commented 9 years ago

@ford-prefect Yes, i add some print inside OWR

remove useless log

ford-prefect commented 9 years ago

The segment handling messages might be relevant, which is one of the big missing pieces in the interapp* elements. If you could put up a full GST_DEBUG=5 log somewhere (it will be quite large), I can try to confirm that.

clementperon commented 9 years ago

Print a full debug need a lot of cpu/time which is not possible because i have time constraint due to the callbacks of the audio/video encoder. Do you a more restricted GST_DEBUG output that could help ? I try with GST_DEBUG=inter*:6

PS: What's the point to use differents pipeline and inter-connect them instead of putting everything in the same pipeline (Sorry maybe the answer is obvious) ?

That's the output : remove useless log

superdump commented 9 years ago

If you write it to a file instead of the terminal it should be better performance and have less impact.

clementperon commented 9 years ago

@superdump Thanks Here is the log (H.264) https://gist.githubusercontent.com/frozeus/d85408cc38081aa35410/raw/gst_debug=5 And this one is audio only (Opus) https://gist.githubusercontent.com/frozeus/058c55c74fa5a70c7fa5/raw/opus

clementperon commented 9 years ago

@ford-prefect Did you have time to check the log ? If you have a more verbose version of interapp i could give you the output log.

Thanks for your help

ford-prefect commented 9 years ago

Sorry, I missed replying to this -- I don't see any output from the interapp code (specifically the GstDeferredClient code in gstintersurface.c) in either of those logs. Could you double-check that they are plugged in and buffers are reaching the interappsink?

clementperon commented 9 years ago

@ford-prefect : I did it again and add more print in the gstinstersurface. This one is OPUS

https://gist.githubusercontent.com/frozeus/b8197560e95188400638/raw/GST_DEBUG

ford-prefect commented 9 years ago

It's not absolutely clear to me what the problem is, but it could be related to the segment handling being incorrect:

0:01:15.968242791 447 0x7b7430 DEBUG default /home/clement/linux-wbp//system//gstreamer//./gst/gstsegment.c:483:gst_segment_to_running_time: invalid position (-1)

If you're up to it, a backtrace of where that message is coming from can confirm this (and would probably happen on any machine, not just the Raspberry Pi).

clementperon commented 9 years ago

@ford-prefect Sorry if the answer is obvious but what is the point to use 2 different pipelines and connect them with an intersrc/sink ? (instead of all the element in the same pipeline)

#0  gst_segment_to_running_time (segment=0x612348, format=GST_FORMAT_BYTES, position=18446744073709551615)
    at /home/clement/linux-wbp/linux//system//gstreamer//./gst/gstsegment.c:483
#1  0x76a1837c in gst_base_sink_get_sync_times (basesink=0x612250, obj=0x6082b0, rsstart=0x71aea720, 
    rsstop=0x71aea728, rrstart=0x71aea708, rrstop=0x71aea710, rrnext=0x71aea718, do_sync=0x71aea730, 
    stepped=0x71aea734, step=0x612158, step_end=0x71aea83c)
    at /home/clement/linux-wbp/linux//system//gstreamer//./libs/gst/base/gstbasesink.c:1937
#2  0x76a1a34c in gst_base_sink_do_sync (basesink=0x612250, obj=0x6082b0, late=0x71aea838, step_end=0x71aea83c)
    at /home/clement/linux-wbp/linux//system//gstreamer//./libs/gst/base/gstbasesink.c:2403
#3  0x76a21b28 in gst_base_sink_chain_unlocked (basesink=0x612250, pad=0x611430, obj=0x6082b0, is_list=0)
    at /home/clement/linux-wbp/linux//system//gstreamer//./libs/gst/base/gstbasesink.c:3398
#4  0x76a22e6c in gst_base_sink_chain_main (basesink=0x612250, pad=0x611430, obj=0x6082b0, is_list=0)
    at /home/clement/linux-wbp/linux//system//gstreamer//./libs/gst/base/gstbasesink.c:3546
#5  0x76a2308c in gst_base_sink_chain (pad=0x611430, parent=0x612250, buf=0x6082b0)
    at /home/clement/linux-wbp/linux//system//gstreamer//./libs/gst/base/gstbasesink.c:3575
#6  0x77a640cc in gst_pad_chain_data_unchecked (pad=0x611430, type=4112, data=0x6082b0)
    at /home/clement/linux-wbp/linux//system//gstreamer//./gst/gstpad.c:3977
#7  0x77a65350 in gst_pad_push_data (pad=0x6055e0, type=4112, data=0x6082b0)
    at /home/clement/linux-wbp/linux//system//gstreamer//./gst/gstpad.c:4210
#8  0x77a65b74 in gst_pad_push (pad=0x6055e0, buffer=0x6082b0)
    at /home/clement/linux-wbp/linux//system//gstreamer//./gst/gstpad.c:4321
#9  0x77a3c444 in gst_proxy_pad_chain_default (pad=0x6065e0, parent=0x6055e0, buffer=0x6082b0)
    at /home/clement/linux-wbp/linux//system//gstreamer//./gst/gstghostpad.c:126
#10 0x77a640cc in gst_pad_chain_data_unchecked (pad=0x6065e0, type=4112, data=0x6082b0)
    at /home/clement/linux-wbp/linux//system//gstreamer//./gst/gstpad.c:3977
#11 0x77a65350 in gst_pad_push_data (pad=0x6116c0, type=4112, data=0x6082b0)
    at /home/clement/linux-wbp/linux//system//gstreamer//./gst/gstpad.c:4210
#12 0x77a65b74 in gst_pad_push (pad=0x6116c0, buffer=0x6082b0)
    at /home/clement/linux-wbp/linux//system//gstreamer//./gst/gstpad.c:4321
#13 0x735d897c in gst_funnel_sink_chain (pad=0x6042b8, parent=0x5a3268, buffer=0x6082b0)
    at /home/clement/linux-wbp/linux//system//gstreamer//./plugins/elements/gstfunnel.c:280
#14 0x77a640cc in gst_pad_chain_data_unchecked (pad=0x6042b8, type=4112, data=0x6082b0)
    at /home/clement/linux-wbp/linux//system//gstreamer//./gst/gstpad.c:3977
#15 0x77a65350 in gst_pad_push_data (pad=0x611578, type=4112, data=0x6082b0)
    at /home/clement/linux-wbp/linux//system//gstreamer//./gst/gstpad.c:4210
#16 0x77a65b74 in gst_pad_push (warning: GDB can't find the start of the function at 0x736be2ba.
pad=0x611578, buffer=0x6082b0)
clementperon commented 9 years ago

I think my appsrc is not working properly. I tried to connect it directly inside the transport pipeline without interapp* but still the same issue the buffer inside appsrc is increassing but never release the data.

superdump commented 9 years ago

The long-term solution for the Raspberry Pi might be:

The Raspberry Pi is, as many know, a very capable platform when used optimally. Ideally we would want to obtain both a preview and compressed stream from the camera source to make optimal use of the tight connection between the camera module and the codecs. Unfortunately I don't think that is currently possible, or at least it wasn't last time I checked.

The RPi can certainly handle 1080p30 in real-time with very low latency making it an excellent candidate for simpler low-latency use cases. The main problem is that the encryption runs in software on the CPU and the CPU is not so fast. Maybe with the RPi 2, that isn't a problem. Maybe there's a way to optimize the CPU usage for encryption/decryption.

Suggestions welcome! :smile:

sdroege commented 9 years ago

See also #240

clementperon commented 9 years ago

@ford-prefect sorry for the false bug report, i just found that my owr wasn't working due to an error from libnice : HOST_CANDIDATE_CANT_CREATE_SOCKET from nice_agent_gather_candidates/agent.c This error is due to an Ipv6 return by nice_interfaces_get_local_ips but i don't have any. I just make a quick fix and my pipeline is now more talkative :)

ford-prefect commented 9 years ago

@frozeus good to hear that! Is it working end-to-end now?

On 19 March 2015 at 15:47, frozeus notifications@github.com wrote:

@ford-prefect https://github.com/ford-prefect sorry for the false bug report, i just found that my owr wasn't working due to an error from libnice : HOST_CANDIDATE_CANT_CREATE_SOCKET from nice_agent_gather_candidates/agent.c This error is due to an Ipv6 return by nice_interfaces_get_local_ips but i don't have any. I just make a quick fix and my pipeline is now more talkative :)

— Reply to this email directly or view it on GitHub https://github.com/EricssonResearch/openwebrtc/issues/172#issuecomment-83484304 .

lordmundi commented 9 years ago

Could we start a bounty on this? Free pizza for the person who gets this working perhaps? If others are interested in helping the bounty, we could add it up. I'd be happy to chip in.

stefanalund commented 9 years ago

😀

philn commented 9 years ago

I started a branch last week actually, should have time to continue further on tomorrow

stefanalund commented 9 years ago

I will add a OpenWebRTC T-shirt and some Swedish chocolate to @lordmundi's bounty 😃

superdump commented 9 years ago

It looks like @philn is working on building OpenWebRTC on the RPi here: https://github.com/metrological/buildroot/tree/owr However, that is using a different build system and probably building a bunch of stuff that people may not want for developing simple OpenWebRTC applications. I don't know anything about that build system though.

Ideally someone needs to create a cerbero configuration for the RPi, add a recipe for https://github.com/thaytan/gst-rpicamsrc and add the remaining appropriate modifications to https://github.com/ford-prefect/openwebrtc/commits/compressed to get everything working.

superdump commented 9 years ago

It may be possible to build using cerbero natively on a Raspberry Pi (or in a cross-compilation environment) already. It would be awesome however if cerbero could set up a cross-compilation environment for the RPi itself with a config and bootstrapper...

clementperon commented 9 years ago

@ford-prefect : My devboard is very ressource limited i try but it's more a presentation slides than a fluent stream. I remove the interapp, hardcoded the caps and put the appsrc in the transport pipeline (I just need to receive the stream from my board) the stream is nice now but still have issue with sound :S. Maybe i'm wrong but i think OWR ignore recvonly/sendonly from my SDP maybe i will free cpu resources by removing reception pipeline.

superdump commented 9 years ago

OWR can do sendonly/ recvonly. If not there's a bug to fix.

superdump commented 9 years ago

I almost have binaries built for Raspbian for the RPi 2. I'll publish those, hopefully also with Python bindings for convenience, as part of the 0.4.0 release. I'll mark this issue as blocking the 0.4.0 milestone just for RPi 2 binaries. If I get that working, I can perhaps also sort out something for the RPi '1' but that's a bit further off.

tacettin commented 9 years ago

How can i use this :) is there any repository in github. thanks a lot.

superdump commented 9 years ago

Not yet. It's coming soon when I have time to finish off the last bits and test it.

siwyd commented 9 years ago

Hi, I was wondering if there were any updates to RPi support? Looking to build a native WebRTC based application on an embedded device, and Raspberry Pi's price and hardware encoding makes it pretty much unbeatable :) OpenWebRTC seems like the perfect fit.

superdump commented 9 years ago

I need to dig out what I had. A reliable cross-compilation environment would really help a lot!

sjumah commented 9 years ago

Hi, it seems that you were able to get this done, as you removed this from the 0.4.0 milestone. Is there any way that you could help me out with the RPi 2 binaries? or with information about which files do i have to modify? or if you were able to use the cerbero cross-compilation? im really interested in this, and would love to get my hands on these features before 0.4.0 comes out with many other stuff. Thanks so much in advance.

sjumah commented 9 years ago

@superdump any updates?

superdump commented 9 years ago

It was removed from the 0.4.0 milestone because we decided it was not critical to have and getting an updated release out sooner is more important.

If someone could provide a simple and reproducible way to set up a cross-compilation environment on Ubuntu 14.04 or by mounting the desired code directory into a docker container, that would drastically help. The problem is that iterating on fixing bugs takes a long time and progress is very slow because of how slow it is to build stuff.

A generic cross-compilation environment for the RPi that I can set up with docker or an Ubuntu VM + script would be awesome.

sjumah commented 9 years ago

Not sure if this helps, but i'm trying to use this to cross-compile:

http://raspberrypi.stackexchange.com/questions/29871/how-to-build-native-webrtc

RealBotics commented 8 years ago

I'm new to this so please forgive me if I am not doing something correctly here. I am the owner of a small startup called RealBotics, Inc. (realbotics.com) and am very interested / need to have OpenWebRTC working on rPi2 and rPi3s. I was wondering if I were to post a $500 bounty on bountysource.com if that would be enough to stimulate the completion of this task by ~June 1, 2016. I also want to say thank you to everyone for all of the hard work thus far and in the future.

superdump commented 8 years ago

I had managed to build everything on RPi2 using cerbero up to javascriptcoregtk at which point I ran out of memory. If you don't need the JavaScript API and will be implementing stuff against the C API then that should be sufficient.

I had also made a recipe for building gst-rpicamsrc to use as the camera source to obtain H.264 directly from the source which is most efficient on the RPi.

I will try to find these changes and publish them. After that, some work will be needed on OwrLocalMediaSource/OwrMediaSource and possibly OwrTransportAgent to support compressed sources though it should be much easier now than it was previously. The source will need to use rpicamsrc, request the appropriate compressed format from it and identify its output as compressed somehow.

The transport agent code will then need to bypass any raw video processing elements and instead just pass the buffers through something like h264parse and then straight into the rtp payloader.

To support the SCReAM bitrate adaptation, a compressed source will need to expose a mechanism to set the target bitrate and wherever it is normally set on the encoder element in the transport agent it will need to instead set it on the source.

I think when receiving FIR or PLI packets we will trigger requesting a new intra frame and that will flow back up to the source so shouldn't need any changes, hopefully.

I can't think of anything else right now. Shout if anyone needs help.

superdump commented 8 years ago

https://github.com/superdump/cerbero/commit/3acb710f5d2347f555054d1c0e6e27936425d085

That will need rebasing but that allowed me to build everything but javascriptcoregtk on an RPi2. It's a bit ha josh and cross compiling is desirable to not hit the out of memory issues when building javascriptcoregtk and also because it should be faster. If someone can get cross compiling to work somehow (whether by setting up an environment to run cerbero in or hooking the toolchain into cerbero) please please let me know here!

stefanalund commented 8 years ago

@RealBotics both @philn and @superdump has been looking into this from time to time. I leave it to them to report on the progress.

calvaris commented 8 years ago

Hi there, I was working some week ago on this, but had to switch task. I just pushed the branch to https://github.com/Metrological/openwebrtc/commits/calvaris/rpi-compressed . Take into account that all code there is experimental and non-definitive. I hope I can retake it at some point, but if anybody can use it, you are welcome.

RealBotics commented 8 years ago

@stefanalund @philn @superdump and @calvaris Thank you all of the hard work and updates! I am still putting the word out trying to find an active developer to get it finished. If someone is interested let me know. Thanks again!

Oflameo commented 8 years ago

@RealBotics, does your bounty require the patch to be accepted upstream by this project to count?

RealBotics commented 8 years ago

@Oflameo, I hope that it is accepted upstream, but that is not required for the bounty. I just need access to the code and confirm that I can install and run it on a rPi 2 and 3.

superdump commented 8 years ago

@calvaris - thanks! That should help a lot! :)

philn commented 8 years ago

Note that gst-rpicamsrc now has support for raw video. I haven't had time to check it yet though.