kurento RtpEndpoint rtpストリームの取得


この修正案は、kurento-tutorial-java項目のkurento-hello-world試験demoに基づいて修正された.
  private void handleProcessSdpOffer(final WebSocketSession session,
      JsonObject jsonMessage)
  {
    // ---- Session handling

    final String sessionId = session.getId();

    log.info("[Handler::handleStart] User count: {}", users.size());
    log.info("[Handler::handleStart] New user, id: {}", sessionId);

    final UserSession user = new UserSession();
    users.put(sessionId, user);


    // ---- Media pipeline

    log.info("[Handler::handleStart] Create Media Pipeline");

    final MediaPipeline pipeline = kurento.createMediaPipeline();
    user.setMediaPipeline(pipeline);

    final WebRtcEndpoint webRtcEp =
        new WebRtcEndpoint.Builder(pipeline).build();
    user.setWebRtcEndpoint(webRtcEp);
    webRtcEp.connect(webRtcEp);

    // ---- Endpoint configuration
	String sdpOffer = jsonMessage.get("sdpOffer").getAsString();
	initWebRtcEndpoint(session, webRtcEp, sdpOffer);
	
	log.info("[Handler::handleStart] New WebRtcEndpoint: {}",
	                     webRtcEp.getName());
     
    // change by dws
    RtpEndpoint rtpEndpoint = new RtpEndpoint.Builder(pipeline).build();
    webRtcEp.connect(rtpEndpoint);
    RtpEndpoint rtpEndpoint1 = new RtpEndpoint.Builder(pipeline).build();
    rtpEndpoint1.connect(webRtcEp);
 
    String genOffer = rtpEndpoint1.generateOffer();
    String sdpRtpOfferString = "v=0
"
; sdpRtpOfferString += "o=- 0 0 IN IP4 " + "11.0.4.136" + "
"
; sdpRtpOfferString += "s=KMS
"
; sdpRtpOfferString += "c=IN IP4 " + "11.0.4.136" + "
"
; sdpRtpOfferString += "t=0 0
"
; sdpRtpOfferString += "m=audio " + "16666" + " RTP/AVP 97
"
; sdpRtpOfferString += "a=recvonly
"
; sdpRtpOfferString += "a=rtpmap:97 PCMU/8000
"
; sdpRtpOfferString += "a=fmtp:97 profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;config=1508
"
; sdpRtpOfferString += "m=video " + "18888" + " RTP/AVP 96
"
; sdpRtpOfferString += "a=rtpmap:96 H264/90000
"
; sdpRtpOfferString += "a=fmtp:96 packetization-mode=1
"
; genOffer = sdpRtpOfferString; log.debug("[Handler::handleStart] RTP offer info", genOffer); String answer = rtpEndpoint.processOffer(genOffer); rtpEndpoint1.processAnswer(answer); log.error("
genOffer:
"
+ genOffer+"

answer:
"
+answer); // webRtcEp.connect(webRtcEp); startWebRtcEndpoint(webRtcEp); }