Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why doesn't PnPeer have to create answer and call setRemoteDescription? #7

Closed
hieppq opened this issue Sep 5, 2016 · 0 comments
Closed

Comments

@hieppq
Copy link

hieppq commented Sep 5, 2016

Hi` @GleasonK,

I'm new at webrtc

I've read your source code and dont understand this snippet code in class PnPeerConnectionClient:

private class CreateAnswerAction implements PnAction{
public static final String TRIGGER = "offer";
public void execute(String peerId, JSONObject payload) throws JSONException {
Log.d("CAAction","CreateAnswerAction");
PnPeer peer = peers.get(peerId);
peer.setType(PnPeer.TYPE_OFFER);
peer.setStatus(PnPeer.STATUS_CONNECTED);
SessionDescription sdp = new SessionDescription(
SessionDescription.Type.fromCanonicalForm(payload.getString("type")),
payload.getString("sdp")
);
peer.pc.setRemoteDescription(peer, sdp);
peer.pc.createAnswer(peer, signalingParams.pcConstraints);
}
}

private class SetRemoteSDPAction implements PnAction{
    public static final String TRIGGER = "answer";
    public void execute(String peerId, JSONObject payload) throws JSONException {
        Log.d("SRSAction","SetRemoteSDPAction");
        PnPeer peer = peers.get(peerId);
        SessionDescription sdp = new SessionDescription(
                SessionDescription.Type.fromCanonicalForm(payload.getString("type")),
                payload.getString("sdp")
        );
        peer.pc.setRemoteDescription(peer, sdp);
    }
}`

It looks useless and isnt used anywhere else. As I understand, the recipient has to create an answer and call setRemoteDescription. So could you explain it please?

Thank in advance.

@hieppq hieppq closed this as completed Sep 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant