| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 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 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1088 } | 1088 } |
| 1089 if (send) { | 1089 if (send) { |
| 1090 StartAllSendStreams(); | 1090 StartAllSendStreams(); |
| 1091 } else { | 1091 } else { |
| 1092 StopAllSendStreams(); | 1092 StopAllSendStreams(); |
| 1093 } | 1093 } |
| 1094 sending_ = send; | 1094 sending_ = send; |
| 1095 return true; | 1095 return true; |
| 1096 } | 1096 } |
| 1097 | 1097 |
| 1098 bool WebRtcVideoChannel2::SetVideoSend(uint32 ssrc, bool mute, |
| 1099 const VideoOptions* options) { |
| 1100 LOG(LS_VERBOSE) << "SetVideoSend: " << ssrc << " -> " |
| 1101 << (mute ? "mute" : "unmute"); |
| 1102 DCHECK(ssrc != 0); |
| 1103 rtc::CritScope stream_lock(&stream_crit_); |
| 1104 if (send_streams_.find(ssrc) == send_streams_.end()) { |
| 1105 LOG(LS_ERROR) << "No sending stream on ssrc " << ssrc; |
| 1106 return false; |
| 1107 } |
| 1108 |
| 1109 send_streams_[ssrc]->MuteStream(mute); |
| 1110 |
| 1111 if (!mute && options) { |
| 1112 return SetOptions(*options); |
| 1113 } else { |
| 1114 return true; |
| 1115 } |
| 1116 } |
| 1117 |
| 1098 bool WebRtcVideoChannel2::ValidateSendSsrcAvailability( | 1118 bool WebRtcVideoChannel2::ValidateSendSsrcAvailability( |
| 1099 const StreamParams& sp) const { | 1119 const StreamParams& sp) const { |
| 1100 for (uint32_t ssrc: sp.ssrcs) { | 1120 for (uint32_t ssrc: sp.ssrcs) { |
| 1101 if (send_ssrcs_.find(ssrc) != send_ssrcs_.end()) { | 1121 if (send_ssrcs_.find(ssrc) != send_ssrcs_.end()) { |
| 1102 LOG(LS_ERROR) << "Send stream with SSRC '" << ssrc << "' already exists."; | 1122 LOG(LS_ERROR) << "Send stream with SSRC '" << ssrc << "' already exists."; |
| 1103 return false; | 1123 return false; |
| 1104 } | 1124 } |
| 1105 } | 1125 } |
| 1106 return true; | 1126 return true; |
| 1107 } | 1127 } |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1507 webrtc::PacketReceiver::DELIVERY_OK) { | 1527 webrtc::PacketReceiver::DELIVERY_OK) { |
| 1508 LOG(LS_WARNING) << "Failed to deliver RTCP packet."; | 1528 LOG(LS_WARNING) << "Failed to deliver RTCP packet."; |
| 1509 } | 1529 } |
| 1510 } | 1530 } |
| 1511 | 1531 |
| 1512 void WebRtcVideoChannel2::OnReadyToSend(bool ready) { | 1532 void WebRtcVideoChannel2::OnReadyToSend(bool ready) { |
| 1513 LOG(LS_VERBOSE) << "OnReadyToSend: " << (ready ? "Ready." : "Not ready."); | 1533 LOG(LS_VERBOSE) << "OnReadyToSend: " << (ready ? "Ready." : "Not ready."); |
| 1514 call_->SignalNetworkState(ready ? webrtc::kNetworkUp : webrtc::kNetworkDown); | 1534 call_->SignalNetworkState(ready ? webrtc::kNetworkUp : webrtc::kNetworkDown); |
| 1515 } | 1535 } |
| 1516 | 1536 |
| 1517 bool WebRtcVideoChannel2::MuteStream(uint32 ssrc, bool mute) { | |
| 1518 LOG(LS_VERBOSE) << "MuteStream: " << ssrc << " -> " | |
| 1519 << (mute ? "mute" : "unmute"); | |
| 1520 DCHECK(ssrc != 0); | |
| 1521 rtc::CritScope stream_lock(&stream_crit_); | |
| 1522 if (send_streams_.find(ssrc) == send_streams_.end()) { | |
| 1523 LOG(LS_ERROR) << "No sending stream on ssrc " << ssrc; | |
| 1524 return false; | |
| 1525 } | |
| 1526 | |
| 1527 send_streams_[ssrc]->MuteStream(mute); | |
| 1528 return true; | |
| 1529 } | |
| 1530 | |
| 1531 bool WebRtcVideoChannel2::SetRecvRtpHeaderExtensions( | 1537 bool WebRtcVideoChannel2::SetRecvRtpHeaderExtensions( |
| 1532 const std::vector<RtpHeaderExtension>& extensions) { | 1538 const std::vector<RtpHeaderExtension>& extensions) { |
| 1533 TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetRecvRtpHeaderExtensions"); | 1539 TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetRecvRtpHeaderExtensions"); |
| 1534 LOG(LS_INFO) << "SetRecvRtpHeaderExtensions: " | 1540 LOG(LS_INFO) << "SetRecvRtpHeaderExtensions: " |
| 1535 << RtpExtensionsToString(extensions); | 1541 << RtpExtensionsToString(extensions); |
| 1536 if (!ValidateRtpHeaderExtensionIds(extensions)) | 1542 if (!ValidateRtpHeaderExtensionIds(extensions)) |
| 1537 return false; | 1543 return false; |
| 1538 | 1544 |
| 1539 std::vector<webrtc::RtpExtension> filtered_extensions = | 1545 std::vector<webrtc::RtpExtension> filtered_extensions = |
| 1540 FilterRtpExtensions(extensions); | 1546 FilterRtpExtensions(extensions); |
| (...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2763 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2769 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
| 2764 } | 2770 } |
| 2765 } | 2771 } |
| 2766 | 2772 |
| 2767 return video_codecs; | 2773 return video_codecs; |
| 2768 } | 2774 } |
| 2769 | 2775 |
| 2770 } // namespace cricket | 2776 } // namespace cricket |
| 2771 | 2777 |
| 2772 #endif // HAVE_WEBRTC_VIDEO | 2778 #endif // HAVE_WEBRTC_VIDEO |
| OLD | NEW |