当前位置: 首页>>代码示例>>Java>>正文


Java SessionDescription类代码示例

本文整理汇总了Java中org.webrtc.SessionDescription的典型用法代码示例。如果您正苦于以下问题:Java SessionDescription类的具体用法?Java SessionDescription怎么用?Java SessionDescription使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SessionDescription类属于org.webrtc包,在下文中一共展示了SessionDescription类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onRemoteDescription

import org.webrtc.SessionDescription; //导入依赖的package包/类
@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();
      }
    }
  });
}
 
开发者ID:Piasy,项目名称:AppRTC-Android,代码行数:22,代码来源:CallActivity.java

示例2: onLocalDescription

import org.webrtc.SessionDescription; //导入依赖的package包/类
@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);
      }
    }
  });
}
 
开发者ID:Piasy,项目名称:AppRTC-Android,代码行数:22,代码来源:CallActivity.java

示例3: onCreateSuccess

import org.webrtc.SessionDescription; //导入依赖的package包/类
@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();
    }
}
 
开发者ID:newbie007fx,项目名称:newwebrtc,代码行数:17,代码来源:PnPeer.java

示例4: setRemoteDescription

import org.webrtc.SessionDescription; //导入依赖的package包/类
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);
        }
    });
}
 
开发者ID:nhancv,项目名称:nc-android-webrtcpeer,代码行数:25,代码来源:PeerConnectionClient.java

示例5: onCreateSuccess

import org.webrtc.SessionDescription; //导入依赖的package包/类
@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);
            }
        }
    });
}
 
开发者ID:nhancv,项目名称:nc-android-webrtcpeer,代码行数:26,代码来源:PeerConnectionClient.java

示例6: onCreateSuccess

import org.webrtc.SessionDescription; //导入依赖的package包/类
@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);
        }
    });
}
 
开发者ID:crazytaxii,项目名称:Achilles_Android,代码行数:20,代码来源:MainActivity.java

示例7: sendOfferSdp

import org.webrtc.SessionDescription; //导入依赖的package包/类
@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);
      }
    }
  });
}
 
开发者ID:Piasy,项目名称:AppRTC-Android,代码行数:23,代码来源:WebSocketRTCClient.java

示例8: sendAnswerSdp

import org.webrtc.SessionDescription; //导入依赖的package包/类
@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());
    }
  });
}
 
开发者ID:Piasy,项目名称:AppRTC-Android,代码行数:17,代码来源:WebSocketRTCClient.java

示例9: sendOfferSdp

import org.webrtc.SessionDescription; //导入依赖的package包/类
@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());
    }
  });
}
 
开发者ID:Piasy,项目名称:AppRTC-Android,代码行数:17,代码来源:DirectRTCClient.java

示例10: setRemoteDescription

import org.webrtc.SessionDescription; //导入依赖的package包/类
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);
    }
  });
}
 
开发者ID:Piasy,项目名称:AppRTC-Android,代码行数:25,代码来源:PeerConnectionClient.java

示例11: onCreateSuccess

import org.webrtc.SessionDescription; //导入依赖的package包/类
@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);
      }
    }
  });
}
 
开发者ID:Piasy,项目名称:AppRTC-Android,代码行数:26,代码来源:PeerConnectionClient.java

示例12: onRemoteDescription

import org.webrtc.SessionDescription; //导入依赖的package包/类
@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();
            }
        }
    });
}
 
开发者ID:lgyjg,项目名称:AndroidRTC,代码行数:22,代码来源:CallActivity.java

示例13: onLocalDescription

import org.webrtc.SessionDescription; //导入依赖的package包/类
@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);
            }
        }
    });
}
 
开发者ID:lgyjg,项目名称:AndroidRTC,代码行数:22,代码来源:CallActivity.java

示例14: sendOfferSdp

import org.webrtc.SessionDescription; //导入依赖的package包/类
@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);
            }
        }
    });
}
 
开发者ID:lgyjg,项目名称:AndroidRTC,代码行数:23,代码来源:WebSocketRTCClient.java

示例15: sendAnswerSdp

import org.webrtc.SessionDescription; //导入依赖的package包/类
@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());
        }
    });
}
 
开发者ID:lgyjg,项目名称:AndroidRTC,代码行数:17,代码来源:WebSocketRTCClient.java


注:本文中的org.webrtc.SessionDescription类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。