Java 类org.webrtc.SessionDescription 实例源码

项目:AppRTC-Android    文件:CallActivity.java   
@Override
public void onRemoteDescription(final SessionDescription sdp) {
  final long delta = System.currentTimeMillis() - callStartedTimeMs;
  runOnUiThread(new Runnable() {
    @Override
    public void run() {
      if (peerConnectionClient == null) {
        Log.e(TAG, "Received remote SDP for non-initilized peer connection.");
        return;
      }
      logAndToast("Received remote " + sdp.type + ", delay=" + delta + "ms");
      peerConnectionClient.setRemoteDescription(sdp);
      if (!signalingParameters.initiator) {
        logAndToast("Creating ANSWER...");
        // Create answer. Answer SDP will be sent to offering client in
        // PeerConnectionEvents.onLocalDescription event.
        peerConnectionClient.createAnswer();
      }
    }
  });
}
项目:AppRTC-Android    文件:CallActivity.java   
@Override
public void onLocalDescription(final SessionDescription sdp) {
  final long delta = System.currentTimeMillis() - callStartedTimeMs;
  runOnUiThread(new Runnable() {
    @Override
    public void run() {
      if (appRtcClient != null) {
        logAndToast("Sending " + sdp.type + ", delay=" + delta + "ms");
        if (signalingParameters.initiator) {
          appRtcClient.sendOfferSdp(sdp);
        } else {
          appRtcClient.sendAnswerSdp(sdp);
        }
      }
      if (peerConnectionParameters.videoMaxBitrate > 0) {
        Log.d(TAG, "Set video maximum bitrate: " + peerConnectionParameters.videoMaxBitrate);
        peerConnectionClient.setVideoMaxBitrate(peerConnectionParameters.videoMaxBitrate);
      }
    }
  });
}
项目:newwebrtc    文件:PnPeer.java   
@Override
public void onCreateSuccess(SessionDescription sdp) {
    // TODO: modify sdp to use pcParams prefered codecs
    try {
        JSONObject payload = new JSONObject();
        payload.put("type", sdp.type.canonicalForm());
        payload.put("sdp", sdp.description);
        Log.i("cek tipe", sdp.type.toString());
        Log.i("create sukses", "seberkas cahaya");
        pc.setLocalDescription(PnPeer.this, sdp);
        pcClient.transmitMessage(id, payload);

    } catch (JSONException e) {
        e.printStackTrace();
    }
}
项目:nc-android-webrtcpeer    文件:PeerConnectionClient.java   
public void setRemoteDescription(final SessionDescription sdp) {
    executor.execute(new Runnable() {
        @Override
        public void run() {
            if (peerConnection == null || isError) {
                return;
            }
            String sdpDescription = sdp.description;
            if (preferIsac) {
                sdpDescription = preferCodec(sdpDescription, AUDIO_CODEC_ISAC, true);
            }
            if (videoCallEnabled) {
                sdpDescription = preferCodec(sdpDescription, preferredVideoCodec, false);
            }
            if (peerConnectionParameters.audioStartBitrate > 0) {
                sdpDescription = setStartBitrate(
                        AUDIO_CODEC_OPUS, false, sdpDescription, peerConnectionParameters.audioStartBitrate);
            }
            Log.d(TAG, "Set remote SDP.");
            SessionDescription sdpRemote = new SessionDescription(sdp.type, sdpDescription);
            peerConnection.setRemoteDescription(sdpObserver, sdpRemote);
        }
    });
}
项目:nc-android-webrtcpeer    文件:PeerConnectionClient.java   
@Override
public void onCreateSuccess(final SessionDescription origSdp) {
    if (localSdp != null) {
        reportError("Multiple SDP create.");
        return;
    }
    String sdpDescription = origSdp.description;
    if (preferIsac) {
        sdpDescription = preferCodec(sdpDescription, AUDIO_CODEC_ISAC, true);
    }
    if (videoCallEnabled) {
        sdpDescription = preferCodec(sdpDescription, preferredVideoCodec, false);
    }
    final SessionDescription sdp = new SessionDescription(origSdp.type, sdpDescription);
    localSdp = sdp;
    executor.execute(new Runnable() {
        @Override
        public void run() {
            if (peerConnection != null && !isError) {
                Log.d(TAG, "Set local SDP from " + sdp.type);
                peerConnection.setLocalDescription(sdpObserver, sdp);
            }
        }
    });
}
项目:Achilles_Android    文件:MainActivity.java   
@Override
public void onCreateSuccess(final SessionDescription sessionDescription) {
    mExecutorService.execute(new Runnable() {
        @Override
        public void run() {
            curPeerConnection.setLocalDescription(mSDPObserver, sessionDescription);
            Log.d(TAG, "Set local SessionDescription and send message.");

            // Sending offer to monitor.
            JSONObject offer = new JSONObject();
            jsonPut(offer, "monitor_id", curMonitorId);
            jsonPut(offer, "type", "offer");
            jsonPut(offer, "sdp", sessionDescription.description.toString());

            Log.d(TAG, "Sending offer SesssionDescription to monitor.");
            sendMessage(offer);
        }
    });
}
项目:AppRTC-Android    文件:WebSocketRTCClient.java   
@Override
public void sendOfferSdp(final SessionDescription sdp) {
  handler.post(new Runnable() {
    @Override
    public void run() {
      if (roomState != ConnectionState.CONNECTED) {
        reportError("Sending offer SDP in non connected state.");
        return;
      }
      JSONObject json = new JSONObject();
      jsonPut(json, "sdp", sdp.description);
      jsonPut(json, "type", "offer");
      sendPostMessage(MessageType.MESSAGE, messageUrl, json.toString());
      if (connectionParameters.loopback) {
        // In loopback mode rename this offer to answer and route it back.
        SessionDescription sdpAnswer = new SessionDescription(
            SessionDescription.Type.fromCanonicalForm("answer"), sdp.description);
        events.onRemoteDescription(sdpAnswer);
      }
    }
  });
}
项目:AppRTC-Android    文件:WebSocketRTCClient.java   
@Override
public void sendAnswerSdp(final SessionDescription sdp) {
  handler.post(new Runnable() {
    @Override
    public void run() {
      if (connectionParameters.loopback) {
        Log.e(TAG, "Sending answer in loopback mode.");
        return;
      }
      JSONObject json = new JSONObject();
      jsonPut(json, "sdp", sdp.description);
      jsonPut(json, "type", "answer");
      wsClient.send(json.toString());
    }
  });
}
项目:AppRTC-Android    文件:DirectRTCClient.java   
@Override
public void sendOfferSdp(final SessionDescription sdp) {
  executor.execute(new Runnable() {
    @Override
    public void run() {
      if (roomState != ConnectionState.CONNECTED) {
        reportError("Sending offer SDP in non connected state.");
        return;
      }
      JSONObject json = new JSONObject();
      jsonPut(json, "sdp", sdp.description);
      jsonPut(json, "type", "offer");
      sendMessage(json.toString());
    }
  });
}
项目:AppRTC-Android    文件:PeerConnectionClient.java   
public void setRemoteDescription(final SessionDescription sdp) {
  executor.execute(new Runnable() {
    @Override
    public void run() {
      if (peerConnection == null || isError) {
        return;
      }
      String sdpDescription = sdp.description;
      if (preferIsac) {
        sdpDescription = preferCodec(sdpDescription, AUDIO_CODEC_ISAC, true);
      }
      if (videoCallEnabled) {
        sdpDescription = preferCodec(sdpDescription, preferredVideoCodec, false);
      }
      if (peerConnectionParameters.audioStartBitrate > 0) {
        sdpDescription = setStartBitrate(
            AUDIO_CODEC_OPUS, false, sdpDescription, peerConnectionParameters.audioStartBitrate);
      }
      Log.d(TAG, "Set remote SDP.");
      SessionDescription sdpRemote = new SessionDescription(sdp.type, sdpDescription);
      peerConnection.setRemoteDescription(sdpObserver, sdpRemote);
    }
  });
}
项目:AppRTC-Android    文件:PeerConnectionClient.java   
@Override
public void onCreateSuccess(final SessionDescription origSdp) {
  if (localSdp != null) {
    reportError("Multiple SDP create.");
    return;
  }
  String sdpDescription = origSdp.description;
  if (preferIsac) {
    sdpDescription = preferCodec(sdpDescription, AUDIO_CODEC_ISAC, true);
  }
  if (videoCallEnabled) {
    sdpDescription = preferCodec(sdpDescription, preferredVideoCodec, false);
  }
  final SessionDescription sdp = new SessionDescription(origSdp.type, sdpDescription);
  localSdp = sdp;
  executor.execute(new Runnable() {
    @Override
    public void run() {
      if (peerConnection != null && !isError) {
        Log.d(TAG, "Set local SDP from " + sdp.type);
        peerConnection.setLocalDescription(sdpObserver, sdp);
      }
    }
  });
}
项目:AndroidRTC    文件:PeerConnectionClient.java   
public void setRemoteDescription(final SessionDescription sdp) {
    executor.execute(new Runnable() {
        @Override
        public void run() {
            if (peerConnection == null || isError) {
                return;
            }
            String sdpDescription = sdp.description;
            if (preferIsac) {
                sdpDescription = preferCodec(sdpDescription, AUDIO_CODEC_ISAC, true);
            }
            if (videoCallEnabled) {
                sdpDescription = preferCodec(sdpDescription, preferredVideoCodec, false);
            }
            if (peerConnectionParameters.audioStartBitrate > 0) {
                sdpDescription = setStartBitrate(
                        AUDIO_CODEC_OPUS, false, sdpDescription, peerConnectionParameters.audioStartBitrate);
            }
            Log.d(TAG, "Set remote SDP.");
            SessionDescription sdpRemote = new SessionDescription(sdp.type, sdpDescription);
            peerConnection.setRemoteDescription(sdpObserver, sdpRemote);
        }
    });
}
项目:AndroidRTC    文件:PeerConnectionClient.java   
@Override
public void onCreateSuccess(final SessionDescription origSdp) {
    if (localSdp != null) {
        reportError("Multiple SDP create.");
        return;
    }
    String sdpDescription = origSdp.description;
    if (preferIsac) {
        sdpDescription = preferCodec(sdpDescription, AUDIO_CODEC_ISAC, true);
    }
    if (videoCallEnabled) {
        sdpDescription = preferCodec(sdpDescription, preferredVideoCodec, false);
    }
    final SessionDescription sdp = new SessionDescription(origSdp.type, sdpDescription);
    localSdp = sdp;
    executor.execute(new Runnable() {
        @Override
        public void run() {
            if (peerConnection != null && !isError) {
                Log.d(TAG, "Set local SDP from " + sdp.type);
                peerConnection.setLocalDescription(sdpObserver, sdp);
            }
        }
    });
}
项目:AndroidRTC    文件:CallActivity.java   
@Override
public void onRemoteDescription(final SessionDescription sdp) {
    final long delta = System.currentTimeMillis() - callStartedTimeMs;
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            if (peerConnectionClient == null) {
                Log.e(TAG, "Received remote SDP for non-initilized peer connection.");
                return;
            }
            logAndToast("Received remote " + sdp.type + ", delay=" + delta + "ms");
            peerConnectionClient.setRemoteDescription(sdp);
            if (!signalingParameters.initiator) {
                logAndToast("Creating ANSWER...");
                // Create answer. Answer SDP will be sent to offering client in
                // PeerConnectionEvents.onLocalDescription event.
                peerConnectionClient.createAnswer();
            }
        }
    });
}
项目:AndroidRTC    文件:CallActivity.java   
@Override
public void onLocalDescription(final SessionDescription sdp) {
    final long delta = System.currentTimeMillis() - callStartedTimeMs;
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            if (appRtcClient != null) {
                logAndToast("Sending " + sdp.type + ", delay=" + delta + "ms");
                if (signalingParameters.initiator) {
                    appRtcClient.sendOfferSdp(sdp);
                } else {
                    appRtcClient.sendAnswerSdp(sdp);
                }
            }
            if (peerConnectionParameters.videoMaxBitrate > 0) {
                Log.d(TAG, "Set video maximum bitrate: " + peerConnectionParameters.videoMaxBitrate);
                peerConnectionClient.setVideoMaxBitrate(peerConnectionParameters.videoMaxBitrate);
            }
        }
    });
}
项目:AndroidRTC    文件:WebSocketRTCClient.java   
@Override
public void sendOfferSdp(final SessionDescription sdp) {
    handler.post(new Runnable() {
        @Override
        public void run() {
            if (roomState != ConnectionState.CONNECTED) {
                reportError("Sending offer SDP in non connected state.");
                return;
            }
            JSONObject json = new JSONObject();
            jsonPut(json, "sdp", sdp.description);
            jsonPut(json, "type", "offer");
            sendPostMessage(MessageType.MESSAGE, messageUrl, json.toString());
            if (connectionParameters.loopback) {
                // In loopback mode rename this offer to answer and route it back.
                SessionDescription sdpAnswer = new SessionDescription(
                        SessionDescription.Type.fromCanonicalForm("answer"), sdp.description);
                events.onRemoteDescription(sdpAnswer);
            }
        }
    });
}
项目:AndroidRTC    文件:WebSocketRTCClient.java   
@Override
public void sendAnswerSdp(final SessionDescription sdp) {
    handler.post(new Runnable() {
        @Override
        public void run() {
            if (connectionParameters.loopback) {
                Log.e(TAG, "Sending answer in loopback mode.");
                return;
            }
            JSONObject json = new JSONObject();
            jsonPut(json, "sdp", sdp.description);
            jsonPut(json, "type", "answer");
            wsClient.send(json.toString());
        }
    });
}
项目:AndroidRTC    文件:DirectRTCClient.java   
@Override
public void sendOfferSdp(final SessionDescription sdp) {
    executor.execute(new Runnable() {
        @Override
        public void run() {
            if (roomState != ConnectionState.CONNECTED) {
                reportError("Sending offer SDP in non connected state.");
                return;
            }
            JSONObject json = new JSONObject();
            jsonPut(json, "sdp", sdp.description);
            jsonPut(json, "type", "offer");
            sendMessage(json.toString());
        }
    });
}
项目:nubo-test    文件:PeerVideoActivity.java   
@Override
public void onRoomResponse(RoomResponse response) {
    Log.d(TAG, "OnRoomResponse:" + response);
    int requestId =response.getId();

    if (requestId == publishVideoRequestId){

        SessionDescription sd = new SessionDescription(SessionDescription.Type.ANSWER,
                                                        response.getValue("sdpAnswer").get(0));

        // Check if we are waiting for publication of our own vide
        if (callState == CallState.PUBLISHING){
            callState = CallState.PUBLISHED;
            nbmWebRTCPeer.processAnswer(sd, "local");
            mHandler.postDelayed(offerWhenReady, 2000);

        // Check if we are waiting for the video publication of the other peer
        } else if (callState == CallState.WAITING_REMOTE_USER){
            //String user_name = Integer.toString(publishVideoRequestId);
            callState = CallState.RECEIVING_REMOTE_USER;
            String connectionId = videoRequestUserMapping.get(publishVideoRequestId);
            nbmWebRTCPeer.processAnswer(sd, connectionId);
        }
    }

}
项目:webrtc-android    文件:WebSocketRTCClient.java   
@Override
public void sendOfferSdp(final SessionDescription sdp) {
  executor.execute(new Runnable() {
    @Override
    public void run() {
      if (roomState != ConnectionState.CONNECTED) {
        reportError("Sending offer SDP in non connected state.");
        return;
      }
      JSONObject json = new JSONObject();
      jsonPut(json, "sdp", sdp.description);
      jsonPut(json, "type", "offer");
      sendPostMessage(MessageType.MESSAGE, messageUrl, json.toString());
      if (connectionParameters.loopback) {
        // In loopback mode rename this offer to answer and route it back.
        SessionDescription sdpAnswer = new SessionDescription(
            SessionDescription.Type.fromCanonicalForm("answer"),
            sdp.description);
        events.onRemoteDescription(sdpAnswer);
      }
    }
  });
}
项目:webrtc-android    文件:WebSocketRTCClient.java   
@Override
public void sendAnswerSdp(final SessionDescription sdp) {
  executor.execute(new Runnable() {
    @Override
    public void run() {
      if (connectionParameters.loopback) {
        Log.e(TAG, "Sending answer in loopback mode.");
        return;
      }
      JSONObject json = new JSONObject();
      jsonPut(json, "sdp", sdp.description);
      jsonPut(json, "type", "answer");
      wsClient.send(json.toString());
    }
  });
}
项目:webrtc-android    文件:CallActivity.java   
@Override
    public void onRemoteDescription(final SessionDescription sdp) {
//      final long delta = System.currentTimeMillis() - callStartedTimeMs;
//      runOnUiThread(new Runnable() {
//          @Override
//          public void run() {
//              if (peerConnectionClient == null) {
//                  Log.e(TAG, "Received remote SDP for non-initilized peer connection.");
//                  return;
//              }
//              logAndToast("Received remote " + sdp.type + ", delay=" + delta + "ms");
//              peerConnectionClient.setRemoteDescription(sdp);
//              if (!signalingParameters.initiator) {
//                  logAndToast("Creating ANSWER...");
//                  // Create answer. Answer SDP will be sent to offering client in
//                  // PeerConnectionEvents.onLocalDescription event.
//                  peerConnectionClient.createAnswer();
//              }
//          }
//      });
    }
项目:webrtc-android    文件:CallActivity.java   
@Override
public void onLocalDescription(final SessionDescription sdp) {
    final long delta = System.currentTimeMillis() - callStartedTimeMs;
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            if (appRtcClient != null) {
                logAndToast("Sending " + sdp.type + ", delay=" + delta + "ms");
                if (signalingParameters.initiator) {
                    appRtcClient.sendOfferSdp(sdp);
                } else {
                    appRtcClient.sendAnswerSdp(sdp);
                }
            }
        }
    });
}
项目:viska-android    文件:CallingActivity.java   
private void initializeInboundCall() {
  id = getIntent().getStringExtra(EXTRA_SESSION_ID);

  final Application application = (Application) getApplication();
  final PeerConnectionFactory factory = application.getWebRtcFactory();

  peerConnection = factory.createPeerConnection(
      application.getBuiltInIceServers(),
      CONSTRAINTS,
      new PeerConnectionObserver()
  );
  peerConnection.setRemoteDescription(
      sdpObserver,
      new SessionDescription(
          SessionDescription.Type.OFFER,
          getIntent().getStringExtra(EXTRA_REMOTE_SDP)
      )
  );
}
项目:nubo-test-tree    文件:MasterVideoActivity.java   
@Override
public void onLocalSdpOfferGenerated(final SessionDescription sessionDescription, NBMPeerConnection nbmPeerConnection) {
    localSdp = sessionDescription;

    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            if (MainActivity.getKurentoTreeAPIInstance() != null) {
                Log.d(TAG, "Sending " + sessionDescription.type);
                setTreeSourceRequestId = ++Constants.id;

                MainActivity.getKurentoTreeAPIInstance().sendSetTreeSource(treeId, localSdp.description, setTreeSourceRequestId);
                treeState = TreeState.SETTING_SOURCE;
            }
        }
    });
}
项目:nubo-test-tree    文件:MasterVideoActivity.java   
@Override
public void onTreeResponse(TreeResponse response) {
    Log.d(TAG, "OnTreeResponse:" + response);
    if (Integer.valueOf(response.getId()) == createTreeRequestId) {

        // Tree created, now create the local source
        nbmWebRTCPeer.generateOffer("derp", true);
        treeState = TreeState.CREATING_LOCAL_SOURCE;
    }

    if (Integer.valueOf(response.getId()) == setTreeSourceRequestId){

        SessionDescription sd = new SessionDescription(SessionDescription.Type.ANSWER,
                                                        response.getValue("answerSdp"));
        nbmWebRTCPeer.processAnswer(sd, "derp");
        treeState = TreeState.SET_SOURCE;
    }
}
项目:nubo-test-tree    文件:ViewerVideoActivity.java   
@Override
public void onLocalSdpOfferGenerated(final SessionDescription sessionDescription, NBMPeerConnection nbmPeerConnection) {
     // Asking for remote user video
    remoteSdp = sessionDescription;
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            if (MainActivity.getKurentoTreeAPIInstance() != null) {
                Log.d(TAG, "Adding sink " + sessionDescription.type);
                addSinkRequestId = ++Constants.id;

                MainActivity.getKurentoTreeAPIInstance().sendAddTreeSink(treeId, remoteSdp.description, addSinkRequestId);
                treeState = TreeState.JOINING;
            }
        }
    });
}
项目:nubo-test-tree    文件:ViewerVideoActivity.java   
@Override
public void onTreeResponse(TreeResponse response) {
    Log.d(TAG, "OnTreeResponse:" + response);
    if (Integer.valueOf(response.getId()) == addSinkRequestId){
            sinkId = response.getValue("sinkId");
            while (!queuedIceCandidates.isEmpty()) {
                IceCandidate ic = queuedIceCandidates.remove(0);
                onIceCandidate(ic, null);
            }
            SessionDescription sd = new SessionDescription(SessionDescription.Type.ANSWER,
                                                        response.getValue("answerSdp"));
            treeState = TreeState.JOINED;
            nbmWebRTCPeer.processAnswer(sd, "remote");
    } else {
            //NOP
    }
}
项目:DeviceConnect-Android    文件:MediaConnection.java   
/**
 * Creates an answer message from json message.
 * @param json offer message
 */
public void createAnswer(final JSONObject json) {
    if (BuildConfig.DEBUG) {
        Log.d(TAG, "@@@ MediaConnection::createAnswer");
        Log.d(TAG, "@@@@ json: " + json.toString());
    }

    JSONObject payload = json.optJSONObject("payload");
    JSONObject sdpObj = payload.optJSONObject("sdp");
    String type = PeerUtil.getJSONString(sdpObj, "type", "");
    String sdp = PeerUtil.getJSONString(sdpObj, "sdp", "");
    if (getType().equalsIgnoreCase("media")) {
        sdp = preferCodec(sdp, AUDIO_CODEC_ISAC, true);
        sdp = preferCodec(sdp, VIDEO_CODEC_H264, false);
    }

    SessionDescription.Type sdpType = SessionDescription.Type.OFFER;
    mConnectionId = PeerUtil.getJSONString(payload, "connectionId", null);
    mRemoteSdp = new SessionDescription(sdpType, sdp);
    if (mPeerConnection != null) {
        mPeerConnection.setRemoteDescription(mSdpObserver, mRemoteSdp);
    }

    mOpen = true;
}
项目:DeviceConnect-Android    文件:MediaConnection.java   
/**
 * Handles an answer message.
 * @param json message
 */
public void handleAnswer(final JSONObject json) {
    if (BuildConfig.DEBUG) {
        Log.d(TAG, "@@@@ handleAnswer");
        Log.d(TAG, "@@@@ json: " + json.toString());
    }

    JSONObject payload = json.optJSONObject("payload");
    JSONObject sdpObj = payload.optJSONObject("sdp");
    String type = PeerUtil.getJSONString(sdpObj, "type", "");
    String sdp = PeerUtil.getJSONString(sdpObj, "sdp", "");
    if (getType().equalsIgnoreCase("media")) {
        sdp = preferCodec(sdp, AUDIO_CODEC_ISAC, true);
        sdp = preferCodec(sdp, VIDEO_CODEC_H264, false);
    }

    SessionDescription.Type sdpType = SessionDescription.Type.ANSWER;
    mBrowser = PeerUtil.getJSONString(payload, "browser", "Supported");
    mRemoteSdp = new SessionDescription(sdpType, sdp);
    if (mPeerConnection != null) {
        mPeerConnection.setRemoteDescription(mSdpObserver, mRemoteSdp);
    }

    mOpen = true;
}
项目:DeviceConnect-Android    文件:MediaConnection.java   
@Override
public void onCreateSuccess(final SessionDescription sessionDescription) {
    if (BuildConfig.DEBUG) {
        Log.d(TAG, "@@@ onCreateSuccess");
        Log.d(TAG, "@@@ Description: " + sessionDescription.toString());
    }

    String sdp = sessionDescription.description;
    if (getType().equalsIgnoreCase("media")) {
        sdp = preferCodec(sdp, AUDIO_CODEC_ISAC, true);
        sdp = preferCodec(sdp, VIDEO_CODEC_H264, false);
    }

    mSdp = new SessionDescription(sessionDescription.type, sdp);
    mPeerConnection.setLocalDescription(mSdpObserver, mSdp);
}
项目:webrtcpeer-android    文件:NBMPeerConnection.java   
@Override
public void onCreateSuccess(SessionDescription sessionDescription) {
    assert(localSdp != null);
    String sdpDescription = sessionDescription.description;
    if (preferIsac) {
        sdpDescription = preferCodec(sdpDescription, NBMMediaConfiguration.NBMAudioCodec.ISAC.toString(), true);
    }
    if (videoCallEnabled && preferH264) {
        sdpDescription = preferCodec(sdpDescription, NBMMediaConfiguration.NBMVideoCodec.H264.toString(), false);
    }
    final SessionDescription sdp = new SessionDescription(sessionDescription.type, sdpDescription);
    localSdp = sdp;
    executor.execute(new Runnable() {
        @Override
        public void run() {
            if (pc != null) {// && !isError) {
                Log.d(TAG, "Set local SDP from " + sdp.type);
                pc.setLocalDescription(NBMPeerConnection.this, sdp);
            }
        }
    });
}
项目:webrtcpeer-android    文件:NBMPeerConnection.java   
protected void setRemoteDescriptionSync(SessionDescription sdp) {
    if (pc == null){// || isError) {
        return;
    }
    String sdpDescription = sdp.description;
    if (preferIsac) {
        sdpDescription = preferCodec(sdpDescription, NBMMediaConfiguration.NBMAudioCodec.ISAC.toString(), true);
    }
    if (videoCallEnabled && preferH264) {
        sdpDescription = preferCodec(sdpDescription, NBMMediaConfiguration.NBMVideoCodec.H264.toString(), false);
    }
    if (videoCallEnabled && peerConnectionParameters.videoStartBitrate > 0) {
        sdpDescription = setStartBitrate(NBMMediaConfiguration.NBMVideoCodec.VP8.toString(), true, sdpDescription, peerConnectionParameters.videoStartBitrate);
        sdpDescription = setStartBitrate(NBMMediaConfiguration.NBMVideoCodec.VP9.toString(), true, sdpDescription, peerConnectionParameters.videoStartBitrate);
        sdpDescription = setStartBitrate(NBMMediaConfiguration.NBMVideoCodec.H264.toString(), true, sdpDescription, peerConnectionParameters.videoStartBitrate);
    }
    if (peerConnectionParameters.audioStartBitrate > 0) {
        sdpDescription = setStartBitrate(NBMMediaConfiguration.NBMAudioCodec.OPUS.toString(), false, sdpDescription, peerConnectionParameters.audioStartBitrate);
    }
    Log.d(TAG, "Set remote SDP.");
    SessionDescription sdpRemote = new SessionDescription(sdp.type, sdpDescription);
    pc.setRemoteDescription(NBMPeerConnection.this, sdpRemote);
}
项目:voip_android    文件:WebRTCActivity.java   
public void onRemoteDescription(final SessionDescription sdp) {
    final long delta = System.currentTimeMillis() - callStartedTimeMs;
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            if (peerConnectionClient == null) {
                Log.e(TAG, "Received remote SDP for non-initilized peer connection.");
                return;
            }
            logAndToast("Received remote " + sdp.type + ", delay=" + delta + "ms");
            peerConnectionClient.setRemoteDescription(sdp);
            if (!WebRTCActivity.this.isCaller) {
                logAndToast("Creating ANSWER...");
                // Create answer. Answer SDP will be sent to offering client in
                // PeerConnectionEvents.onLocalDescription event.
                peerConnectionClient.createAnswer();
            }
        }
    });
}
项目:voip_android    文件:WebRTCActivity.java   
@Override
public void onLocalDescription(final SessionDescription sdp) {
    final long delta = System.currentTimeMillis() - callStartedTimeMs;
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            logAndToast("Sending " + sdp.type + ", delay=" + delta + "ms");
            if (WebRTCActivity.this.isCaller) {
                WebRTCActivity.this.sendOfferSdp(sdp);
            } else {
                WebRTCActivity.this.sendAnswerSdp(sdp);
            }

            if (peerConnectionParameters.videoMaxBitrate > 0) {
                Log.d(TAG, "Set video maximum bitrate: " + peerConnectionParameters.videoMaxBitrate);
                peerConnectionClient.setVideoMaxBitrate(peerConnectionParameters.videoMaxBitrate);
            }
        }
    });
}
项目:voip_android    文件:PeerConnectionClient.java   
public void setRemoteDescription(final SessionDescription sdp) {
    executor.execute(new Runnable() {
        @Override
        public void run() {
            if (peerConnection == null || isError) {
                return;
            }
            String sdpDescription = sdp.description;
            if (preferIsac) {
                sdpDescription = preferCodec(sdpDescription, AUDIO_CODEC_ISAC, true);
            }
            if (videoCallEnabled) {
                sdpDescription = preferCodec(sdpDescription, preferredVideoCodec, false);
            }
            if (peerConnectionParameters.audioStartBitrate > 0) {
                sdpDescription = setStartBitrate(
                        AUDIO_CODEC_OPUS, false, sdpDescription, peerConnectionParameters.audioStartBitrate);
            }
            Log.d(TAG, "Set remote SDP.");
            SessionDescription sdpRemote = new SessionDescription(sdp.type, sdpDescription);
            peerConnection.setRemoteDescription(sdpObserver, sdpRemote);
        }
    });
}
项目:voip_android    文件:PeerConnectionClient.java   
@Override
public void onCreateSuccess(final SessionDescription origSdp) {
    if (localSdp != null) {
        reportError("Multiple SDP create.");
        return;
    }
    String sdpDescription = origSdp.description;
    if (preferIsac) {
        sdpDescription = preferCodec(sdpDescription, AUDIO_CODEC_ISAC, true);
    }
    if (videoCallEnabled) {
        sdpDescription = preferCodec(sdpDescription, preferredVideoCodec, false);
    }
    final SessionDescription sdp = new SessionDescription(origSdp.type, sdpDescription);
    localSdp = sdp;
    executor.execute(new Runnable() {
        @Override
        public void run() {
            if (peerConnection != null && !isError) {
                Log.d(TAG, "Set local SDP from " + sdp.type);
                peerConnection.setLocalDescription(sdpObserver, sdp);
            }
        }
    });
}
项目:restcomm-android-sdk    文件:SignalingParameters.java   
public SignalingParameters(
      List<PeerConnection.IceServer> iceServers,
      boolean initiator,
      String clientId,
      String sipUrl,
      String wssPostUrl,
      SessionDescription offerSdp,
      List<IceCandidate> iceCandidates,
      HashMap<String, String> sipHeaders,
      boolean videoEnabled)
{
   this.iceServers = iceServers;
   this.initiator = initiator;
   this.clientId = clientId;
   this.sipUrl = sipUrl;
   this.wssPostUrl = wssPostUrl;
   this.offerSdp = offerSdp;
   this.answerSdp = null;
   this.iceCandidates = iceCandidates;
   this.sipHeaders = sipHeaders;
   this.videoEnabled = videoEnabled;
   //this.answerIceCandidates = null;
}
项目:restcomm-android-sdk    文件:PeerConnectionClient.java   
public void setRemoteDescription(final SessionDescription sdp) {
  executor.execute(new Runnable() {
    @Override
    public void run() {
      if (peerConnection == null || isError) {
        return;
      }
      String sdpDescription = sdp.description;
      if (preferIsac) {
        sdpDescription = preferCodec(sdpDescription, AUDIO_CODEC_ISAC, true);
      }
      if (videoCallEnabled) {
        sdpDescription = preferCodec(sdpDescription, preferredVideoCodec, false);
      }
      if (peerConnectionParameters.audioStartBitrate > 0) {
        sdpDescription = setStartBitrate(
            AUDIO_CODEC_OPUS, false, sdpDescription, peerConnectionParameters.audioStartBitrate);
      }
      Log.d(TAG, "Set remote SDP.");
      SessionDescription sdpRemote = new SessionDescription(sdp.type, sdpDescription);
      peerConnection.setRemoteDescription(sdpObserver, sdpRemote);
    }
  });
}
项目:restcomm-android-sdk    文件:PeerConnectionClient.java   
@Override
public void onCreateSuccess(final SessionDescription origSdp) {
  if (localSdp != null) {
    reportError("Multiple SDP create.");
    return;
  }
  String sdpDescription = origSdp.description;
  if (preferIsac) {
    sdpDescription = preferCodec(sdpDescription, AUDIO_CODEC_ISAC, true);
  }
  if (videoCallEnabled) {
    sdpDescription = preferCodec(sdpDescription, preferredVideoCodec, false);
  }
  final SessionDescription sdp = new SessionDescription(origSdp.type, sdpDescription);
  localSdp = sdp;
  executor.execute(new Runnable() {
    @Override
    public void run() {
      if (peerConnection != null && !isError) {
        Log.d(TAG, "Set local SDP from " + sdp.type);
        peerConnection.setLocalDescription(sdpObserver, sdp);
      }
    }
  });
}