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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 } | 207 } |
208 return true; | 208 return true; |
209 } | 209 } |
210 | 210 |
211 static bool ValidateStreamParams(const StreamParams& sp) { | 211 static bool ValidateStreamParams(const StreamParams& sp) { |
212 if (sp.ssrcs.empty()) { | 212 if (sp.ssrcs.empty()) { |
213 LOG(LS_ERROR) << "No SSRCs in stream parameters: " << sp.ToString(); | 213 LOG(LS_ERROR) << "No SSRCs in stream parameters: " << sp.ToString(); |
214 return false; | 214 return false; |
215 } | 215 } |
216 | 216 |
217 std::vector<uint32> primary_ssrcs; | 217 std::vector<uint32_t> primary_ssrcs; |
218 sp.GetPrimarySsrcs(&primary_ssrcs); | 218 sp.GetPrimarySsrcs(&primary_ssrcs); |
219 std::vector<uint32> rtx_ssrcs; | 219 std::vector<uint32_t> rtx_ssrcs; |
220 sp.GetFidSsrcs(primary_ssrcs, &rtx_ssrcs); | 220 sp.GetFidSsrcs(primary_ssrcs, &rtx_ssrcs); |
221 for (uint32_t rtx_ssrc : rtx_ssrcs) { | 221 for (uint32_t rtx_ssrc : rtx_ssrcs) { |
222 bool rtx_ssrc_present = false; | 222 bool rtx_ssrc_present = false; |
223 for (uint32_t sp_ssrc : sp.ssrcs) { | 223 for (uint32_t sp_ssrc : sp.ssrcs) { |
224 if (sp_ssrc == rtx_ssrc) { | 224 if (sp_ssrc == rtx_ssrc) { |
225 rtx_ssrc_present = true; | 225 rtx_ssrc_present = true; |
226 break; | 226 break; |
227 } | 227 } |
228 } | 228 } |
229 if (!rtx_ssrc_present) { | 229 if (!rtx_ssrc_present) { |
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 << "Ignoring call to SetRecvCodecs because codecs haven't changed."; | 909 << "Ignoring call to SetRecvCodecs because codecs haven't changed."; |
910 return true; | 910 return true; |
911 } | 911 } |
912 | 912 |
913 LOG(LS_INFO) << "Changing recv codecs from " | 913 LOG(LS_INFO) << "Changing recv codecs from " |
914 << CodecSettingsVectorToString(recv_codecs_) << " to " | 914 << CodecSettingsVectorToString(recv_codecs_) << " to " |
915 << CodecSettingsVectorToString(supported_codecs); | 915 << CodecSettingsVectorToString(supported_codecs); |
916 recv_codecs_ = supported_codecs; | 916 recv_codecs_ = supported_codecs; |
917 | 917 |
918 rtc::CritScope stream_lock(&stream_crit_); | 918 rtc::CritScope stream_lock(&stream_crit_); |
919 for (std::map<uint32, WebRtcVideoReceiveStream*>::iterator it = | 919 for (std::map<uint32_t, WebRtcVideoReceiveStream*>::iterator it = |
920 receive_streams_.begin(); | 920 receive_streams_.begin(); |
921 it != receive_streams_.end(); | 921 it != receive_streams_.end(); ++it) { |
922 ++it) { | |
923 it->second->SetRecvCodecs(recv_codecs_); | 922 it->second->SetRecvCodecs(recv_codecs_); |
924 } | 923 } |
925 | 924 |
926 return true; | 925 return true; |
927 } | 926 } |
928 | 927 |
929 bool WebRtcVideoChannel2::SetSendCodecs(const std::vector<VideoCodec>& codecs) { | 928 bool WebRtcVideoChannel2::SetSendCodecs(const std::vector<VideoCodec>& codecs) { |
930 TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetSendCodecs"); | 929 TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetSendCodecs"); |
931 LOG(LS_INFO) << "SetSendCodecs: " << CodecVectorToString(codecs); | 930 LOG(LS_INFO) << "SetSendCodecs: " << CodecVectorToString(codecs); |
932 if (!ValidateCodecFormats(codecs)) { | 931 if (!ValidateCodecFormats(codecs)) { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
999 bool WebRtcVideoChannel2::GetSendCodec(VideoCodec* codec) { | 998 bool WebRtcVideoChannel2::GetSendCodec(VideoCodec* codec) { |
1000 VideoCodecSettings codec_settings; | 999 VideoCodecSettings codec_settings; |
1001 if (!send_codec_.Get(&codec_settings)) { | 1000 if (!send_codec_.Get(&codec_settings)) { |
1002 LOG(LS_VERBOSE) << "GetSendCodec: No send codec set."; | 1001 LOG(LS_VERBOSE) << "GetSendCodec: No send codec set."; |
1003 return false; | 1002 return false; |
1004 } | 1003 } |
1005 *codec = codec_settings.codec; | 1004 *codec = codec_settings.codec; |
1006 return true; | 1005 return true; |
1007 } | 1006 } |
1008 | 1007 |
1009 bool WebRtcVideoChannel2::SetSendStreamFormat(uint32 ssrc, | 1008 bool WebRtcVideoChannel2::SetSendStreamFormat(uint32_t ssrc, |
1010 const VideoFormat& format) { | 1009 const VideoFormat& format) { |
1011 LOG(LS_VERBOSE) << "SetSendStreamFormat:" << ssrc << " -> " | 1010 LOG(LS_VERBOSE) << "SetSendStreamFormat:" << ssrc << " -> " |
1012 << format.ToString(); | 1011 << format.ToString(); |
1013 rtc::CritScope stream_lock(&stream_crit_); | 1012 rtc::CritScope stream_lock(&stream_crit_); |
1014 if (send_streams_.find(ssrc) == send_streams_.end()) { | 1013 if (send_streams_.find(ssrc) == send_streams_.end()) { |
1015 return false; | 1014 return false; |
1016 } | 1015 } |
1017 return send_streams_[ssrc]->SetVideoFormat(format); | 1016 return send_streams_[ssrc]->SetVideoFormat(format); |
1018 } | 1017 } |
1019 | 1018 |
1020 bool WebRtcVideoChannel2::SetSend(bool send) { | 1019 bool WebRtcVideoChannel2::SetSend(bool send) { |
1021 LOG(LS_VERBOSE) << "SetSend: " << (send ? "true" : "false"); | 1020 LOG(LS_VERBOSE) << "SetSend: " << (send ? "true" : "false"); |
1022 if (send && !send_codec_.IsSet()) { | 1021 if (send && !send_codec_.IsSet()) { |
1023 LOG(LS_ERROR) << "SetSend(true) called before setting codec."; | 1022 LOG(LS_ERROR) << "SetSend(true) called before setting codec."; |
1024 return false; | 1023 return false; |
1025 } | 1024 } |
1026 if (send) { | 1025 if (send) { |
1027 StartAllSendStreams(); | 1026 StartAllSendStreams(); |
1028 } else { | 1027 } else { |
1029 StopAllSendStreams(); | 1028 StopAllSendStreams(); |
1030 } | 1029 } |
1031 sending_ = send; | 1030 sending_ = send; |
1032 return true; | 1031 return true; |
1033 } | 1032 } |
1034 | 1033 |
1035 bool WebRtcVideoChannel2::SetVideoSend(uint32 ssrc, bool enable, | 1034 bool WebRtcVideoChannel2::SetVideoSend(uint32_t ssrc, bool enable, |
1036 const VideoOptions* options) { | 1035 const VideoOptions* options) { |
1037 // TODO(solenberg): The state change should be fully rolled back if any one of | 1036 // TODO(solenberg): The state change should be fully rolled back if any one of |
1038 // these calls fail. | 1037 // these calls fail. |
1039 if (!MuteStream(ssrc, !enable)) { | 1038 if (!MuteStream(ssrc, !enable)) { |
1040 return false; | 1039 return false; |
1041 } | 1040 } |
1042 if (enable && options) { | 1041 if (enable && options) { |
1043 return SetOptions(*options); | 1042 return SetOptions(*options); |
1044 } else { | 1043 } else { |
1045 return true; | 1044 return true; |
(...skipping 26 matching lines...) Expand all Loading... |
1072 bool WebRtcVideoChannel2::AddSendStream(const StreamParams& sp) { | 1071 bool WebRtcVideoChannel2::AddSendStream(const StreamParams& sp) { |
1073 LOG(LS_INFO) << "AddSendStream: " << sp.ToString(); | 1072 LOG(LS_INFO) << "AddSendStream: " << sp.ToString(); |
1074 if (!ValidateStreamParams(sp)) | 1073 if (!ValidateStreamParams(sp)) |
1075 return false; | 1074 return false; |
1076 | 1075 |
1077 rtc::CritScope stream_lock(&stream_crit_); | 1076 rtc::CritScope stream_lock(&stream_crit_); |
1078 | 1077 |
1079 if (!ValidateSendSsrcAvailability(sp)) | 1078 if (!ValidateSendSsrcAvailability(sp)) |
1080 return false; | 1079 return false; |
1081 | 1080 |
1082 for (uint32 used_ssrc : sp.ssrcs) | 1081 for (uint32_t used_ssrc : sp.ssrcs) |
1083 send_ssrcs_.insert(used_ssrc); | 1082 send_ssrcs_.insert(used_ssrc); |
1084 | 1083 |
1085 webrtc::VideoSendStream::Config config(this); | 1084 webrtc::VideoSendStream::Config config(this); |
1086 config.overuse_callback = this; | 1085 config.overuse_callback = this; |
1087 | 1086 |
1088 WebRtcVideoSendStream* stream = | 1087 WebRtcVideoSendStream* stream = |
1089 new WebRtcVideoSendStream(call_, | 1088 new WebRtcVideoSendStream(call_, |
1090 sp, | 1089 sp, |
1091 config, | 1090 config, |
1092 external_encoder_factory_, | 1091 external_encoder_factory_, |
1093 options_, | 1092 options_, |
1094 bitrate_config_.max_bitrate_bps, | 1093 bitrate_config_.max_bitrate_bps, |
1095 send_codec_, | 1094 send_codec_, |
1096 send_rtp_extensions_); | 1095 send_rtp_extensions_); |
1097 | 1096 |
1098 uint32 ssrc = sp.first_ssrc(); | 1097 uint32_t ssrc = sp.first_ssrc(); |
1099 RTC_DCHECK(ssrc != 0); | 1098 RTC_DCHECK(ssrc != 0); |
1100 send_streams_[ssrc] = stream; | 1099 send_streams_[ssrc] = stream; |
1101 | 1100 |
1102 if (rtcp_receiver_report_ssrc_ == kDefaultRtcpReceiverReportSsrc) { | 1101 if (rtcp_receiver_report_ssrc_ == kDefaultRtcpReceiverReportSsrc) { |
1103 rtcp_receiver_report_ssrc_ = ssrc; | 1102 rtcp_receiver_report_ssrc_ = ssrc; |
1104 LOG(LS_INFO) << "SetLocalSsrc on all the receive streams because we added " | 1103 LOG(LS_INFO) << "SetLocalSsrc on all the receive streams because we added " |
1105 "a send stream."; | 1104 "a send stream."; |
1106 for (auto& kv : receive_streams_) | 1105 for (auto& kv : receive_streams_) |
1107 kv.second->SetLocalSsrc(ssrc); | 1106 kv.second->SetLocalSsrc(ssrc); |
1108 } | 1107 } |
1109 if (default_send_ssrc_ == 0) { | 1108 if (default_send_ssrc_ == 0) { |
1110 default_send_ssrc_ = ssrc; | 1109 default_send_ssrc_ = ssrc; |
1111 } | 1110 } |
1112 if (sending_) { | 1111 if (sending_) { |
1113 stream->Start(); | 1112 stream->Start(); |
1114 } | 1113 } |
1115 | 1114 |
1116 return true; | 1115 return true; |
1117 } | 1116 } |
1118 | 1117 |
1119 bool WebRtcVideoChannel2::RemoveSendStream(uint32 ssrc) { | 1118 bool WebRtcVideoChannel2::RemoveSendStream(uint32_t ssrc) { |
1120 LOG(LS_INFO) << "RemoveSendStream: " << ssrc; | 1119 LOG(LS_INFO) << "RemoveSendStream: " << ssrc; |
1121 | 1120 |
1122 if (ssrc == 0) { | 1121 if (ssrc == 0) { |
1123 if (default_send_ssrc_ == 0) { | 1122 if (default_send_ssrc_ == 0) { |
1124 LOG(LS_ERROR) << "No default send stream active."; | 1123 LOG(LS_ERROR) << "No default send stream active."; |
1125 return false; | 1124 return false; |
1126 } | 1125 } |
1127 | 1126 |
1128 LOG(LS_VERBOSE) << "Removing default stream: " << default_send_ssrc_; | 1127 LOG(LS_VERBOSE) << "Removing default stream: " << default_send_ssrc_; |
1129 ssrc = default_send_ssrc_; | 1128 ssrc = default_send_ssrc_; |
1130 } | 1129 } |
1131 | 1130 |
1132 WebRtcVideoSendStream* removed_stream; | 1131 WebRtcVideoSendStream* removed_stream; |
1133 { | 1132 { |
1134 rtc::CritScope stream_lock(&stream_crit_); | 1133 rtc::CritScope stream_lock(&stream_crit_); |
1135 std::map<uint32, WebRtcVideoSendStream*>::iterator it = | 1134 std::map<uint32_t, WebRtcVideoSendStream*>::iterator it = |
1136 send_streams_.find(ssrc); | 1135 send_streams_.find(ssrc); |
1137 if (it == send_streams_.end()) { | 1136 if (it == send_streams_.end()) { |
1138 return false; | 1137 return false; |
1139 } | 1138 } |
1140 | 1139 |
1141 for (uint32 old_ssrc : it->second->GetSsrcs()) | 1140 for (uint32_t old_ssrc : it->second->GetSsrcs()) |
1142 send_ssrcs_.erase(old_ssrc); | 1141 send_ssrcs_.erase(old_ssrc); |
1143 | 1142 |
1144 removed_stream = it->second; | 1143 removed_stream = it->second; |
1145 send_streams_.erase(it); | 1144 send_streams_.erase(it); |
1146 } | 1145 } |
1147 | 1146 |
1148 delete removed_stream; | 1147 delete removed_stream; |
1149 | 1148 |
1150 if (ssrc == default_send_ssrc_) { | 1149 if (ssrc == default_send_ssrc_) { |
1151 default_send_ssrc_ = 0; | 1150 default_send_ssrc_ = 0; |
1152 } | 1151 } |
1153 | 1152 |
1154 return true; | 1153 return true; |
1155 } | 1154 } |
1156 | 1155 |
1157 void WebRtcVideoChannel2::DeleteReceiveStream( | 1156 void WebRtcVideoChannel2::DeleteReceiveStream( |
1158 WebRtcVideoChannel2::WebRtcVideoReceiveStream* stream) { | 1157 WebRtcVideoChannel2::WebRtcVideoReceiveStream* stream) { |
1159 for (uint32 old_ssrc : stream->GetSsrcs()) | 1158 for (uint32_t old_ssrc : stream->GetSsrcs()) |
1160 receive_ssrcs_.erase(old_ssrc); | 1159 receive_ssrcs_.erase(old_ssrc); |
1161 delete stream; | 1160 delete stream; |
1162 } | 1161 } |
1163 | 1162 |
1164 bool WebRtcVideoChannel2::AddRecvStream(const StreamParams& sp) { | 1163 bool WebRtcVideoChannel2::AddRecvStream(const StreamParams& sp) { |
1165 return AddRecvStream(sp, false); | 1164 return AddRecvStream(sp, false); |
1166 } | 1165 } |
1167 | 1166 |
1168 bool WebRtcVideoChannel2::AddRecvStream(const StreamParams& sp, | 1167 bool WebRtcVideoChannel2::AddRecvStream(const StreamParams& sp, |
1169 bool default_stream) { | 1168 bool default_stream) { |
1170 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 1169 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
1171 | 1170 |
1172 LOG(LS_INFO) << "AddRecvStream" << (default_stream ? " (default stream)" : "") | 1171 LOG(LS_INFO) << "AddRecvStream" << (default_stream ? " (default stream)" : "") |
1173 << ": " << sp.ToString(); | 1172 << ": " << sp.ToString(); |
1174 if (!ValidateStreamParams(sp)) | 1173 if (!ValidateStreamParams(sp)) |
1175 return false; | 1174 return false; |
1176 | 1175 |
1177 uint32 ssrc = sp.first_ssrc(); | 1176 uint32_t ssrc = sp.first_ssrc(); |
1178 RTC_DCHECK(ssrc != 0); // TODO(pbos): Is this ever valid? | 1177 RTC_DCHECK(ssrc != 0); // TODO(pbos): Is this ever valid? |
1179 | 1178 |
1180 rtc::CritScope stream_lock(&stream_crit_); | 1179 rtc::CritScope stream_lock(&stream_crit_); |
1181 // Remove running stream if this was a default stream. | 1180 // Remove running stream if this was a default stream. |
1182 auto prev_stream = receive_streams_.find(ssrc); | 1181 auto prev_stream = receive_streams_.find(ssrc); |
1183 if (prev_stream != receive_streams_.end()) { | 1182 if (prev_stream != receive_streams_.end()) { |
1184 if (default_stream || !prev_stream->second->IsDefaultStream()) { | 1183 if (default_stream || !prev_stream->second->IsDefaultStream()) { |
1185 LOG(LS_ERROR) << "Receive stream for SSRC '" << ssrc | 1184 LOG(LS_ERROR) << "Receive stream for SSRC '" << ssrc |
1186 << "' already exists."; | 1185 << "' already exists."; |
1187 return false; | 1186 return false; |
1188 } | 1187 } |
1189 DeleteReceiveStream(prev_stream->second); | 1188 DeleteReceiveStream(prev_stream->second); |
1190 receive_streams_.erase(prev_stream); | 1189 receive_streams_.erase(prev_stream); |
1191 } | 1190 } |
1192 | 1191 |
1193 if (!ValidateReceiveSsrcAvailability(sp)) | 1192 if (!ValidateReceiveSsrcAvailability(sp)) |
1194 return false; | 1193 return false; |
1195 | 1194 |
1196 for (uint32 used_ssrc : sp.ssrcs) | 1195 for (uint32_t used_ssrc : sp.ssrcs) |
1197 receive_ssrcs_.insert(used_ssrc); | 1196 receive_ssrcs_.insert(used_ssrc); |
1198 | 1197 |
1199 webrtc::VideoReceiveStream::Config config(this); | 1198 webrtc::VideoReceiveStream::Config config(this); |
1200 ConfigureReceiverRtp(&config, sp); | 1199 ConfigureReceiverRtp(&config, sp); |
1201 | 1200 |
1202 // Set up A/V sync group based on sync label. | 1201 // Set up A/V sync group based on sync label. |
1203 config.sync_group = sp.sync_label; | 1202 config.sync_group = sp.sync_label; |
1204 | 1203 |
1205 config.rtp.remb = false; | 1204 config.rtp.remb = false; |
1206 VideoCodecSettings send_codec; | 1205 VideoCodecSettings send_codec; |
1207 if (send_codec_.Get(&send_codec)) { | 1206 if (send_codec_.Get(&send_codec)) { |
1208 config.rtp.remb = HasRemb(send_codec.codec); | 1207 config.rtp.remb = HasRemb(send_codec.codec); |
1209 } | 1208 } |
1210 | 1209 |
1211 receive_streams_[ssrc] = new WebRtcVideoReceiveStream( | 1210 receive_streams_[ssrc] = new WebRtcVideoReceiveStream( |
1212 call_, sp, config, external_decoder_factory_, default_stream, | 1211 call_, sp, config, external_decoder_factory_, default_stream, |
1213 recv_codecs_); | 1212 recv_codecs_); |
1214 | 1213 |
1215 return true; | 1214 return true; |
1216 } | 1215 } |
1217 | 1216 |
1218 void WebRtcVideoChannel2::ConfigureReceiverRtp( | 1217 void WebRtcVideoChannel2::ConfigureReceiverRtp( |
1219 webrtc::VideoReceiveStream::Config* config, | 1218 webrtc::VideoReceiveStream::Config* config, |
1220 const StreamParams& sp) const { | 1219 const StreamParams& sp) const { |
1221 uint32 ssrc = sp.first_ssrc(); | 1220 uint32_t ssrc = sp.first_ssrc(); |
1222 | 1221 |
1223 config->rtp.remote_ssrc = ssrc; | 1222 config->rtp.remote_ssrc = ssrc; |
1224 config->rtp.local_ssrc = rtcp_receiver_report_ssrc_; | 1223 config->rtp.local_ssrc = rtcp_receiver_report_ssrc_; |
1225 | 1224 |
1226 config->rtp.extensions = recv_rtp_extensions_; | 1225 config->rtp.extensions = recv_rtp_extensions_; |
1227 | 1226 |
1228 // TODO(pbos): This protection is against setting the same local ssrc as | 1227 // TODO(pbos): This protection is against setting the same local ssrc as |
1229 // remote which is not permitted by the lower-level API. RTCP requires a | 1228 // remote which is not permitted by the lower-level API. RTCP requires a |
1230 // corresponding sender SSRC. Figure out what to do when we don't have | 1229 // corresponding sender SSRC. Figure out what to do when we don't have |
1231 // (receive-only) or know a good local SSRC. | 1230 // (receive-only) or know a good local SSRC. |
1232 if (config->rtp.remote_ssrc == config->rtp.local_ssrc) { | 1231 if (config->rtp.remote_ssrc == config->rtp.local_ssrc) { |
1233 if (config->rtp.local_ssrc != kDefaultRtcpReceiverReportSsrc) { | 1232 if (config->rtp.local_ssrc != kDefaultRtcpReceiverReportSsrc) { |
1234 config->rtp.local_ssrc = kDefaultRtcpReceiverReportSsrc; | 1233 config->rtp.local_ssrc = kDefaultRtcpReceiverReportSsrc; |
1235 } else { | 1234 } else { |
1236 config->rtp.local_ssrc = kDefaultRtcpReceiverReportSsrc + 1; | 1235 config->rtp.local_ssrc = kDefaultRtcpReceiverReportSsrc + 1; |
1237 } | 1236 } |
1238 } | 1237 } |
1239 | 1238 |
1240 for (size_t i = 0; i < recv_codecs_.size(); ++i) { | 1239 for (size_t i = 0; i < recv_codecs_.size(); ++i) { |
1241 MergeFecConfig(recv_codecs_[i].fec, &config->rtp.fec); | 1240 MergeFecConfig(recv_codecs_[i].fec, &config->rtp.fec); |
1242 } | 1241 } |
1243 | 1242 |
1244 for (size_t i = 0; i < recv_codecs_.size(); ++i) { | 1243 for (size_t i = 0; i < recv_codecs_.size(); ++i) { |
1245 uint32 rtx_ssrc; | 1244 uint32_t rtx_ssrc; |
1246 if (recv_codecs_[i].rtx_payload_type != -1 && | 1245 if (recv_codecs_[i].rtx_payload_type != -1 && |
1247 sp.GetFidSsrc(ssrc, &rtx_ssrc)) { | 1246 sp.GetFidSsrc(ssrc, &rtx_ssrc)) { |
1248 webrtc::VideoReceiveStream::Config::Rtp::Rtx& rtx = | 1247 webrtc::VideoReceiveStream::Config::Rtp::Rtx& rtx = |
1249 config->rtp.rtx[recv_codecs_[i].codec.id]; | 1248 config->rtp.rtx[recv_codecs_[i].codec.id]; |
1250 rtx.ssrc = rtx_ssrc; | 1249 rtx.ssrc = rtx_ssrc; |
1251 rtx.payload_type = recv_codecs_[i].rtx_payload_type; | 1250 rtx.payload_type = recv_codecs_[i].rtx_payload_type; |
1252 } | 1251 } |
1253 } | 1252 } |
1254 } | 1253 } |
1255 | 1254 |
1256 bool WebRtcVideoChannel2::RemoveRecvStream(uint32 ssrc) { | 1255 bool WebRtcVideoChannel2::RemoveRecvStream(uint32_t ssrc) { |
1257 LOG(LS_INFO) << "RemoveRecvStream: " << ssrc; | 1256 LOG(LS_INFO) << "RemoveRecvStream: " << ssrc; |
1258 if (ssrc == 0) { | 1257 if (ssrc == 0) { |
1259 LOG(LS_ERROR) << "RemoveRecvStream with 0 ssrc is not supported."; | 1258 LOG(LS_ERROR) << "RemoveRecvStream with 0 ssrc is not supported."; |
1260 return false; | 1259 return false; |
1261 } | 1260 } |
1262 | 1261 |
1263 rtc::CritScope stream_lock(&stream_crit_); | 1262 rtc::CritScope stream_lock(&stream_crit_); |
1264 std::map<uint32, WebRtcVideoReceiveStream*>::iterator stream = | 1263 std::map<uint32_t, WebRtcVideoReceiveStream*>::iterator stream = |
1265 receive_streams_.find(ssrc); | 1264 receive_streams_.find(ssrc); |
1266 if (stream == receive_streams_.end()) { | 1265 if (stream == receive_streams_.end()) { |
1267 LOG(LS_ERROR) << "Stream not found for ssrc: " << ssrc; | 1266 LOG(LS_ERROR) << "Stream not found for ssrc: " << ssrc; |
1268 return false; | 1267 return false; |
1269 } | 1268 } |
1270 DeleteReceiveStream(stream->second); | 1269 DeleteReceiveStream(stream->second); |
1271 receive_streams_.erase(stream); | 1270 receive_streams_.erase(stream); |
1272 | 1271 |
1273 return true; | 1272 return true; |
1274 } | 1273 } |
1275 | 1274 |
1276 bool WebRtcVideoChannel2::SetRenderer(uint32 ssrc, VideoRenderer* renderer) { | 1275 bool WebRtcVideoChannel2::SetRenderer(uint32_t ssrc, VideoRenderer* renderer) { |
1277 LOG(LS_INFO) << "SetRenderer: ssrc:" << ssrc << " " | 1276 LOG(LS_INFO) << "SetRenderer: ssrc:" << ssrc << " " |
1278 << (renderer ? "(ptr)" : "NULL"); | 1277 << (renderer ? "(ptr)" : "NULL"); |
1279 if (ssrc == 0) { | 1278 if (ssrc == 0) { |
1280 default_unsignalled_ssrc_handler_.SetDefaultRenderer(this, renderer); | 1279 default_unsignalled_ssrc_handler_.SetDefaultRenderer(this, renderer); |
1281 return true; | 1280 return true; |
1282 } | 1281 } |
1283 | 1282 |
1284 rtc::CritScope stream_lock(&stream_crit_); | 1283 rtc::CritScope stream_lock(&stream_crit_); |
1285 std::map<uint32, WebRtcVideoReceiveStream*>::iterator it = | 1284 std::map<uint32_t, WebRtcVideoReceiveStream*>::iterator it = |
1286 receive_streams_.find(ssrc); | 1285 receive_streams_.find(ssrc); |
1287 if (it == receive_streams_.end()) { | 1286 if (it == receive_streams_.end()) { |
1288 return false; | 1287 return false; |
1289 } | 1288 } |
1290 | 1289 |
1291 it->second->SetRenderer(renderer); | 1290 it->second->SetRenderer(renderer); |
1292 return true; | 1291 return true; |
1293 } | 1292 } |
1294 | 1293 |
1295 bool WebRtcVideoChannel2::GetRenderer(uint32 ssrc, VideoRenderer** renderer) { | 1294 bool WebRtcVideoChannel2::GetRenderer(uint32_t ssrc, VideoRenderer** renderer) { |
1296 if (ssrc == 0) { | 1295 if (ssrc == 0) { |
1297 *renderer = default_unsignalled_ssrc_handler_.GetDefaultRenderer(); | 1296 *renderer = default_unsignalled_ssrc_handler_.GetDefaultRenderer(); |
1298 return *renderer != NULL; | 1297 return *renderer != NULL; |
1299 } | 1298 } |
1300 | 1299 |
1301 rtc::CritScope stream_lock(&stream_crit_); | 1300 rtc::CritScope stream_lock(&stream_crit_); |
1302 std::map<uint32, WebRtcVideoReceiveStream*>::iterator it = | 1301 std::map<uint32_t, WebRtcVideoReceiveStream*>::iterator it = |
1303 receive_streams_.find(ssrc); | 1302 receive_streams_.find(ssrc); |
1304 if (it == receive_streams_.end()) { | 1303 if (it == receive_streams_.end()) { |
1305 return false; | 1304 return false; |
1306 } | 1305 } |
1307 *renderer = it->second->GetRenderer(); | 1306 *renderer = it->second->GetRenderer(); |
1308 return true; | 1307 return true; |
1309 } | 1308 } |
1310 | 1309 |
1311 bool WebRtcVideoChannel2::GetStats(VideoMediaInfo* info) { | 1310 bool WebRtcVideoChannel2::GetStats(VideoMediaInfo* info) { |
1312 info->Clear(); | 1311 info->Clear(); |
1313 FillSenderStats(info); | 1312 FillSenderStats(info); |
1314 FillReceiverStats(info); | 1313 FillReceiverStats(info); |
1315 webrtc::Call::Stats stats = call_->GetStats(); | 1314 webrtc::Call::Stats stats = call_->GetStats(); |
1316 FillBandwidthEstimationStats(stats, info); | 1315 FillBandwidthEstimationStats(stats, info); |
1317 if (stats.rtt_ms != -1) { | 1316 if (stats.rtt_ms != -1) { |
1318 for (size_t i = 0; i < info->senders.size(); ++i) { | 1317 for (size_t i = 0; i < info->senders.size(); ++i) { |
1319 info->senders[i].rtt_ms = stats.rtt_ms; | 1318 info->senders[i].rtt_ms = stats.rtt_ms; |
1320 } | 1319 } |
1321 } | 1320 } |
1322 return true; | 1321 return true; |
1323 } | 1322 } |
1324 | 1323 |
1325 void WebRtcVideoChannel2::FillSenderStats(VideoMediaInfo* video_media_info) { | 1324 void WebRtcVideoChannel2::FillSenderStats(VideoMediaInfo* video_media_info) { |
1326 rtc::CritScope stream_lock(&stream_crit_); | 1325 rtc::CritScope stream_lock(&stream_crit_); |
1327 for (std::map<uint32, WebRtcVideoSendStream*>::iterator it = | 1326 for (std::map<uint32_t, WebRtcVideoSendStream*>::iterator it = |
1328 send_streams_.begin(); | 1327 send_streams_.begin(); |
1329 it != send_streams_.end(); | 1328 it != send_streams_.end(); ++it) { |
1330 ++it) { | |
1331 video_media_info->senders.push_back(it->second->GetVideoSenderInfo()); | 1329 video_media_info->senders.push_back(it->second->GetVideoSenderInfo()); |
1332 } | 1330 } |
1333 } | 1331 } |
1334 | 1332 |
1335 void WebRtcVideoChannel2::FillReceiverStats(VideoMediaInfo* video_media_info) { | 1333 void WebRtcVideoChannel2::FillReceiverStats(VideoMediaInfo* video_media_info) { |
1336 rtc::CritScope stream_lock(&stream_crit_); | 1334 rtc::CritScope stream_lock(&stream_crit_); |
1337 for (std::map<uint32, WebRtcVideoReceiveStream*>::iterator it = | 1335 for (std::map<uint32_t, WebRtcVideoReceiveStream*>::iterator it = |
1338 receive_streams_.begin(); | 1336 receive_streams_.begin(); |
1339 it != receive_streams_.end(); | 1337 it != receive_streams_.end(); ++it) { |
1340 ++it) { | |
1341 video_media_info->receivers.push_back(it->second->GetVideoReceiverInfo()); | 1338 video_media_info->receivers.push_back(it->second->GetVideoReceiverInfo()); |
1342 } | 1339 } |
1343 } | 1340 } |
1344 | 1341 |
1345 void WebRtcVideoChannel2::FillBandwidthEstimationStats( | 1342 void WebRtcVideoChannel2::FillBandwidthEstimationStats( |
1346 const webrtc::Call::Stats& stats, | 1343 const webrtc::Call::Stats& stats, |
1347 VideoMediaInfo* video_media_info) { | 1344 VideoMediaInfo* video_media_info) { |
1348 BandwidthEstimationInfo bwe_info; | 1345 BandwidthEstimationInfo bwe_info; |
1349 bwe_info.available_send_bandwidth = stats.send_bandwidth_bps; | 1346 bwe_info.available_send_bandwidth = stats.send_bandwidth_bps; |
1350 bwe_info.available_recv_bandwidth = stats.recv_bandwidth_bps; | 1347 bwe_info.available_recv_bandwidth = stats.recv_bandwidth_bps; |
1351 bwe_info.bucket_delay = stats.pacer_delay_ms; | 1348 bwe_info.bucket_delay = stats.pacer_delay_ms; |
1352 | 1349 |
1353 // Get send stream bitrate stats. | 1350 // Get send stream bitrate stats. |
1354 rtc::CritScope stream_lock(&stream_crit_); | 1351 rtc::CritScope stream_lock(&stream_crit_); |
1355 for (std::map<uint32, WebRtcVideoSendStream*>::iterator stream = | 1352 for (std::map<uint32_t, WebRtcVideoSendStream*>::iterator stream = |
1356 send_streams_.begin(); | 1353 send_streams_.begin(); |
1357 stream != send_streams_.end(); | 1354 stream != send_streams_.end(); ++stream) { |
1358 ++stream) { | |
1359 stream->second->FillBandwidthEstimationInfo(&bwe_info); | 1355 stream->second->FillBandwidthEstimationInfo(&bwe_info); |
1360 } | 1356 } |
1361 video_media_info->bw_estimations.push_back(bwe_info); | 1357 video_media_info->bw_estimations.push_back(bwe_info); |
1362 } | 1358 } |
1363 | 1359 |
1364 bool WebRtcVideoChannel2::SetCapturer(uint32 ssrc, VideoCapturer* capturer) { | 1360 bool WebRtcVideoChannel2::SetCapturer(uint32_t ssrc, VideoCapturer* capturer) { |
1365 LOG(LS_INFO) << "SetCapturer: " << ssrc << " -> " | 1361 LOG(LS_INFO) << "SetCapturer: " << ssrc << " -> " |
1366 << (capturer != NULL ? "(capturer)" : "NULL"); | 1362 << (capturer != NULL ? "(capturer)" : "NULL"); |
1367 RTC_DCHECK(ssrc != 0); | 1363 RTC_DCHECK(ssrc != 0); |
1368 { | 1364 { |
1369 rtc::CritScope stream_lock(&stream_crit_); | 1365 rtc::CritScope stream_lock(&stream_crit_); |
1370 if (send_streams_.find(ssrc) == send_streams_.end()) { | 1366 if (send_streams_.find(ssrc) == send_streams_.end()) { |
1371 LOG(LS_ERROR) << "No sending stream on ssrc " << ssrc; | 1367 LOG(LS_ERROR) << "No sending stream on ssrc " << ssrc; |
1372 return false; | 1368 return false; |
1373 } | 1369 } |
1374 if (!send_streams_[ssrc]->SetCapturer(capturer)) { | 1370 if (!send_streams_[ssrc]->SetCapturer(capturer)) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1412 webrtc_packet_time); | 1408 webrtc_packet_time); |
1413 switch (delivery_result) { | 1409 switch (delivery_result) { |
1414 case webrtc::PacketReceiver::DELIVERY_OK: | 1410 case webrtc::PacketReceiver::DELIVERY_OK: |
1415 return; | 1411 return; |
1416 case webrtc::PacketReceiver::DELIVERY_PACKET_ERROR: | 1412 case webrtc::PacketReceiver::DELIVERY_PACKET_ERROR: |
1417 return; | 1413 return; |
1418 case webrtc::PacketReceiver::DELIVERY_UNKNOWN_SSRC: | 1414 case webrtc::PacketReceiver::DELIVERY_UNKNOWN_SSRC: |
1419 break; | 1415 break; |
1420 } | 1416 } |
1421 | 1417 |
1422 uint32 ssrc = 0; | 1418 uint32_t ssrc = 0; |
1423 if (!GetRtpSsrc(packet->data(), packet->size(), &ssrc)) { | 1419 if (!GetRtpSsrc(packet->data(), packet->size(), &ssrc)) { |
1424 return; | 1420 return; |
1425 } | 1421 } |
1426 | 1422 |
1427 int payload_type = 0; | 1423 int payload_type = 0; |
1428 if (!GetRtpPayloadType(packet->data(), packet->size(), &payload_type)) { | 1424 if (!GetRtpPayloadType(packet->data(), packet->size(), &payload_type)) { |
1429 return; | 1425 return; |
1430 } | 1426 } |
1431 | 1427 |
1432 // See if this payload_type is registered as one that usually gets its own | 1428 // See if this payload_type is registered as one that usually gets its own |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1469 webrtc_packet_time) != webrtc::PacketReceiver::DELIVERY_OK) { | 1465 webrtc_packet_time) != webrtc::PacketReceiver::DELIVERY_OK) { |
1470 LOG(LS_WARNING) << "Failed to deliver RTCP packet."; | 1466 LOG(LS_WARNING) << "Failed to deliver RTCP packet."; |
1471 } | 1467 } |
1472 } | 1468 } |
1473 | 1469 |
1474 void WebRtcVideoChannel2::OnReadyToSend(bool ready) { | 1470 void WebRtcVideoChannel2::OnReadyToSend(bool ready) { |
1475 LOG(LS_VERBOSE) << "OnReadyToSend: " << (ready ? "Ready." : "Not ready."); | 1471 LOG(LS_VERBOSE) << "OnReadyToSend: " << (ready ? "Ready." : "Not ready."); |
1476 call_->SignalNetworkState(ready ? webrtc::kNetworkUp : webrtc::kNetworkDown); | 1472 call_->SignalNetworkState(ready ? webrtc::kNetworkUp : webrtc::kNetworkDown); |
1477 } | 1473 } |
1478 | 1474 |
1479 bool WebRtcVideoChannel2::MuteStream(uint32 ssrc, bool mute) { | 1475 bool WebRtcVideoChannel2::MuteStream(uint32_t ssrc, bool mute) { |
1480 LOG(LS_VERBOSE) << "MuteStream: " << ssrc << " -> " | 1476 LOG(LS_VERBOSE) << "MuteStream: " << ssrc << " -> " |
1481 << (mute ? "mute" : "unmute"); | 1477 << (mute ? "mute" : "unmute"); |
1482 RTC_DCHECK(ssrc != 0); | 1478 RTC_DCHECK(ssrc != 0); |
1483 rtc::CritScope stream_lock(&stream_crit_); | 1479 rtc::CritScope stream_lock(&stream_crit_); |
1484 if (send_streams_.find(ssrc) == send_streams_.end()) { | 1480 if (send_streams_.find(ssrc) == send_streams_.end()) { |
1485 LOG(LS_ERROR) << "No sending stream on ssrc " << ssrc; | 1481 LOG(LS_ERROR) << "No sending stream on ssrc " << ssrc; |
1486 return false; | 1482 return false; |
1487 } | 1483 } |
1488 | 1484 |
1489 send_streams_[ssrc]->MuteStream(mute); | 1485 send_streams_[ssrc]->MuteStream(mute); |
(...skipping 12 matching lines...) Expand all Loading... |
1502 FilterRtpExtensions(extensions); | 1498 FilterRtpExtensions(extensions); |
1503 if (!RtpExtensionsHaveChanged(recv_rtp_extensions_, filtered_extensions)) { | 1499 if (!RtpExtensionsHaveChanged(recv_rtp_extensions_, filtered_extensions)) { |
1504 LOG(LS_INFO) << "Ignoring call to SetRecvRtpHeaderExtensions because " | 1500 LOG(LS_INFO) << "Ignoring call to SetRecvRtpHeaderExtensions because " |
1505 "header extensions haven't changed."; | 1501 "header extensions haven't changed."; |
1506 return true; | 1502 return true; |
1507 } | 1503 } |
1508 | 1504 |
1509 recv_rtp_extensions_ = filtered_extensions; | 1505 recv_rtp_extensions_ = filtered_extensions; |
1510 | 1506 |
1511 rtc::CritScope stream_lock(&stream_crit_); | 1507 rtc::CritScope stream_lock(&stream_crit_); |
1512 for (std::map<uint32, WebRtcVideoReceiveStream*>::iterator it = | 1508 for (std::map<uint32_t, WebRtcVideoReceiveStream*>::iterator it = |
1513 receive_streams_.begin(); | 1509 receive_streams_.begin(); |
1514 it != receive_streams_.end(); | 1510 it != receive_streams_.end(); ++it) { |
1515 ++it) { | |
1516 it->second->SetRtpExtensions(recv_rtp_extensions_); | 1511 it->second->SetRtpExtensions(recv_rtp_extensions_); |
1517 } | 1512 } |
1518 return true; | 1513 return true; |
1519 } | 1514 } |
1520 | 1515 |
1521 bool WebRtcVideoChannel2::SetSendRtpHeaderExtensions( | 1516 bool WebRtcVideoChannel2::SetSendRtpHeaderExtensions( |
1522 const std::vector<RtpHeaderExtension>& extensions) { | 1517 const std::vector<RtpHeaderExtension>& extensions) { |
1523 TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetSendRtpHeaderExtensions"); | 1518 TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetSendRtpHeaderExtensions"); |
1524 LOG(LS_INFO) << "SetSendRtpHeaderExtensions: " | 1519 LOG(LS_INFO) << "SetSendRtpHeaderExtensions: " |
1525 << RtpExtensionsToString(extensions); | 1520 << RtpExtensionsToString(extensions); |
1526 if (!ValidateRtpHeaderExtensionIds(extensions)) | 1521 if (!ValidateRtpHeaderExtensionIds(extensions)) |
1527 return false; | 1522 return false; |
1528 | 1523 |
1529 std::vector<webrtc::RtpExtension> filtered_extensions = | 1524 std::vector<webrtc::RtpExtension> filtered_extensions = |
1530 FilterRtpExtensions(extensions); | 1525 FilterRtpExtensions(extensions); |
1531 if (!RtpExtensionsHaveChanged(send_rtp_extensions_, filtered_extensions)) { | 1526 if (!RtpExtensionsHaveChanged(send_rtp_extensions_, filtered_extensions)) { |
1532 LOG(LS_INFO) << "Ignoring call to SetSendRtpHeaderExtensions because " | 1527 LOG(LS_INFO) << "Ignoring call to SetSendRtpHeaderExtensions because " |
1533 "header extensions haven't changed."; | 1528 "header extensions haven't changed."; |
1534 return true; | 1529 return true; |
1535 } | 1530 } |
1536 | 1531 |
1537 send_rtp_extensions_ = filtered_extensions; | 1532 send_rtp_extensions_ = filtered_extensions; |
1538 | 1533 |
1539 const webrtc::RtpExtension* cvo_extension = FindHeaderExtension( | 1534 const webrtc::RtpExtension* cvo_extension = FindHeaderExtension( |
1540 send_rtp_extensions_, kRtpVideoRotationHeaderExtension); | 1535 send_rtp_extensions_, kRtpVideoRotationHeaderExtension); |
1541 | 1536 |
1542 rtc::CritScope stream_lock(&stream_crit_); | 1537 rtc::CritScope stream_lock(&stream_crit_); |
1543 for (std::map<uint32, WebRtcVideoSendStream*>::iterator it = | 1538 for (std::map<uint32_t, WebRtcVideoSendStream*>::iterator it = |
1544 send_streams_.begin(); | 1539 send_streams_.begin(); |
1545 it != send_streams_.end(); | 1540 it != send_streams_.end(); ++it) { |
1546 ++it) { | |
1547 it->second->SetRtpExtensions(send_rtp_extensions_); | 1541 it->second->SetRtpExtensions(send_rtp_extensions_); |
1548 it->second->SetApplyRotation(!cvo_extension); | 1542 it->second->SetApplyRotation(!cvo_extension); |
1549 } | 1543 } |
1550 return true; | 1544 return true; |
1551 } | 1545 } |
1552 | 1546 |
1553 // Counter-intuitively this method doesn't only set global bitrate caps but also | 1547 // Counter-intuitively this method doesn't only set global bitrate caps but also |
1554 // per-stream codec max bitrates. This is to permit SetMaxSendBitrate (b=AS) to | 1548 // per-stream codec max bitrates. This is to permit SetMaxSendBitrate (b=AS) to |
1555 // raise bitrates above the 2000k default bitrate cap. | 1549 // raise bitrates above the 2000k default bitrate cap. |
1556 bool WebRtcVideoChannel2::SetMaxSendBandwidth(int max_bitrate_bps) { | 1550 bool WebRtcVideoChannel2::SetMaxSendBandwidth(int max_bitrate_bps) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1594 } | 1588 } |
1595 { | 1589 { |
1596 rtc::CritScope lock(&capturer_crit_); | 1590 rtc::CritScope lock(&capturer_crit_); |
1597 options_.cpu_overuse_detection.Get(&signal_cpu_adaptation_); | 1591 options_.cpu_overuse_detection.Get(&signal_cpu_adaptation_); |
1598 } | 1592 } |
1599 rtc::DiffServCodePoint dscp = options_.dscp.GetWithDefaultIfUnset(false) | 1593 rtc::DiffServCodePoint dscp = options_.dscp.GetWithDefaultIfUnset(false) |
1600 ? rtc::DSCP_AF41 | 1594 ? rtc::DSCP_AF41 |
1601 : rtc::DSCP_DEFAULT; | 1595 : rtc::DSCP_DEFAULT; |
1602 MediaChannel::SetDscp(dscp); | 1596 MediaChannel::SetDscp(dscp); |
1603 rtc::CritScope stream_lock(&stream_crit_); | 1597 rtc::CritScope stream_lock(&stream_crit_); |
1604 for (std::map<uint32, WebRtcVideoSendStream*>::iterator it = | 1598 for (std::map<uint32_t, WebRtcVideoSendStream*>::iterator it = |
1605 send_streams_.begin(); | 1599 send_streams_.begin(); |
1606 it != send_streams_.end(); | 1600 it != send_streams_.end(); ++it) { |
1607 ++it) { | |
1608 it->second->SetOptions(options_); | 1601 it->second->SetOptions(options_); |
1609 } | 1602 } |
1610 return true; | 1603 return true; |
1611 } | 1604 } |
1612 | 1605 |
1613 void WebRtcVideoChannel2::SetInterface(NetworkInterface* iface) { | 1606 void WebRtcVideoChannel2::SetInterface(NetworkInterface* iface) { |
1614 MediaChannel::SetInterface(iface); | 1607 MediaChannel::SetInterface(iface); |
1615 // Set the RTP recv/send buffer to a bigger size | 1608 // Set the RTP recv/send buffer to a bigger size |
1616 MediaChannel::SetOption(NetworkInterface::ST_RTP, | 1609 MediaChannel::SetOption(NetworkInterface::ST_RTP, |
1617 rtc::Socket::OPT_RCVBUF, | 1610 rtc::Socket::OPT_RCVBUF, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1661 return MediaChannel::SendPacket(&packet); | 1654 return MediaChannel::SendPacket(&packet); |
1662 } | 1655 } |
1663 | 1656 |
1664 bool WebRtcVideoChannel2::SendRtcp(const uint8_t* data, size_t len) { | 1657 bool WebRtcVideoChannel2::SendRtcp(const uint8_t* data, size_t len) { |
1665 rtc::Buffer packet(data, len, kMaxRtpPacketLen); | 1658 rtc::Buffer packet(data, len, kMaxRtpPacketLen); |
1666 return MediaChannel::SendRtcp(&packet); | 1659 return MediaChannel::SendRtcp(&packet); |
1667 } | 1660 } |
1668 | 1661 |
1669 void WebRtcVideoChannel2::StartAllSendStreams() { | 1662 void WebRtcVideoChannel2::StartAllSendStreams() { |
1670 rtc::CritScope stream_lock(&stream_crit_); | 1663 rtc::CritScope stream_lock(&stream_crit_); |
1671 for (std::map<uint32, WebRtcVideoSendStream*>::iterator it = | 1664 for (std::map<uint32_t, WebRtcVideoSendStream*>::iterator it = |
1672 send_streams_.begin(); | 1665 send_streams_.begin(); |
1673 it != send_streams_.end(); | 1666 it != send_streams_.end(); ++it) { |
1674 ++it) { | |
1675 it->second->Start(); | 1667 it->second->Start(); |
1676 } | 1668 } |
1677 } | 1669 } |
1678 | 1670 |
1679 void WebRtcVideoChannel2::StopAllSendStreams() { | 1671 void WebRtcVideoChannel2::StopAllSendStreams() { |
1680 rtc::CritScope stream_lock(&stream_crit_); | 1672 rtc::CritScope stream_lock(&stream_crit_); |
1681 for (std::map<uint32, WebRtcVideoSendStream*>::iterator it = | 1673 for (std::map<uint32_t, WebRtcVideoSendStream*>::iterator it = |
1682 send_streams_.begin(); | 1674 send_streams_.begin(); |
1683 it != send_streams_.end(); | 1675 it != send_streams_.end(); ++it) { |
1684 ++it) { | |
1685 it->second->Stop(); | 1676 it->second->Stop(); |
1686 } | 1677 } |
1687 } | 1678 } |
1688 | 1679 |
1689 WebRtcVideoChannel2::WebRtcVideoSendStream::VideoSendStreamParameters:: | 1680 WebRtcVideoChannel2::WebRtcVideoSendStream::VideoSendStreamParameters:: |
1690 VideoSendStreamParameters( | 1681 VideoSendStreamParameters( |
1691 const webrtc::VideoSendStream::Config& config, | 1682 const webrtc::VideoSendStream::Config& config, |
1692 const VideoOptions& options, | 1683 const VideoOptions& options, |
1693 int max_bitrate_bps, | 1684 int max_bitrate_bps, |
1694 const Settable<VideoCodecSettings>& codec_settings) | 1685 const Settable<VideoCodecSettings>& codec_settings) |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1899 if (capturer_->video_adapter() != nullptr) | 1890 if (capturer_->video_adapter() != nullptr) |
1900 old_adapt_changes_ += capturer_->video_adapter()->adaptation_changes(); | 1891 old_adapt_changes_ += capturer_->video_adapter()->adaptation_changes(); |
1901 | 1892 |
1902 capturer = capturer_; | 1893 capturer = capturer_; |
1903 capturer_ = NULL; | 1894 capturer_ = NULL; |
1904 } | 1895 } |
1905 capturer->SignalVideoFrame.disconnect(this); | 1896 capturer->SignalVideoFrame.disconnect(this); |
1906 return true; | 1897 return true; |
1907 } | 1898 } |
1908 | 1899 |
1909 const std::vector<uint32>& | 1900 const std::vector<uint32_t>& |
1910 WebRtcVideoChannel2::WebRtcVideoSendStream::GetSsrcs() const { | 1901 WebRtcVideoChannel2::WebRtcVideoSendStream::GetSsrcs() const { |
1911 return ssrcs_; | 1902 return ssrcs_; |
1912 } | 1903 } |
1913 | 1904 |
1914 void WebRtcVideoChannel2::WebRtcVideoSendStream::SetApplyRotation( | 1905 void WebRtcVideoChannel2::WebRtcVideoSendStream::SetApplyRotation( |
1915 bool apply_rotation) { | 1906 bool apply_rotation) { |
1916 rtc::CritScope cs(&lock_); | 1907 rtc::CritScope cs(&lock_); |
1917 if (capturer_ == NULL) | 1908 if (capturer_ == NULL) |
1918 return; | 1909 return; |
1919 | 1910 |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2362 this->decoder = | 2353 this->decoder = |
2363 new webrtc::VideoDecoderSoftwareFallbackWrapper(type, external_decoder); | 2354 new webrtc::VideoDecoderSoftwareFallbackWrapper(type, external_decoder); |
2364 } | 2355 } |
2365 } | 2356 } |
2366 | 2357 |
2367 WebRtcVideoChannel2::WebRtcVideoReceiveStream::~WebRtcVideoReceiveStream() { | 2358 WebRtcVideoChannel2::WebRtcVideoReceiveStream::~WebRtcVideoReceiveStream() { |
2368 call_->DestroyVideoReceiveStream(stream_); | 2359 call_->DestroyVideoReceiveStream(stream_); |
2369 ClearDecoders(&allocated_decoders_); | 2360 ClearDecoders(&allocated_decoders_); |
2370 } | 2361 } |
2371 | 2362 |
2372 const std::vector<uint32>& | 2363 const std::vector<uint32_t>& |
2373 WebRtcVideoChannel2::WebRtcVideoReceiveStream::GetSsrcs() const { | 2364 WebRtcVideoChannel2::WebRtcVideoReceiveStream::GetSsrcs() const { |
2374 return ssrcs_; | 2365 return ssrcs_; |
2375 } | 2366 } |
2376 | 2367 |
2377 WebRtcVideoChannel2::WebRtcVideoReceiveStream::AllocatedDecoder | 2368 WebRtcVideoChannel2::WebRtcVideoReceiveStream::AllocatedDecoder |
2378 WebRtcVideoChannel2::WebRtcVideoReceiveStream::CreateOrReuseVideoDecoder( | 2369 WebRtcVideoChannel2::WebRtcVideoReceiveStream::CreateOrReuseVideoDecoder( |
2379 std::vector<AllocatedDecoder>* old_decoders, | 2370 std::vector<AllocatedDecoder>* old_decoders, |
2380 const VideoCodec& codec) { | 2371 const VideoCodec& codec) { |
2381 webrtc::VideoCodecType type = CodecTypeFromName(codec.name); | 2372 webrtc::VideoCodecType type = CodecTypeFromName(codec.name); |
2382 | 2373 |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2734 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2725 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
2735 } | 2726 } |
2736 } | 2727 } |
2737 | 2728 |
2738 return video_codecs; | 2729 return video_codecs; |
2739 } | 2730 } |
2740 | 2731 |
2741 } // namespace cricket | 2732 } // namespace cricket |
2742 | 2733 |
2743 #endif // HAVE_WEBRTC_VIDEO | 2734 #endif // HAVE_WEBRTC_VIDEO |
OLD | NEW |