2015-07-22 4 views
0

Я пытаюсь передать аудио из браузера в конвейер gstreamer на сервере.WebRTC to Gstreamer Bridge

В настоящее время я использую Kurento и модифицирую пример Hello World, чтобы попытаться подключить конечную точку RTP к конвейеру, но у меня проблемы.

Я знаю, что СМИ попадают туда, потому что, когда я поменяю место записи, я получаю действительную запись.

Kurento Node JS является:

pipeline.create("RtpEndpoint", {}, function(error, rtpEndpoint) { 
     if (error) { 
      console.log("Recorder problem"); 
      return sendError(res, 500, error); 
     } 

     console.log("Creating WebRtcEndpoint"); 
     pipeline.create('WebRtcEndpoint', function(error, webRtcEndpoint) { 
      if (error) { 
       return sendError(res, 500, error); 
      } 

      console.log("Processing sdpOffer at server and generating sdpAnswer"); 
      webRtcEndpoint.processOffer(sdpOffer, function(error, sdpAnswer) { 
       if (error) { 
        webRtcEndpoint.release(); 
        return sendError(res, 500, error); 
       } 

       console.log("Connecting loopback"); 
       webRtcEndpoint.connect(webRtcEndpoint, function(error) { 
        if(error){ 
         webRtcEndpoint.release(); 
         return sendError(res, 500, error); 
        } 
        console.log("Sending sdpAnswer to client"); 
        console.log(sdpAnswer); 

        webRtcEndpoint.connect(rtpEndpoint, function(error) { 
         if(error) { 
          webRtcEndpoint.release(); 
          return sendError(res, 500, error); 
         } 
         rtpEndpoint.generateOffer(function(error, offer) { 
          fs.writeFile('/tmp/test.sdp',offer); 
          console.log("RTP OFFER GENERATED."); 
         }); 
        }); 

        res.type('application/sdp'); 
        res.send(sdpAnswer); 
       });  
      }); 
     }); 
    }); 

и мой GStreamer трубопровод:

gst-launch-1.0 -vvvv filesrc location=/tmp/test.sdp ! sdpdemux ! decodebin ! autovideosink 

который возвращает

Setting pipeline to PAUSED ... 
Pipeline is live and does not need PREROLL ... 
Got context from element 'autovideosink0-actual-sink-glimage': gst.gl.GLDisplay=context, gst.gl.GLDisplay=(GstGLDisplay)"\(GstGLDisplayX11\)\ gldisplayx11-0"; 
Setting pipeline to PLAYING ... 
New clock: GstSystemClock 
/GstPipeline:pipeline0/GstSDPDemux:sdpdemux0/GstUDPSrc:udpsrc0: timeout = 10000000000 
/GstPipeline:pipeline0/GstSDPDemux:sdpdemux0/GstUDPSrc:udpsrc2: timeout = 10000000000 
/GstPipeline:pipeline0/GstSDPDemux:sdpdemux0/GstRtpBin:rtpbin0/GstRtpSession:rtpsession0.GstPad:send_rtcp_src: caps = application/x-rtcp 
/GstPipeline:pipeline0/GstSDPDemux:sdpdemux0/GstRtpBin:rtpbin0.GstGhostPad:send_rtcp_src_0: caps = application/x-rtcp 
/GstPipeline:pipeline0/GstSDPDemux:sdpdemux0/GstUDPSink:udpsink0.GstPad:sink: caps = application/x-rtcp 
/GstPipeline:pipeline0/GstSDPDemux:sdpdemux0/GstRtpBin:rtpbin0.GstGhostPad:send_rtcp_src_0.GstProxyPad:proxypad4: caps = application/x-rtcp 
/GstPipeline:pipeline0/GstSDPDemux:sdpdemux0/GstRtpBin:rtpbin0/GstRtpSession:rtpsession1.GstPad:send_rtcp_src: caps = application/x-rtcp 
/GstPipeline:pipeline0/GstSDPDemux:sdpdemux0/GstRtpBin:rtpbin0.GstGhostPad:send_rtcp_src_1: caps = application/x-rtcp 
/GstPipeline:pipeline0/GstSDPDemux:sdpdemux0/GstUDPSink:udpsink1.GstPad:sink: caps = application/x-rtcp 
/GstPipeline:pipeline0/GstSDPDemux:sdpdemux0/GstRtpBin:rtpbin0.GstGhostPad:send_rtcp_src_1.GstProxyPad:proxypad7: caps = application/x-rtcp 
ERROR: from element /GstPipeline:pipeline0/GstSDPDemux:sdpdemux0: Could not read from resource. 
Additional debug info: 
gstsdpdemux.c(1213): gst_sdp_demux_handle_message(): /GstPipeline:pipeline0/GstSDPDemux:sdpdemux0: 
Could not receive any UDP packets for 10.0000 seconds, maybe your firewall is blocking it. 
Execution ended after 0:00:10.062018001 
Setting pipeline to PAUSED ... 
Setting pipeline to READY ... 
Setting pipeline to NULL ... 
Freeing pipeline ... 

Это не работает на FFPMEG, VLC и т.д. - результаты аналогичны «Попытка 5.3» здесь: https://altanaitelecom.wordpress.com/2015/02/26/continue-streaming-broadcasting-live-video-call-to-non-webrtc-supported-browsers-and-media-players/

Я не думаю, что проблема с брандмауэром, поскольку конвейер и экземпляр kurento находятся на одной виртуальной машине (без брандмауэра), - и конечная точка записи работает. Это плохо связано? Есть ли более простой способ?

ответ

1

Использование RtpEndpoint сложно, потому что вам необходимо завершить переговоры по SDP. Это означает, что где-то после

rtpEndpoint.generateOffer(... 

вы должны ссылаться

rtpEndpoint.processAnswer(sdpAnswer, ...) 

Хитрость в том, что вам нужно, чтобы получить sdpAnswer от вашего GStreamer трубопровода, и это не является тривиальной, если вы хотите к нему просто используя gst-launch. Вероятно, ваш лучший вариант - написать небольшую программу, создающую конвейер и генерирующую sdpAnswer, чтобы вы могли вернуть его в rtpEndpoint через ваш сигнальный механизм.