Live data from Hacker News

A simple C implementation to stream H.264 to browser using WebRTC

github.com

81–90 of 128 posts

Re: A simple C implementation to stream H.264 to browser using WebRTC

#81
post #17

I've seen a few WebRTC server implementations pop up recently but the only clients I have seen are web browsers. Does anyone know of any WebRTC client implementations apart from the browser? Or am I misunderstanding the WebRTC architecture completely?

I believe that clients are available for most native MobileMe platforms as well.

https://webrtc.github.io/webrtc-org/native-code/android/

https://webrtc.github.io/webrtc-org/native-code/ios/

Re: A simple C implementation to stream H.264 to browser using WebRTC

#82

Earlier quoted context omitted.

As far as I can tell, this is an open forum. If people keep repeating the same mistakes when they use C, I’ll keep promoting the alternatives. I’m not trying to eschew flamebait, it just so happens that people get upset when their ideas are challenged. If it makes people uncomfortable, then that’s fantastic, because no one who was comfortable ever learned anything. I get it: learning new things and new languages is h…

It seems you think their mistake was using C in the first place, and not the way they used C. Calling people out for not using a language that you prefer is not helping them learn, nor is it bitter medicine to those who find learning your preferred language "hard".

To me, this is not a simple matter of preference like your choice of editor or the way you prefer to have it configured, to be used by you and you alone.

Software, especially open source software, is often collaborative. The programming language is a way of expressing yourself not only to your compiler, but also to other human beings.

Would you write a book today in Middle English, when the rest of the world is expecting modern English?

Re: A simple C implementation to stream H.264 to browser using WebRTC

#83

I'm not very familiar with WebRTC & how the browser pulls video usually, in what way is this better? Also, what benefits does WebRTC give over other protocols?

My understanding: Most IP cameras only have an RTSP stream, which would need to be proxied expensively by some server if you want to view it over the internet or be exposed directly to the internet. WebRTC would allow the server to help negotiate a connection directly from client to camera, thereby bypassing having to host expensive proxy.

Re: A simple C implementation to stream H.264 to browser using WebRTC

#84

Earlier quoted context omitted.

I just can’t recommend using it for new code in light of the sexy new alternatives that can compile down to the same binary with source code that’s way more intuitive and readable. I do have nostalgia for C since it was my first language, and I think a lot of people are in the same boat, which is a problem. That’s why I think we need to stop teaching C. Kate Gregory has a good cppcon talk on the topic: https://youtu.…

I... don't even know how to start answering this. "C" is glorified assembly and learning assembly is *fundamental* to understand how computers work. "C" *should* be the first language programmers learn when they get serious (ex: first year computer science classes). When I write "C" I know exactly what is going on with each of my CPU cycles and where my variables are being allocated. The compiler is a dead simple tra…

> The compiler is a dead simple translator who doesn't play funny tricks behind my back.

When did you last look at the assembly your compiler produces at O2 or higher? Because decades of C compiler development would very much like to disagree with that statement.

> As others have mentioned on this thread, together with "cppcheck", "valgrind", "electric-fence" and friends it is also as secure as any other.

Where do all the memory safety problems in any nontrivial C or C++ codebase come from then? Do you think that for example the Chrome team is just incompetent? It is certainly possible to write safe C, but that involves _a lot_ more effort than using valgrind. You could for example write MISRA-C. Together with extensive manual checking those rules lead to fairly save C, but the effort needed is really big.

Re: A simple C implementation to stream H.264 to browser using WebRTC

#85
post #17

I've seen a few WebRTC server implementations pop up recently but the only clients I have seen are web browsers. Does anyone know of any WebRTC client implementations apart from the browser? Or am I misunderstanding the WebRTC architecture completely?

There are lots of implementations now! Here are the ones I know about.

* https://github.com/aiortc/aiortc (Python)

* GStreamer’s webrtcbin (C)

* https://github.com/shinyoshiaki/werift-webrtc (Typescript)

* https://github.com/pion/webrtc (Golang)

* https://github.com/webrtc-rs/webrtc (Rust)

* https://github.com/awslabs/amazon-kinesis-video-streams-webr... (C/Embedded)

* https://webrtc.googlesource.com/src/ (C++)

* https://github.com/rawrtc/rawrtc (C++)

* https://github.com/sipsorcery-org/sipsorcery (C#)

* https://github.com/paullouisageneau/libdatachannel (C++)

Also check out https://github.com/sipsorcery/webrtc-echoes for how they work together

Re: A simple C implementation to stream H.264 to browser using WebRTC

#86

How the world has changed that running something on a raspberry pi counts as "embedded". I was expecting this to be on some microcontroller...

> How the world has changed...

Was this before of after the release of Windows XP Embedded?

Re: A simple C implementation to stream H.264 to browser using WebRTC

#87

Earlier quoted context omitted.

WebRTC with STUN is pure p2p where ffmpeg it requires a rtmp or rtsp server

Just for completeness sake this is what docs [1] state: "For most WebRTC applications to function a server is required for relaying the traffic between peers, since a direct socket is often not possible between the clients (unless they reside on the same local network). " [1] https://webrtc.org/getting-started/turn-server

It’s a little more nuanced than this.

https://medium.com/the-making-of-whereby/what-kind-of-turn-s... fippo pulled the stats and saw 17%

This also depends on your clients network. You can determine your NAT mapping type[0] and now ahead of time if you need a TURN server.

To understand NAT behaviors more check out [1]

[0] https://github.com/pion/stun/tree/master/cmd/stun-nat-behavi...

[1] https://webrtcforthecurious.com/docs/03-connecting/#nat-mapp...

Re: A simple C implementation to stream H.264 to browser using WebRTC

#88

I'm not very familiar with WebRTC & how the browser pulls video usually, in what way is this better? Also, what benefits does WebRTC give over other protocols?

If you have the time give WebRTC for the Curious[0] a read. I try and explain what WebRTC is and how it actually works. The big advantages that I see are.

* Can do P2P (and Client/Server)

* Mandatory Encryption

* Handles codec/track negotation. You don't need to know ahead of time what is being sent.

* Data channels. Can also be configured to be lossy/unordered for kind of performance needed for gaming.

* Uses existing protocols. Really easy to bridge with SIP/RTSP. This software/hardware goes all the way back to the late 90s

* Multiple implementations and available in the browser. No other protocol comes close in availability.

[0] https://webrtcforthecurious.com/docs/01-what-why-and-how/

Re: A simple C implementation to stream H.264 to browser using WebRTC

#89
post #59
post #56

Earlier quoted context omitted.

It's the same deal as creating a circular references using `std::shared_ptr` in C++.

Ownership semantics in rust largely prevent circular references, so it's not the same deal

Sorry, I'm not a Rust pro, but from the docs about reference cycles linked above:

> We can see that Rust allows memory leaks by using Rc and RefCell: it’s possible to create references where items refer to each other in a cycle. This creates memory leaks because the reference count of each item in the cycle will never reach 0, and the values will never be dropped.

This sounds a lot like what happens when you create a circular reference with std::shared_ptr ?

Re: A simple C implementation to stream H.264 to browser using WebRTC

#90

The code contains things that make any modern C++ or Rust developer cringe: naked pointers, unsafe type casts, raw loops, using malloc/free to manually allocate memory for buffers, and calls to unsafe free functions like strcat. So much slow boilerplate is required to do things like handling memory allocation. The increased source code size for even the simplest things becomes harder to maintain. Danger is waiting ar…

Oh man, wait till you see the Linux source code...

Bit of a difference between a kernel and video conferencing.

One of these absolutely needs raw memory management and all the unsafe-if-not-very-carefully-done features that C(++) offer, the other definitely does not.

Post reply on HN