kclyu / rpi-webrtc-streamer

This repo's objective is providing something like Web Cam server on the most popular Raspberry PI hardware. By integrating [WebRTC](https://webrtc.org/native-code/) and Raspberry PI, we can stream the Raspberry camera feed to browser or native client which talks WebRTC.
Other
626 stars 108 forks source link

Why does PeerConnection add a fake video track. #27

Closed sliver-chen closed 6 years ago

sliver-chen commented 6 years ago

Hi I'm confused about peerconnection add a fake video track,this generated sdp does not include video unit? Or say that,i'm trying to create peerconnection in my demo and i add local video track just like webrtc offical demo do that.but when i send generated sdp to remote,remote set sdp failed and report error just like "failed to set video send codecs".So i try to find a answer. Could tell me about it? best regards.

sliver-chen commented 6 years ago
rtc::scoped_refptr<webrtc::VideoTrackInterface> video_track(
        peer_connection_factory_->CreateVideoTrack(
            kVideoLabel,
            peer_connection_factory_->CreateVideoSource(new cricket::FakeVideoCapturer(false),
                    nullptr)));

rpi-webrtc-streamer create video track like above. but i do this ny using webrtc::VideoCaptureFactory::CreateDeviceInfo to enum device info, then capturer = factory.Create(cricket::Device(name, 0));

best regards.

kclyu commented 6 years ago
    rtc::scoped_refptr<webrtc::VideoTrackInterface> video_track(
        peer_connection_factory_->CreateVideoTrack(
            kVideoLabel,
            peer_connection_factory_->CreateVideoSource(new cricket::FakeVideoCapturer(false),
                    nullptr)));

The reason I just used FakeVideoCaptuer is that the built-in Video Capturer of the WebRTC native stack will not be used in RWS. When the V4l2 module runs on Raspberry PI, WebRTC native statck uses this as the VideoCapturer and opens /dev/video first. So, This is used to prevent this case because the camera can not be used in MMAL when /dev/video is already opened.

BR,

sliver-chen commented 6 years ago

thanks to your reply. Any advice to my error code about "failed to set video send codecs?",i don't know how to deal with it. local peerconnection run in linux and remote peerconnection run in android. remote peerconnection report above error when set remote sdp. Anyway,thank for your reply.

kclyu commented 6 years ago

Have you tried the Testing URL http: //x.x.x.x:8889/ native-peerconnection / ? The source is in web-root/native-peerconnction/. Please check the Testing URL at first.

sliver-chen commented 6 years ago

let me see see. thanks.