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

Side by Side 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, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/pc/peerconnectioninterface_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 1769 matching lines...) Expand 10 before | Expand all | Expand 10 after
1780 if (rtc_options.offer_to_receive_audio != RTCOfferAnswerOptions::kUndefined) { 1780 if (rtc_options.offer_to_receive_audio != RTCOfferAnswerOptions::kUndefined) {
1781 recv_audio = (rtc_options.offer_to_receive_audio > 0); 1781 recv_audio = (rtc_options.offer_to_receive_audio > 0);
1782 } 1782 }
1783 if (rtc_options.offer_to_receive_video != RTCOfferAnswerOptions::kUndefined) { 1783 if (rtc_options.offer_to_receive_video != RTCOfferAnswerOptions::kUndefined) {
1784 recv_video = (rtc_options.offer_to_receive_video > 0); 1784 recv_video = (rtc_options.offer_to_receive_video > 0);
1785 } 1785 }
1786 1786
1787 rtc::Optional<size_t> audio_index; 1787 rtc::Optional<size_t> audio_index;
1788 rtc::Optional<size_t> video_index; 1788 rtc::Optional<size_t> video_index;
1789 rtc::Optional<size_t> data_index; 1789 rtc::Optional<size_t> data_index;
1790 // There should be a pending remote description that's an offer... 1790 if (session_->remote_description()) {
1791 RTC_DCHECK(session_->remote_description()); 1791 // The pending remote description should be an offer.
1792 RTC_DCHECK(session_->remote_description()->type() == 1792 RTC_DCHECK(session_->remote_description()->type() ==
1793 SessionDescriptionInterface::kOffer); 1793 SessionDescriptionInterface::kOffer);
1794 // Generate m= sections that match those in the offer. 1794 // Generate m= sections that match those in the offer.
1795 // Note that mediasession.cc will handle intersection our preferred direction 1795 // Note that mediasession.cc will handle intersection our preferred
1796 // with the offered direction. 1796 // direction with the offered direction.
1797 GenerateMediaDescriptionOptions( 1797 GenerateMediaDescriptionOptions(
1798 session_->remote_description(), 1798 session_->remote_description(),
1799 cricket::RtpTransceiverDirection(send_audio, recv_audio), 1799 cricket::RtpTransceiverDirection(send_audio, recv_audio),
1800 cricket::RtpTransceiverDirection(send_video, recv_video), &audio_index, 1800 cricket::RtpTransceiverDirection(send_video, recv_video), &audio_index,
1801 &video_index, &data_index, session_options); 1801 &video_index, &data_index, session_options);
1802 }
1802 1803
1803 cricket::MediaDescriptionOptions* audio_media_description_options = 1804 cricket::MediaDescriptionOptions* audio_media_description_options =
1804 !audio_index ? nullptr 1805 !audio_index ? nullptr
1805 : &session_options->media_description_options[*audio_index]; 1806 : &session_options->media_description_options[*audio_index];
1806 cricket::MediaDescriptionOptions* video_media_description_options = 1807 cricket::MediaDescriptionOptions* video_media_description_options =
1807 !video_index ? nullptr 1808 !video_index ? nullptr
1808 : &session_options->media_description_options[*video_index]; 1809 : &session_options->media_description_options[*video_index];
1809 cricket::MediaDescriptionOptions* data_media_description_options = 1810 cricket::MediaDescriptionOptions* data_media_description_options =
1810 !data_index ? nullptr 1811 !data_index ? nullptr
1811 : &session_options->media_description_options[*data_index]; 1812 : &session_options->media_description_options[*data_index];
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
2523 return event_log_->StartLogging(file, max_size_bytes); 2524 return event_log_->StartLogging(file, max_size_bytes);
2524 } 2525 }
2525 2526
2526 void PeerConnection::StopRtcEventLog_w() { 2527 void PeerConnection::StopRtcEventLog_w() {
2527 if (event_log_) { 2528 if (event_log_) {
2528 event_log_->StopLogging(); 2529 event_log_->StopLogging();
2529 } 2530 }
2530 } 2531 }
2531 2532
2532 } // namespace webrtc 2533 } // namespace webrtc
OLDNEW
« 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