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

Side by Side Diff: talk/app/webrtc/peerconnection.cc

Issue 1406803004: Fixing some issues with the direction attribute of m-lines in offers. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing comment. Created 5 years, 2 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
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 } 439 }
440 return nullptr; 440 return nullptr;
441 } 441 }
442 442
443 rtc::Thread* signaling_thread_; 443 rtc::Thread* signaling_thread_;
444 cricket::ChannelManager* channel_manager_; 444 cricket::ChannelManager* channel_manager_;
445 }; 445 };
446 446
447 bool ConvertRtcOptionsForOffer( 447 bool ConvertRtcOptionsForOffer(
448 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, 448 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options,
449 cricket::MediaSessionOptions* session_options) { 449 cricket::MediaSessionOptions* session_options,
450 bool currently_receiving_audio,
451 bool currently_receiving_video) {
450 typedef PeerConnectionInterface::RTCOfferAnswerOptions RTCOfferAnswerOptions; 452 typedef PeerConnectionInterface::RTCOfferAnswerOptions RTCOfferAnswerOptions;
451 if (!IsValidOfferToReceiveMedia(rtc_options.offer_to_receive_audio) || 453 if (!IsValidOfferToReceiveMedia(rtc_options.offer_to_receive_audio) ||
452 !IsValidOfferToReceiveMedia(rtc_options.offer_to_receive_video)) { 454 !IsValidOfferToReceiveMedia(rtc_options.offer_to_receive_video)) {
453 return false; 455 return false;
454 } 456 }
455 457
456 // According to the spec, offer to receive audio/video if the constraint is 458 // Offer to receive audio/video if the constraint is not set and there are
457 // not set and there are send streams. 459 // send streams, or we're currently receiving.
458 if (rtc_options.offer_to_receive_audio == RTCOfferAnswerOptions::kUndefined) { 460 if (rtc_options.offer_to_receive_audio == RTCOfferAnswerOptions::kUndefined) {
459 session_options->recv_audio = 461 session_options->recv_audio =
460 session_options->HasSendMediaStream(cricket::MEDIA_TYPE_AUDIO); 462 session_options->HasSendMediaStream(cricket::MEDIA_TYPE_AUDIO) ||
463 currently_receiving_audio;
461 } else { 464 } else {
462 session_options->recv_audio = (rtc_options.offer_to_receive_audio > 0); 465 session_options->recv_audio = (rtc_options.offer_to_receive_audio > 0);
463 } 466 }
464 if (rtc_options.offer_to_receive_video == RTCOfferAnswerOptions::kUndefined) { 467 if (rtc_options.offer_to_receive_video == RTCOfferAnswerOptions::kUndefined) {
465 session_options->recv_video = 468 session_options->recv_video =
466 session_options->HasSendMediaStream(cricket::MEDIA_TYPE_VIDEO); 469 session_options->HasSendMediaStream(cricket::MEDIA_TYPE_VIDEO) ||
470 currently_receiving_video;
467 } else { 471 } else {
468 session_options->recv_video = (rtc_options.offer_to_receive_video > 0); 472 session_options->recv_video = (rtc_options.offer_to_receive_video > 0);
469 } 473 }
470 474
471 session_options->vad_enabled = rtc_options.voice_activity_detection; 475 session_options->vad_enabled = rtc_options.voice_activity_detection;
472 session_options->transport_options.ice_restart = rtc_options.ice_restart; 476 session_options->transport_options.ice_restart = rtc_options.ice_restart;
473 session_options->bundle_enabled = 477 session_options->bundle_enabled =
474 rtc_options.use_rtp_mux && 478 rtc_options.use_rtp_mux &&
475 (session_options->has_audio() || session_options->has_video() || 479 (session_options->has_audio() || session_options->has_video() ||
476 session_options->has_data()); 480 session_options->has_data());
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 // Find all audio rtp streams and create corresponding remote AudioTracks 1029 // Find all audio rtp streams and create corresponding remote AudioTracks
1026 // and MediaStreams. 1030 // and MediaStreams.
1027 const cricket::ContentInfo* audio_content = GetFirstAudioContent(remote_desc); 1031 const cricket::ContentInfo* audio_content = GetFirstAudioContent(remote_desc);
1028 if (audio_content) { 1032 if (audio_content) {
1029 const cricket::AudioContentDescription* desc = 1033 const cricket::AudioContentDescription* desc =
1030 static_cast<const cricket::AudioContentDescription*>( 1034 static_cast<const cricket::AudioContentDescription*>(
1031 audio_content->description); 1035 audio_content->description);
1032 UpdateRemoteStreamsList(desc->streams(), desc->type(), new_streams); 1036 UpdateRemoteStreamsList(desc->streams(), desc->type(), new_streams);
1033 remote_info_.default_audio_track_needed = 1037 remote_info_.default_audio_track_needed =
1034 MediaContentDirectionHasSend(desc->direction()) && 1038 MediaContentDirectionHasSend(desc->direction()) &&
1035 desc->streams().empty(); 1039 desc->streams().empty() && !remote_desc->msid_supported();
1036 } 1040 }
1037 1041
1038 // Find all video rtp streams and create corresponding remote VideoTracks 1042 // Find all video rtp streams and create corresponding remote VideoTracks
1039 // and MediaStreams. 1043 // and MediaStreams.
1040 const cricket::ContentInfo* video_content = GetFirstVideoContent(remote_desc); 1044 const cricket::ContentInfo* video_content = GetFirstVideoContent(remote_desc);
1041 if (video_content) { 1045 if (video_content) {
1042 const cricket::VideoContentDescription* desc = 1046 const cricket::VideoContentDescription* desc =
1043 static_cast<const cricket::VideoContentDescription*>( 1047 static_cast<const cricket::VideoContentDescription*>(
1044 video_content->description); 1048 video_content->description);
1045 UpdateRemoteStreamsList(desc->streams(), desc->type(), new_streams); 1049 UpdateRemoteStreamsList(desc->streams(), desc->type(), new_streams);
1046 remote_info_.default_video_track_needed = 1050 remote_info_.default_video_track_needed =
1047 MediaContentDirectionHasSend(desc->direction()) && 1051 MediaContentDirectionHasSend(desc->direction()) &&
1048 desc->streams().empty(); 1052 desc->streams().empty() && !remote_desc->msid_supported();
pthatcher1 2015/10/15 06:02:03 Can you put this one first? It seems like the mos
Taylor Brandstetter 2015/10/15 18:23:36 Done.
1049 } 1053 }
1050 1054
1051 // Update the DataChannels with the information from the remote peer. 1055 // Update the DataChannels with the information from the remote peer.
1052 const cricket::ContentInfo* data_content = GetFirstDataContent(remote_desc); 1056 const cricket::ContentInfo* data_content = GetFirstDataContent(remote_desc);
1053 if (data_content) { 1057 if (data_content) {
1054 const cricket::DataContentDescription* data_desc = 1058 const cricket::DataContentDescription* data_desc =
1055 static_cast<const cricket::DataContentDescription*>( 1059 static_cast<const cricket::DataContentDescription*>(
1056 data_content->description); 1060 data_content->description);
1057 if (rtc::starts_with(data_desc->protocol().data(), 1061 if (rtc::starts_with(data_desc->protocol().data(),
1058 cricket::kMediaProtocolRtpPrefix)) { 1062 cricket::kMediaProtocolRtpPrefix)) {
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 CreateSessionDescriptionMsg* msg = new CreateSessionDescriptionMsg(observer); 1384 CreateSessionDescriptionMsg* msg = new CreateSessionDescriptionMsg(observer);
1381 msg->error = error; 1385 msg->error = error;
1382 signaling_thread()->Post(this, MSG_CREATE_SESSIONDESCRIPTION_FAILED, msg); 1386 signaling_thread()->Post(this, MSG_CREATE_SESSIONDESCRIPTION_FAILED, msg);
1383 } 1387 }
1384 1388
1385 bool PeerConnection::GetOptionsForOffer( 1389 bool PeerConnection::GetOptionsForOffer(
1386 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, 1390 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options,
1387 cricket::MediaSessionOptions* session_options) { 1391 cricket::MediaSessionOptions* session_options) {
1388 SetStreams(session_options, local_streams_, rtp_data_channels_); 1392 SetStreams(session_options, local_streams_, rtp_data_channels_);
1389 1393
1390 if (!ConvertRtcOptionsForOffer(rtc_options, session_options)) { 1394 if (!ConvertRtcOptionsForOffer(rtc_options, session_options,
1395 !remote_audio_tracks_.empty(),
1396 !remote_video_tracks_.empty())) {
1391 return false; 1397 return false;
1392 } 1398 }
1393 1399
1394 if (session_->data_channel_type() == cricket::DCT_SCTP && HasDataChannels()) { 1400 if (session_->data_channel_type() == cricket::DCT_SCTP && HasDataChannels()) {
1395 session_options->data_channel_type = cricket::DCT_SCTP; 1401 session_options->data_channel_type = cricket::DCT_SCTP;
1396 } 1402 }
1397 return true; 1403 return true;
1398 } 1404 }
1399 1405
1400 bool PeerConnection::GetOptionsForAnswer( 1406 bool PeerConnection::GetOptionsForAnswer(
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
1950 DataChannel* PeerConnection::FindDataChannelBySid(int sid) const { 1956 DataChannel* PeerConnection::FindDataChannelBySid(int sid) const {
1951 for (const auto& channel : sctp_data_channels_) { 1957 for (const auto& channel : sctp_data_channels_) {
1952 if (channel->id() == sid) { 1958 if (channel->id() == sid) {
1953 return channel; 1959 return channel;
1954 } 1960 }
1955 } 1961 }
1956 return nullptr; 1962 return nullptr;
1957 } 1963 }
1958 1964
1959 } // namespace webrtc 1965 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698