void RtcStream::SetRemoteDescription(const std::string& msg) {
    // convert to local json object
    Json::Reader reader;
    Json::Value jmessage;
    std::string decodedMsg = talk_base::Base64::Decode(msg, talk_base::Base64::DO_STRICT);
    if (!reader.parse(decodedMsg, jmessage)) {
        LOG(WARNING) << " Parse the JSON failed";
        return;
    }
    // convert to local sesion description object
    std::string type;
    std::string sdp;
    GetStringFromJsonObject(jmessage, kSessionDescriptionTypeName, &type);
    GetStringFromJsonObject(jmessage, kSessionDescriptionSdpName, &sdp);
    if ( sdp.empty() || type.empty() ) {
        LOG(WARNING) << " Convert to SDP failed";
        return;
    }

    webrtc::SessionDescriptionInterface* session_description(
        webrtc::CreateSessionDescription(type, sdp));
    if (!session_description) {
        LOG(WARNING) << "Can't parse received session description message.";
        return;
    }

    connection_->SetRemoteDescription(
        RtcStreamSetSessionDescriptionObserver::Create(), session_description);
}
void PeerConnectionManager::setAnswer(const std::string &peerid, const std::string& message)
{
	LOG(INFO) << message;	
	
	Json::Reader reader;
	Json::Value  jmessage;
	if (!reader.parse(message, jmessage)) {
		LOG(WARNING) << "Received unknown message. " << message;
		return;
	}
	std::string type;
	std::string sdp;
	if (  !rtc::GetStringFromJsonObject(jmessage, kSessionDescriptionTypeName, &type)
	   || !rtc::GetStringFromJsonObject(jmessage, kSessionDescriptionSdpName, &sdp)) {
		LOG(WARNING) << "Can't parse received message.";
		return;
	}
	webrtc::SessionDescriptionInterface* session_description(webrtc::CreateSessionDescription(type, sdp, NULL));
	if (!session_description) {
		LOG(WARNING) << "Can't parse received session description message.";
		return;
	}
	LOG(LERROR) << "From peerid:" << peerid << " received session description :" << session_description->type();
	std::map<std::string, rtc::scoped_refptr<webrtc::PeerConnectionInterface> >::iterator  it = peer_connection_map_.find(peerid);
	if (it != peer_connection_map_.end())
	{
		rtc::scoped_refptr<webrtc::PeerConnectionInterface> pc = it->second;
		pc->SetRemoteDescription(SetSessionDescriptionObserver::Create(pc, session_description->type()), session_description);
	}
}