webrtc SetLocalDescription workflow

(peer_connection.cc:1953): PeerConnection::CreateOffer
(webrtc_session_description_factory.cc:214): WebRtcSessionDescriptionFactory::CreateOffer
(jsep_transport_controller.cc:544): JsepTransportController::GetDtlsTransports
(webrtc_session_description_factory.cc:329): WebRtcSessionDescriptionFactory::InternalCreateOffer
(webrtc_session_description_factory.cc:297): WebRtcSessionDescriptionFactory::OnMessage type = 0
(conductor.cc:577): Conductor::OnSuccess create offer
(peer_connection.cc:2116): PeerConnection::SetLocalDescription Enter
(peer_connection.cc:2203): PeerConnection::ApplyLocalDescription
(peer_connection.cc:5686): PeerConnection::PushdownTransportDescription
(peer_connection.cc:5689): transport_controller_->SetLocalDescription 0.1
(peer_connection.cc:5693): transport_controller_->SetLocalDescription 0.2
(jsep_transport_controller.cc:98): JsepTransportController::SetLocalDescription type = 0
(jsep_transport_controller.cc:100): network do SetLocalDescription
(jsep_transport_controller.cc:98): JsepTransportController::SetLocalDescription type = 0
(jsep_transport_controller.cc:544): JsepTransportController::GetDtlsTransports
(jsep_transport_controller.cc:564): JsepTransportController::ApplyDescription_n
(jsep_transport_controller.cc:585): contents size = 2
(jsep_transport_controller.cc:588): content_info.name = 0
(jsep_transport_controller.cc:1022): JsepTransportController::MaybeCreateJsepTransport
(jsep_transport_controller.cc:421): JsepTransportController::CreateIceTransport
(p2p_transport_channel.cc:136): P2PTransportChannel::P2PTransportChannel
(jsep_transport_controller.cc:952): JsepTransportController::MaybeCreateMediaTransport
(jsep_transport_controller.cc:436): JsepTransportController::CreateDtlsTransport
(p2p_transport_channel.cc:496): Set backup connection ping interval to 25000 milliseconds.
(p2p_transport_channel.cc:505): Set ICE receiving timeout to 2500 milliseconds
(p2p_transport_channel.cc:511): Set ping most likely connection to 0
(p2p_transport_channel.cc:518): Set stable_writable_connection_ping_interval to 2500
(p2p_transport_channel.cc:530): Set presume writable when fully relayed to 0
(p2p_transport_channel.cc:539): Set regather_on_failed_networks_interval to 300000
(p2p_transport_channel.cc:556): Set receiving_switching_delay to 1000
(jsep_transport_controller.cc:526): JsepTransportController::CreateDtlsSrtpTransport
(dtls_srtp_transport.cc:61): Setting RTCP Transport on 0 transport 0
(dtls_srtp_transport.cc:66): Setting RTP Transport on 0 transport 6c003950
(jsep_transport_controller.cc:544): JsepTransportController::GetDtlsTransports
(jsep_transport_controller.cc:588): content_info.name = 1
(jsep_transport_controller.cc:1022): JsepTransportController::MaybeCreateJsepTransport
(jsep_transport_controller.cc:421): JsepTransportController::CreateIceTransport
(p2p_transport_channel.cc:136): P2PTransportChannel::P2PTransportChannel
(jsep_transport_controller.cc:952): JsepTransportController::MaybeCreateMediaTransport
(jsep_transport_controller.cc:436): JsepTransportController::CreateDtlsTransport
(p2p_transport_channel.cc:496): Set backup connection ping interval to 25000 milliseconds.
(p2p_transport_channel.cc:505): Set ICE receiving timeout to 2500 milliseconds
(p2p_transport_channel.cc:511): Set ping most likely connection to 0
(p2p_transport_channel.cc:518): Set stable_writable_connection_ping_interval to 2500
(p2p_transport_channel.cc:530): Set presume writable when fully relayed to 0
(p2p_transport_channel.cc:539): Set regather_on_failed_networks_interval to 300000
(p2p_transport_channel.cc:556): Set receiving_switching_delay to 1000
(jsep_transport_controller.cc:526): JsepTransportController::CreateDtlsSrtpTransport
(dtls_srtp_transport.cc:61): Setting RTCP Transport on 1 transport 0
(dtls_srtp_transport.cc:66): Setting RTP Transport on 1 transport 6c005a60
(jsep_transport_controller.cc:544): JsepTransportController::GetDtlsTransports
(jsep_transport_controller.cc:544): JsepTransportController::GetDtlsTransports
(p2p_transport_channel.cc:432): Set ICE ufrag: o/hW pwd: o9qXESytpbr1PnJ1yrBlZJWR on transport 0
(jsep_transport_controller.cc:544): JsepTransportController::GetDtlsTransports
(p2p_transport_channel.cc:432): Set ICE ufrag: o/hW pwd: o9qXESytpbr1PnJ1yrBlZJWR on transport 1
(webrtc_voice_engine.cc:1479): Setting voice channel options: AudioOptions {audio_jitter_buffer_max_packets: 200, audio_jitter_buffer_fast_accelerate: 0, audio_jitter_buffer_min_delay_ms: 0, audio_jitter_buffer_enable_rtx_handling: 0, }
(webrtc_voice_engine.cc:309): WebRtcVoiceEngine::ApplyOptions: AudioOptions {audio_jitter_buffer_max_packets: 200, audio_jitter_buffer_fast_accelerate: 0, audio_jitter_buffer_min_delay_ms: 0, audio_jitter_buffer_enable_rtx_handling: 0, }
(webrtc_voice_engine.cc:453): NetEq capacity is 200
(webrtc_voice_engine.cc:459): NetEq fast mode? 0
(webrtc_voice_engine.cc:465): NetEq minimum delay is 0
(webrtc_voice_engine.cc:471): NetEq handle reordered packets? 0
(webrtc_voice_engine.cc:482): Delay agnostic aec is enabled? 0
(webrtc_voice_engine.cc:492): Extended filter aec is enabled? 0
(webrtc_voice_engine.cc:502): Experimental ns is enabled? 0
(audio_processing_impl.cc:727): Highpass filter activated: 1
(audio_processing_impl.cc:745): Gain Controller 2 activated: 0
(audio_processing_impl.cc:747): Pre-amplifier activated: 0
(webrtc_voice_engine.cc:1497): Set voice channel options. Current options: AudioOptions {audio_jitter_buffer_max_packets: 200, audio_jitter_buffer_fast_accelerate: 0, audio_jitter_buffer_min_delay_ms: 0, audio_jitter_buffer_enable_rtx_handling: 0, }
(channel.cc:138): Created channel for 0
(channel.cc:206): BaseChannel::Init_w, media_transport=0
(call.cc:1173): UpdateAggregateNetworkState: aggregate_state=down
(rtp_transport_controller_send.cc:261): SignalNetworkState Down
(webrtc_video_engine.cc:485): CreateMediaChannel. Options: VideoOptions {}
(channel.cc:138): Created channel for 1
(channel.cc:206): BaseChannel::Init_w, media_transport=0
(call.cc:1173): UpdateAggregateNetworkState: aggregate_state=down
(rtp_transport_controller_send.cc:261): SignalNetworkState Down
(peer_connection.cc:4165): Session: 5428769043391462588 Old state: kStable New state: kHaveLocalOffer
(peer_connection.cc:5605): PeerConnection::PushdownMediaDescription type = 0
(channel.cc:289): BaseChannel::SetLocalContent
(channel.cc:865): Setting local voice description
(webrtc_voice_engine.cc:1316): WebRtcVoiceMediaChannel::SetRecvParameters: {codecs: [AudioCodec[111:opus:48000:0:2], AudioCodec[103:ISAC:16000:0:1], AudioCodec[104:ISAC:32000:0:1], AudioCodec[9:G722:8000:0:1], AudioCodec[102:ILBC:8000:0:1], AudioCodec[0:PCMU:8000:0:1], AudioCodec[8:PCMA:8000:0:1], AudioCodec[106:CN:32000:0:1], AudioCodec[105:CN:16000:0:1], AudioCodec[13:CN:8000:0:1], AudioCodec[110:telephone-event:48000:0:1], AudioCodec[112:telephone-event:32000:0:1], AudioCodec[113:telephone-event:16000:0:1], AudioCodec[126:telephone-event:8000:0:1]], extensions: [{uri: urn:ietf:params:rtp-hdrext:ssrc-audio-level, id: 1}, {uri: http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01, id: 2}, {uri: urn:ietf:params:rtp-hdrext:sdes:mid, id: 3}, {uri: urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id, id: 4}, {uri: urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id, id: 5}]}
(webrtc_voice_engine.cc:1507): Setting receive voice codecs.
(webrtc_voice_engine.cc:1781): AddSendStream: {id:audio_label;ssrcs:[2938871741];ssrc_groups:;cname:g4h/Enkhg9GsbeOJ;stream_ids:stream_id;}
(call.cc:709): Call::CreateAudioSendStream
(neteq_impl.cc:123): NetEq config: sample_rate_hz=16000, enable_post_decode_vad=true, max_packets_in_buffer=200, min_delay_ms=0, enable_fast_accelerate=false, enable_muted_state=false, enable_rtx_handling=false
(audio_coding_module.cc:333): Created
(channel_send.cc:708): Not setting media_transport_ rate observers.
(audio_send_stream.cc:142): AudioSendStream: 2938871741
(audio_send_stream.cc:230): AudioSendStream::ConfigureStream: {rtp: {ssrc: 2938871741, extmap-allow-mixed: false, extensions: [], c_name: g4h/Enkhg9GsbeOJ}, rtcp_report_interval_ms: 5000, send_transport: (Transport), media_transport: null, min_bitrate_bps: -1, max_bitrate_bps: -1, send_codec_spec: }
(call.cc:1173): UpdateAggregateNetworkState: aggregate_state=down
(rtp_transport_controller_send.cc:261): SignalNetworkState Down
(channel.cc:673): Add send stream ssrc: 2938871741
(channel.cc:857): Changing voice state, recv=0 send=0
(channel.cc:289): BaseChannel::SetLocalContent
(channel.cc:1001): Setting local video description
(webrtc_video_engine.cc:958): SetRecvParameters: {codecs: [VideoCodec[96:VP8], VideoCodec[97:rtx], VideoCodec[98:VP9], VideoCodec[99:rtx], VideoCodec[100:VP9], VideoCodec[101:rtx], VideoCodec[127:red], VideoCodec[124:rtx], VideoCodec[125:ulpfec]], extensions: [{uri: urn:ietf:params:rtp-hdrext:toffset, id: 14}, {uri: http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time, id: 13}, {uri: urn:3gpp:video-orientation, id: 12}, {uri: http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01, id: 2}, {uri: http://www.webrtc.org/experiments/rtp-hdrext/playout-delay, id: 11}, {uri: http://www.webrtc.org/experiments/rtp-hdrext/video-content-type, id: 6}, {uri: http://www.webrtc.org/experiments/rtp-hdrext/video-timing, id: 7}, {uri: http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07, id: 8}, {uri: http://www.webrtc.org/experiments/rtp-hdrext/color-space, id: 9}, {uri: urn:ietf:params:rtp-hdrext:sdes:mid, id: 3}, {uri: urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id, id: 4}, {uri: urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id, id: 5}]}
(webrtc_video_engine.cc:973): Changing recv codecs from {VideoCodec[96:VP8], VideoCodec[98:VP9], VideoCodec[100:VP9]} to {VideoCodec[96:VP8], VideoCodec[98:VP9], VideoCodec[100:VP9]}
(webrtc_video_engine.cc:1074): AddSendStream: {id:video_label;ssrcs:[1630087365,1040575663];ssrc_groups:{semantics:FID;ssrcs:[1630087365,1040575663]};cname:g4h/Enkhg9GsbeOJ;stream_ids:stream_id;}
(webrtc_video_engine.cc:1113): SetLocalSsrc on all the receive streams because we added a send stream.
(channel.cc:673): Add send stream ssrc: 1630087365
(channel.cc:988): Changing video state, send=0
(peer_connection.cc:5672): PeerConnection::PushdownMediaDescription Exit
(peer_connection.cc:5510): Local and Remote descriptions must be applied to get the SSL Role of the SCTP transport.
(webrtc_voice_engine.cc:1479): Setting voice channel options: AudioOptions {}
(webrtc_voice_engine.cc:309): WebRtcVoiceEngine::ApplyOptions: AudioOptions {audio_jitter_buffer_max_packets: 200, audio_jitter_buffer_fast_accelerate: 0, audio_jitter_buffer_min_delay_ms: 0, audio_jitter_buffer_enable_rtx_handling: 0, }
(webrtc_voice_engine.cc:453): NetEq capacity is 200
(webrtc_voice_engine.cc:459): NetEq fast mode? 0
(webrtc_voice_engine.cc:465): NetEq minimum delay is 0
(webrtc_voice_engine.cc:471): NetEq handle reordered packets? 0
(webrtc_voice_engine.cc:482): Delay agnostic aec is enabled? 0
(webrtc_voice_engine.cc:492): Extended filter aec is enabled? 0
(webrtc_voice_engine.cc:502): Experimental ns is enabled? 0
(audio_processing_impl.cc:727): Highpass filter activated: 1
(audio_processing_impl.cc:745): Gain Controller 2 activated: 0
(audio_processing_impl.cc:747): Pre-amplifier activated: 0
(webrtc_voice_engine.cc:1497): Set voice channel options. Current options: AudioOptions {audio_jitter_buffer_max_packets: 200, audio_jitter_buffer_fast_accelerate: 0, audio_jitter_buffer_min_delay_ms: 0, audio_jitter_buffer_enable_rtx_handling: 0, }
(webrtc_video_engine.cc:1033): SetVideoSend (ssrc= 1630087365, options: VideoOptions {is_screencast : false, }, source = (source))
(jsep_transport_controller.cc:285): JsepTransportController::MaybeStartGathering
(jsep_transport_controller.cc:285): JsepTransportController::MaybeStartGathering
(jsep_transport_controller.cc:544): JsepTransportController::GetDtlsTransports
(p2p_transport_channel.cc:722): P2PTransportChannel::MaybeStartGathering
(jsep_transport_controller.cc:544): JsepTransportController::GetDtlsTransports
(basic_port_allocator.cc:229): BasicPortAllocator::CreateSessionInternal
(port_allocator.cc:58): PortAllocatorSession::PortAllocatorSession
(basic_port_allocator.cc:266): BasicPortAllocatorSession::BasicPortAllocatorSession
(p2p_transport_channel.cc:162): P2PTransportChannel::AddAllocatorSession
(basic_port_allocator.cc:334): Start getting ports with prune_turn_ports disabled
(p2p_transport_channel.cc:722): P2PTransportChannel::MaybeStartGathering
(jsep_transport_controller.cc:544): JsepTransportController::GetDtlsTransports
(basic_port_allocator.cc:229): BasicPortAllocator::CreateSessionInternal
(port_allocator.cc:58): PortAllocatorSession::PortAllocatorSession
(basic_port_allocator.cc:266): BasicPortAllocatorSession::BasicPortAllocatorSession
(p2p_transport_channel.cc:162): P2PTransportChannel::AddAllocatorSession
(basic_port_allocator.cc:334): Start getting ports with prune_turn_ports disabled
(peer_connection.cc:2198): PeerConnection::SetLocalDescription Exit

 

几个重要的点:

1。MaybeStartGathering

(jsep_transport_controller.cc:285): JsepTransportController::MaybeStartGathering
(p2p_transport_channel.cc:722): P2PTransportChannel::MaybeStartGathering
(port_allocator.cc:58): PortAllocatorSession::PortAllocatorSession
(basic_port_allocator.cc:266): BasicPortAllocatorSession::BasicPortAllocatorSession
(p2p_transport_channel.cc:162): P2PTransportChannel::AddAllocatorSession

void BasicPortAllocatorSession::StartGettingPorts() {
	RTC_DCHECK_RUN_ON(network_thread_);
	state_ = SessionState::GATHERING;
	if (!socket_factory_) {
		owned_socket_factory_.reset(
				new rtc::BasicPacketSocketFactory(network_thread_));
		socket_factory_ = owned_socket_factory_.get();
	}

	network_thread_->Post(RTC_FROM_HERE, this, MSG_CONFIG_START);

	RTC_LOG(LS_INFO) << "Start getting ports with prune_turn_ports "
			<< (prune_turn_ports_ ? "enabled" : "disabled");
}
void BasicPortAllocatorSession::GetPortConfigurations() {
	RTC_DCHECK_RUN_ON(network_thread_);
	PortConfiguration *config = new PortConfiguration(
			allocator_->stun_servers(), username(), password());

	for (const RelayServerConfig &turn_server : allocator_->turn_servers()) {
		config->AddRelay(turn_server);
	}
	ConfigReady(config);
}
void P2PTransportChannel::MaybeStartGathering() {
	RTC_LOG(INFO) << "P2PTransportChannel::MaybeStartGathering";
	if (ice_parameters_.ufrag.empty() || ice_parameters_.pwd.empty()) {
		RTC_LOG(LS_ERROR)
				<< "Cannot gather candidates because ICE parameters are empty"
						" ufrag: " << ice_parameters_.ufrag << " pwd: "
				<< ice_parameters_.pwd;
		return;
	}
	// Start gathering if we never started before, or if an ICE restart occurred.
	if (allocator_sessions_.empty()
			|| IceCredentialsChanged(allocator_sessions_.back()->ice_ufrag(),
					allocator_sessions_.back()->ice_pwd(),
					ice_parameters_.ufrag, ice_parameters_.pwd)) {
		if (gathering_state_ != kIceGatheringGathering) {
			gathering_state_ = kIceGatheringGathering;
			SignalGatheringState(this);
		}

		if (!allocator_sessions_.empty()) {
			IceRestartState state;
			if (writable()) {
				state = IceRestartState::CONNECTED;
			} else if (IsGettingPorts()) {
				state = IceRestartState::CONNECTING;
			} else {
				state = IceRestartState::DISCONNECTED;
			}
			RTC_HISTOGRAM_ENUMERATION("WebRTC.PeerConnection.IceRestartState",
					static_cast(state),
					static_cast(IceRestartState::MAX_VALUE));
		}

		// Time for a new allocator.
		std::unique_ptr pooled_session =
				allocator_->TakePooledSession(transport_name(), component(),
						ice_parameters_.ufrag, ice_parameters_.pwd);
		if (pooled_session) {
			AddAllocatorSession(std::move(pooled_session));
			PortAllocatorSession *raw_pooled_session =
					allocator_sessions_.back().get();
			// Process the pooled session's existing candidates/ports, if they exist.
			OnCandidatesReady(raw_pooled_session,
					raw_pooled_session->ReadyCandidates());
			for (PortInterface *port : allocator_sessions_.back()->ReadyPorts()) {
				OnPortReady(raw_pooled_session, port);
			}
			if (allocator_sessions_.back()->CandidatesAllocationDone()) {
				OnCandidatesAllocationDone(raw_pooled_session);
			}
		} else {
			AddAllocatorSession(allocator_->CreateSession(transport_name(), component(),
							ice_parameters_.ufrag, ice_parameters_.pwd));

			//启动Port资源申请消息,发送MSG_CONFIG_START消息处理流程。状态机
			//new AllocationSequence in DoAllocate()
			//开始收集本端的candidates信息。
			allocator_sessions_.back()->StartGettingPorts();
		}
	}
}

 

你可能感兴趣的:(webrtc)