Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(463)

Unified Diff: webrtc/pc/peerconnection.cc

Issue 3006723002: Fix the Chromium crash when creating an answer without a remote description. (Closed)
Patch Set: Add a unit test. Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/pc/peerconnectioninterface_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/pc/peerconnection.cc
diff --git a/webrtc/pc/peerconnection.cc b/webrtc/pc/peerconnection.cc
index 6112357ce1dd586adad63634300bd08a810dde52..e22a09ece06998d12cd2db9dba82c4f0231b368c 100644
--- a/webrtc/pc/peerconnection.cc
+++ b/webrtc/pc/peerconnection.cc
@@ -1787,18 +1787,19 @@ void PeerConnection::GetOptionsForAnswer(
rtc::Optional<size_t> audio_index;
rtc::Optional<size_t> video_index;
rtc::Optional<size_t> data_index;
- // There should be a pending remote description that's an offer...
- RTC_DCHECK(session_->remote_description());
- RTC_DCHECK(session_->remote_description()->type() ==
- SessionDescriptionInterface::kOffer);
- // Generate m= sections that match those in the offer.
- // Note that mediasession.cc will handle intersection our preferred direction
- // with the offered direction.
- GenerateMediaDescriptionOptions(
- session_->remote_description(),
- cricket::RtpTransceiverDirection(send_audio, recv_audio),
- cricket::RtpTransceiverDirection(send_video, recv_video), &audio_index,
- &video_index, &data_index, session_options);
+ if (session_->remote_description()) {
+ // The pending remote description should be an offer.
+ RTC_DCHECK(session_->remote_description()->type() ==
+ SessionDescriptionInterface::kOffer);
+ // Generate m= sections that match those in the offer.
+ // Note that mediasession.cc will handle intersection our preferred
+ // direction with the offered direction.
+ GenerateMediaDescriptionOptions(
+ session_->remote_description(),
+ cricket::RtpTransceiverDirection(send_audio, recv_audio),
+ cricket::RtpTransceiverDirection(send_video, recv_video), &audio_index,
+ &video_index, &data_index, session_options);
+ }
cricket::MediaDescriptionOptions* audio_media_description_options =
!audio_index ? nullptr
« no previous file with comments | « no previous file | webrtc/pc/peerconnectioninterface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698