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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 } | 211 } |
212 return true; | 212 return true; |
213 } | 213 } |
214 | 214 |
215 static bool ValidateStreamParams(const StreamParams& sp) { | 215 static bool ValidateStreamParams(const StreamParams& sp) { |
216 if (sp.ssrcs.empty()) { | 216 if (sp.ssrcs.empty()) { |
217 LOG(LS_ERROR) << "No SSRCs in stream parameters: " << sp.ToString(); | 217 LOG(LS_ERROR) << "No SSRCs in stream parameters: " << sp.ToString(); |
218 return false; | 218 return false; |
219 } | 219 } |
220 | 220 |
221 std::vector<uint32> primary_ssrcs; | 221 std::vector<uint32_t> primary_ssrcs; |
222 sp.GetPrimarySsrcs(&primary_ssrcs); | 222 sp.GetPrimarySsrcs(&primary_ssrcs); |
223 std::vector<uint32> rtx_ssrcs; | 223 std::vector<uint32_t> rtx_ssrcs; |
224 sp.GetFidSsrcs(primary_ssrcs, &rtx_ssrcs); | 224 sp.GetFidSsrcs(primary_ssrcs, &rtx_ssrcs); |
225 for (uint32_t rtx_ssrc : rtx_ssrcs) { | 225 for (uint32_t rtx_ssrc : rtx_ssrcs) { |
226 bool rtx_ssrc_present = false; | 226 bool rtx_ssrc_present = false; |
227 for (uint32_t sp_ssrc : sp.ssrcs) { | 227 for (uint32_t sp_ssrc : sp.ssrcs) { |
228 if (sp_ssrc == rtx_ssrc) { | 228 if (sp_ssrc == rtx_ssrc) { |
229 rtx_ssrc_present = true; | 229 rtx_ssrc_present = true; |
230 break; | 230 break; |
231 } | 231 } |
232 } | 232 } |
233 if (!rtx_ssrc_present) { | 233 if (!rtx_ssrc_present) { |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 << "Ignoring call to SetRecvCodecs because codecs haven't changed."; | 915 << "Ignoring call to SetRecvCodecs because codecs haven't changed."; |
916 return true; | 916 return true; |
917 } | 917 } |
918 | 918 |
919 LOG(LS_INFO) << "Changing recv codecs from " | 919 LOG(LS_INFO) << "Changing recv codecs from " |
920 << CodecSettingsVectorToString(recv_codecs_) << " to " | 920 << CodecSettingsVectorToString(recv_codecs_) << " to " |
921 << CodecSettingsVectorToString(supported_codecs); | 921 << CodecSettingsVectorToString(supported_codecs); |
922 recv_codecs_ = supported_codecs; | 922 recv_codecs_ = supported_codecs; |
923 | 923 |
924 rtc::CritScope stream_lock(&stream_crit_); | 924 rtc::CritScope stream_lock(&stream_crit_); |
925 for (std::map<uint32, WebRtcVideoReceiveStream*>::iterator it = | 925 for (std::map<uint32_t, WebRtcVideoReceiveStream*>::iterator it = |
926 receive_streams_.begin(); | 926 receive_streams_.begin(); |
927 it != receive_streams_.end(); | 927 it != receive_streams_.end(); ++it) { |
928 ++it) { | |
929 it->second->SetRecvCodecs(recv_codecs_); | 928 it->second->SetRecvCodecs(recv_codecs_); |
930 } | 929 } |
931 | 930 |
932 return true; | 931 return true; |
933 } | 932 } |
934 | 933 |
935 bool WebRtcVideoChannel2::SetSendCodecs(const std::vector<VideoCodec>& codecs) { | 934 bool WebRtcVideoChannel2::SetSendCodecs(const std::vector<VideoCodec>& codecs) { |
936 TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetSendCodecs"); | 935 TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetSendCodecs"); |
937 LOG(LS_INFO) << "SetSendCodecs: " << CodecVectorToString(codecs); | 936 LOG(LS_INFO) << "SetSendCodecs: " << CodecVectorToString(codecs); |
938 if (!ValidateCodecFormats(codecs)) { | 937 if (!ValidateCodecFormats(codecs)) { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 bool WebRtcVideoChannel2::GetSendCodec(VideoCodec* codec) { | 1004 bool WebRtcVideoChannel2::GetSendCodec(VideoCodec* codec) { |
1006 VideoCodecSettings codec_settings; | 1005 VideoCodecSettings codec_settings; |
1007 if (!send_codec_.Get(&codec_settings)) { | 1006 if (!send_codec_.Get(&codec_settings)) { |
1008 LOG(LS_VERBOSE) << "GetSendCodec: No send codec set."; | 1007 LOG(LS_VERBOSE) << "GetSendCodec: No send codec set."; |
1009 return false; | 1008 return false; |
1010 } | 1009 } |
1011 *codec = codec_settings.codec; | 1010 *codec = codec_settings.codec; |
1012 return true; | 1011 return true; |
1013 } | 1012 } |
1014 | 1013 |
1015 bool WebRtcVideoChannel2::SetSendStreamFormat(uint32 ssrc, | 1014 bool WebRtcVideoChannel2::SetSendStreamFormat(uint32_t ssrc, |
1016 const VideoFormat& format) { | 1015 const VideoFormat& format) { |
1017 LOG(LS_VERBOSE) << "SetSendStreamFormat:" << ssrc << " -> " | 1016 LOG(LS_VERBOSE) << "SetSendStreamFormat:" << ssrc << " -> " |
1018 << format.ToString(); | 1017 << format.ToString(); |
1019 rtc::CritScope stream_lock(&stream_crit_); | 1018 rtc::CritScope stream_lock(&stream_crit_); |
1020 if (send_streams_.find(ssrc) == send_streams_.end()) { | 1019 if (send_streams_.find(ssrc) == send_streams_.end()) { |
1021 return false; | 1020 return false; |
1022 } | 1021 } |
1023 return send_streams_[ssrc]->SetVideoFormat(format); | 1022 return send_streams_[ssrc]->SetVideoFormat(format); |
1024 } | 1023 } |
1025 | 1024 |
(...skipping 11 matching lines...) Expand all Loading... |
1037 } | 1036 } |
1038 if (send) { | 1037 if (send) { |
1039 StartAllSendStreams(); | 1038 StartAllSendStreams(); |
1040 } else { | 1039 } else { |
1041 StopAllSendStreams(); | 1040 StopAllSendStreams(); |
1042 } | 1041 } |
1043 sending_ = send; | 1042 sending_ = send; |
1044 return true; | 1043 return true; |
1045 } | 1044 } |
1046 | 1045 |
1047 bool WebRtcVideoChannel2::SetVideoSend(uint32 ssrc, bool mute, | 1046 bool WebRtcVideoChannel2::SetVideoSend(uint32_t ssrc, |
| 1047 bool mute, |
1048 const VideoOptions* options) { | 1048 const VideoOptions* options) { |
1049 // TODO(solenberg): The state change should be fully rolled back if any one of | 1049 // TODO(solenberg): The state change should be fully rolled back if any one of |
1050 // these calls fail. | 1050 // these calls fail. |
1051 if (!MuteStream(ssrc, mute)) { | 1051 if (!MuteStream(ssrc, mute)) { |
1052 return false; | 1052 return false; |
1053 } | 1053 } |
1054 if (!mute && options) { | 1054 if (!mute && options) { |
1055 return SetOptions(*options); | 1055 return SetOptions(*options); |
1056 } else { | 1056 } else { |
1057 return true; | 1057 return true; |
(...skipping 26 matching lines...) Expand all Loading... |
1084 bool WebRtcVideoChannel2::AddSendStream(const StreamParams& sp) { | 1084 bool WebRtcVideoChannel2::AddSendStream(const StreamParams& sp) { |
1085 LOG(LS_INFO) << "AddSendStream: " << sp.ToString(); | 1085 LOG(LS_INFO) << "AddSendStream: " << sp.ToString(); |
1086 if (!ValidateStreamParams(sp)) | 1086 if (!ValidateStreamParams(sp)) |
1087 return false; | 1087 return false; |
1088 | 1088 |
1089 rtc::CritScope stream_lock(&stream_crit_); | 1089 rtc::CritScope stream_lock(&stream_crit_); |
1090 | 1090 |
1091 if (!ValidateSendSsrcAvailability(sp)) | 1091 if (!ValidateSendSsrcAvailability(sp)) |
1092 return false; | 1092 return false; |
1093 | 1093 |
1094 for (uint32 used_ssrc : sp.ssrcs) | 1094 for (uint32_t used_ssrc : sp.ssrcs) |
1095 send_ssrcs_.insert(used_ssrc); | 1095 send_ssrcs_.insert(used_ssrc); |
1096 | 1096 |
1097 webrtc::VideoSendStream::Config config(this); | 1097 webrtc::VideoSendStream::Config config(this); |
1098 config.overuse_callback = this; | 1098 config.overuse_callback = this; |
1099 | 1099 |
1100 WebRtcVideoSendStream* stream = | 1100 WebRtcVideoSendStream* stream = |
1101 new WebRtcVideoSendStream(call_, | 1101 new WebRtcVideoSendStream(call_, |
1102 sp, | 1102 sp, |
1103 config, | 1103 config, |
1104 external_encoder_factory_, | 1104 external_encoder_factory_, |
1105 options_, | 1105 options_, |
1106 bitrate_config_.max_bitrate_bps, | 1106 bitrate_config_.max_bitrate_bps, |
1107 send_codec_, | 1107 send_codec_, |
1108 send_rtp_extensions_); | 1108 send_rtp_extensions_); |
1109 | 1109 |
1110 uint32 ssrc = sp.first_ssrc(); | 1110 uint32_t ssrc = sp.first_ssrc(); |
1111 RTC_DCHECK(ssrc != 0); | 1111 RTC_DCHECK(ssrc != 0); |
1112 send_streams_[ssrc] = stream; | 1112 send_streams_[ssrc] = stream; |
1113 | 1113 |
1114 if (rtcp_receiver_report_ssrc_ == kDefaultRtcpReceiverReportSsrc) { | 1114 if (rtcp_receiver_report_ssrc_ == kDefaultRtcpReceiverReportSsrc) { |
1115 rtcp_receiver_report_ssrc_ = ssrc; | 1115 rtcp_receiver_report_ssrc_ = ssrc; |
1116 LOG(LS_INFO) << "SetLocalSsrc on all the receive streams because we added " | 1116 LOG(LS_INFO) << "SetLocalSsrc on all the receive streams because we added " |
1117 "a send stream."; | 1117 "a send stream."; |
1118 for (auto& kv : receive_streams_) | 1118 for (auto& kv : receive_streams_) |
1119 kv.second->SetLocalSsrc(ssrc); | 1119 kv.second->SetLocalSsrc(ssrc); |
1120 } | 1120 } |
1121 if (default_send_ssrc_ == 0) { | 1121 if (default_send_ssrc_ == 0) { |
1122 default_send_ssrc_ = ssrc; | 1122 default_send_ssrc_ = ssrc; |
1123 } | 1123 } |
1124 if (sending_) { | 1124 if (sending_) { |
1125 stream->Start(); | 1125 stream->Start(); |
1126 } | 1126 } |
1127 | 1127 |
1128 return true; | 1128 return true; |
1129 } | 1129 } |
1130 | 1130 |
1131 bool WebRtcVideoChannel2::RemoveSendStream(uint32 ssrc) { | 1131 bool WebRtcVideoChannel2::RemoveSendStream(uint32_t ssrc) { |
1132 LOG(LS_INFO) << "RemoveSendStream: " << ssrc; | 1132 LOG(LS_INFO) << "RemoveSendStream: " << ssrc; |
1133 | 1133 |
1134 if (ssrc == 0) { | 1134 if (ssrc == 0) { |
1135 if (default_send_ssrc_ == 0) { | 1135 if (default_send_ssrc_ == 0) { |
1136 LOG(LS_ERROR) << "No default send stream active."; | 1136 LOG(LS_ERROR) << "No default send stream active."; |
1137 return false; | 1137 return false; |
1138 } | 1138 } |
1139 | 1139 |
1140 LOG(LS_VERBOSE) << "Removing default stream: " << default_send_ssrc_; | 1140 LOG(LS_VERBOSE) << "Removing default stream: " << default_send_ssrc_; |
1141 ssrc = default_send_ssrc_; | 1141 ssrc = default_send_ssrc_; |
1142 } | 1142 } |
1143 | 1143 |
1144 WebRtcVideoSendStream* removed_stream; | 1144 WebRtcVideoSendStream* removed_stream; |
1145 { | 1145 { |
1146 rtc::CritScope stream_lock(&stream_crit_); | 1146 rtc::CritScope stream_lock(&stream_crit_); |
1147 std::map<uint32, WebRtcVideoSendStream*>::iterator it = | 1147 std::map<uint32_t, WebRtcVideoSendStream*>::iterator it = |
1148 send_streams_.find(ssrc); | 1148 send_streams_.find(ssrc); |
1149 if (it == send_streams_.end()) { | 1149 if (it == send_streams_.end()) { |
1150 return false; | 1150 return false; |
1151 } | 1151 } |
1152 | 1152 |
1153 for (uint32 old_ssrc : it->second->GetSsrcs()) | 1153 for (uint32_t old_ssrc : it->second->GetSsrcs()) |
1154 send_ssrcs_.erase(old_ssrc); | 1154 send_ssrcs_.erase(old_ssrc); |
1155 | 1155 |
1156 removed_stream = it->second; | 1156 removed_stream = it->second; |
1157 send_streams_.erase(it); | 1157 send_streams_.erase(it); |
1158 } | 1158 } |
1159 | 1159 |
1160 delete removed_stream; | 1160 delete removed_stream; |
1161 | 1161 |
1162 if (ssrc == default_send_ssrc_) { | 1162 if (ssrc == default_send_ssrc_) { |
1163 default_send_ssrc_ = 0; | 1163 default_send_ssrc_ = 0; |
1164 } | 1164 } |
1165 | 1165 |
1166 return true; | 1166 return true; |
1167 } | 1167 } |
1168 | 1168 |
1169 void WebRtcVideoChannel2::DeleteReceiveStream( | 1169 void WebRtcVideoChannel2::DeleteReceiveStream( |
1170 WebRtcVideoChannel2::WebRtcVideoReceiveStream* stream) { | 1170 WebRtcVideoChannel2::WebRtcVideoReceiveStream* stream) { |
1171 for (uint32 old_ssrc : stream->GetSsrcs()) | 1171 for (uint32_t old_ssrc : stream->GetSsrcs()) |
1172 receive_ssrcs_.erase(old_ssrc); | 1172 receive_ssrcs_.erase(old_ssrc); |
1173 delete stream; | 1173 delete stream; |
1174 } | 1174 } |
1175 | 1175 |
1176 bool WebRtcVideoChannel2::AddRecvStream(const StreamParams& sp) { | 1176 bool WebRtcVideoChannel2::AddRecvStream(const StreamParams& sp) { |
1177 return AddRecvStream(sp, false); | 1177 return AddRecvStream(sp, false); |
1178 } | 1178 } |
1179 | 1179 |
1180 bool WebRtcVideoChannel2::AddRecvStream(const StreamParams& sp, | 1180 bool WebRtcVideoChannel2::AddRecvStream(const StreamParams& sp, |
1181 bool default_stream) { | 1181 bool default_stream) { |
1182 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 1182 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
1183 | 1183 |
1184 LOG(LS_INFO) << "AddRecvStream" << (default_stream ? " (default stream)" : "") | 1184 LOG(LS_INFO) << "AddRecvStream" << (default_stream ? " (default stream)" : "") |
1185 << ": " << sp.ToString(); | 1185 << ": " << sp.ToString(); |
1186 if (!ValidateStreamParams(sp)) | 1186 if (!ValidateStreamParams(sp)) |
1187 return false; | 1187 return false; |
1188 | 1188 |
1189 uint32 ssrc = sp.first_ssrc(); | 1189 uint32_t ssrc = sp.first_ssrc(); |
1190 RTC_DCHECK(ssrc != 0); // TODO(pbos): Is this ever valid? | 1190 RTC_DCHECK(ssrc != 0); // TODO(pbos): Is this ever valid? |
1191 | 1191 |
1192 rtc::CritScope stream_lock(&stream_crit_); | 1192 rtc::CritScope stream_lock(&stream_crit_); |
1193 // Remove running stream if this was a default stream. | 1193 // Remove running stream if this was a default stream. |
1194 auto prev_stream = receive_streams_.find(ssrc); | 1194 auto prev_stream = receive_streams_.find(ssrc); |
1195 if (prev_stream != receive_streams_.end()) { | 1195 if (prev_stream != receive_streams_.end()) { |
1196 if (default_stream || !prev_stream->second->IsDefaultStream()) { | 1196 if (default_stream || !prev_stream->second->IsDefaultStream()) { |
1197 LOG(LS_ERROR) << "Receive stream for SSRC '" << ssrc | 1197 LOG(LS_ERROR) << "Receive stream for SSRC '" << ssrc |
1198 << "' already exists."; | 1198 << "' already exists."; |
1199 return false; | 1199 return false; |
1200 } | 1200 } |
1201 DeleteReceiveStream(prev_stream->second); | 1201 DeleteReceiveStream(prev_stream->second); |
1202 receive_streams_.erase(prev_stream); | 1202 receive_streams_.erase(prev_stream); |
1203 } | 1203 } |
1204 | 1204 |
1205 if (!ValidateReceiveSsrcAvailability(sp)) | 1205 if (!ValidateReceiveSsrcAvailability(sp)) |
1206 return false; | 1206 return false; |
1207 | 1207 |
1208 for (uint32 used_ssrc : sp.ssrcs) | 1208 for (uint32_t used_ssrc : sp.ssrcs) |
1209 receive_ssrcs_.insert(used_ssrc); | 1209 receive_ssrcs_.insert(used_ssrc); |
1210 | 1210 |
1211 webrtc::VideoReceiveStream::Config config(this); | 1211 webrtc::VideoReceiveStream::Config config(this); |
1212 ConfigureReceiverRtp(&config, sp); | 1212 ConfigureReceiverRtp(&config, sp); |
1213 | 1213 |
1214 // Set up A/V sync group based on sync label. | 1214 // Set up A/V sync group based on sync label. |
1215 config.sync_group = sp.sync_label; | 1215 config.sync_group = sp.sync_label; |
1216 | 1216 |
1217 config.rtp.remb = false; | 1217 config.rtp.remb = false; |
1218 VideoCodecSettings send_codec; | 1218 VideoCodecSettings send_codec; |
1219 if (send_codec_.Get(&send_codec)) { | 1219 if (send_codec_.Get(&send_codec)) { |
1220 config.rtp.remb = HasRemb(send_codec.codec); | 1220 config.rtp.remb = HasRemb(send_codec.codec); |
1221 } | 1221 } |
1222 | 1222 |
1223 receive_streams_[ssrc] = new WebRtcVideoReceiveStream( | 1223 receive_streams_[ssrc] = new WebRtcVideoReceiveStream( |
1224 call_, sp, config, external_decoder_factory_, default_stream, | 1224 call_, sp, config, external_decoder_factory_, default_stream, |
1225 recv_codecs_); | 1225 recv_codecs_); |
1226 | 1226 |
1227 return true; | 1227 return true; |
1228 } | 1228 } |
1229 | 1229 |
1230 void WebRtcVideoChannel2::ConfigureReceiverRtp( | 1230 void WebRtcVideoChannel2::ConfigureReceiverRtp( |
1231 webrtc::VideoReceiveStream::Config* config, | 1231 webrtc::VideoReceiveStream::Config* config, |
1232 const StreamParams& sp) const { | 1232 const StreamParams& sp) const { |
1233 uint32 ssrc = sp.first_ssrc(); | 1233 uint32_t ssrc = sp.first_ssrc(); |
1234 | 1234 |
1235 config->rtp.remote_ssrc = ssrc; | 1235 config->rtp.remote_ssrc = ssrc; |
1236 config->rtp.local_ssrc = rtcp_receiver_report_ssrc_; | 1236 config->rtp.local_ssrc = rtcp_receiver_report_ssrc_; |
1237 | 1237 |
1238 config->rtp.extensions = recv_rtp_extensions_; | 1238 config->rtp.extensions = recv_rtp_extensions_; |
1239 | 1239 |
1240 // TODO(pbos): This protection is against setting the same local ssrc as | 1240 // TODO(pbos): This protection is against setting the same local ssrc as |
1241 // remote which is not permitted by the lower-level API. RTCP requires a | 1241 // remote which is not permitted by the lower-level API. RTCP requires a |
1242 // corresponding sender SSRC. Figure out what to do when we don't have | 1242 // corresponding sender SSRC. Figure out what to do when we don't have |
1243 // (receive-only) or know a good local SSRC. | 1243 // (receive-only) or know a good local SSRC. |
1244 if (config->rtp.remote_ssrc == config->rtp.local_ssrc) { | 1244 if (config->rtp.remote_ssrc == config->rtp.local_ssrc) { |
1245 if (config->rtp.local_ssrc != kDefaultRtcpReceiverReportSsrc) { | 1245 if (config->rtp.local_ssrc != kDefaultRtcpReceiverReportSsrc) { |
1246 config->rtp.local_ssrc = kDefaultRtcpReceiverReportSsrc; | 1246 config->rtp.local_ssrc = kDefaultRtcpReceiverReportSsrc; |
1247 } else { | 1247 } else { |
1248 config->rtp.local_ssrc = kDefaultRtcpReceiverReportSsrc + 1; | 1248 config->rtp.local_ssrc = kDefaultRtcpReceiverReportSsrc + 1; |
1249 } | 1249 } |
1250 } | 1250 } |
1251 | 1251 |
1252 for (size_t i = 0; i < recv_codecs_.size(); ++i) { | 1252 for (size_t i = 0; i < recv_codecs_.size(); ++i) { |
1253 MergeFecConfig(recv_codecs_[i].fec, &config->rtp.fec); | 1253 MergeFecConfig(recv_codecs_[i].fec, &config->rtp.fec); |
1254 } | 1254 } |
1255 | 1255 |
1256 for (size_t i = 0; i < recv_codecs_.size(); ++i) { | 1256 for (size_t i = 0; i < recv_codecs_.size(); ++i) { |
1257 uint32 rtx_ssrc; | 1257 uint32_t rtx_ssrc; |
1258 if (recv_codecs_[i].rtx_payload_type != -1 && | 1258 if (recv_codecs_[i].rtx_payload_type != -1 && |
1259 sp.GetFidSsrc(ssrc, &rtx_ssrc)) { | 1259 sp.GetFidSsrc(ssrc, &rtx_ssrc)) { |
1260 webrtc::VideoReceiveStream::Config::Rtp::Rtx& rtx = | 1260 webrtc::VideoReceiveStream::Config::Rtp::Rtx& rtx = |
1261 config->rtp.rtx[recv_codecs_[i].codec.id]; | 1261 config->rtp.rtx[recv_codecs_[i].codec.id]; |
1262 rtx.ssrc = rtx_ssrc; | 1262 rtx.ssrc = rtx_ssrc; |
1263 rtx.payload_type = recv_codecs_[i].rtx_payload_type; | 1263 rtx.payload_type = recv_codecs_[i].rtx_payload_type; |
1264 } | 1264 } |
1265 } | 1265 } |
1266 } | 1266 } |
1267 | 1267 |
1268 bool WebRtcVideoChannel2::RemoveRecvStream(uint32 ssrc) { | 1268 bool WebRtcVideoChannel2::RemoveRecvStream(uint32_t ssrc) { |
1269 LOG(LS_INFO) << "RemoveRecvStream: " << ssrc; | 1269 LOG(LS_INFO) << "RemoveRecvStream: " << ssrc; |
1270 if (ssrc == 0) { | 1270 if (ssrc == 0) { |
1271 LOG(LS_ERROR) << "RemoveRecvStream with 0 ssrc is not supported."; | 1271 LOG(LS_ERROR) << "RemoveRecvStream with 0 ssrc is not supported."; |
1272 return false; | 1272 return false; |
1273 } | 1273 } |
1274 | 1274 |
1275 rtc::CritScope stream_lock(&stream_crit_); | 1275 rtc::CritScope stream_lock(&stream_crit_); |
1276 std::map<uint32, WebRtcVideoReceiveStream*>::iterator stream = | 1276 std::map<uint32_t, WebRtcVideoReceiveStream*>::iterator stream = |
1277 receive_streams_.find(ssrc); | 1277 receive_streams_.find(ssrc); |
1278 if (stream == receive_streams_.end()) { | 1278 if (stream == receive_streams_.end()) { |
1279 LOG(LS_ERROR) << "Stream not found for ssrc: " << ssrc; | 1279 LOG(LS_ERROR) << "Stream not found for ssrc: " << ssrc; |
1280 return false; | 1280 return false; |
1281 } | 1281 } |
1282 DeleteReceiveStream(stream->second); | 1282 DeleteReceiveStream(stream->second); |
1283 receive_streams_.erase(stream); | 1283 receive_streams_.erase(stream); |
1284 | 1284 |
1285 return true; | 1285 return true; |
1286 } | 1286 } |
1287 | 1287 |
1288 bool WebRtcVideoChannel2::SetRenderer(uint32 ssrc, VideoRenderer* renderer) { | 1288 bool WebRtcVideoChannel2::SetRenderer(uint32_t ssrc, VideoRenderer* renderer) { |
1289 LOG(LS_INFO) << "SetRenderer: ssrc:" << ssrc << " " | 1289 LOG(LS_INFO) << "SetRenderer: ssrc:" << ssrc << " " |
1290 << (renderer ? "(ptr)" : "NULL"); | 1290 << (renderer ? "(ptr)" : "NULL"); |
1291 if (ssrc == 0) { | 1291 if (ssrc == 0) { |
1292 default_unsignalled_ssrc_handler_.SetDefaultRenderer(this, renderer); | 1292 default_unsignalled_ssrc_handler_.SetDefaultRenderer(this, renderer); |
1293 return true; | 1293 return true; |
1294 } | 1294 } |
1295 | 1295 |
1296 rtc::CritScope stream_lock(&stream_crit_); | 1296 rtc::CritScope stream_lock(&stream_crit_); |
1297 std::map<uint32, WebRtcVideoReceiveStream*>::iterator it = | 1297 std::map<uint32_t, WebRtcVideoReceiveStream*>::iterator it = |
1298 receive_streams_.find(ssrc); | 1298 receive_streams_.find(ssrc); |
1299 if (it == receive_streams_.end()) { | 1299 if (it == receive_streams_.end()) { |
1300 return false; | 1300 return false; |
1301 } | 1301 } |
1302 | 1302 |
1303 it->second->SetRenderer(renderer); | 1303 it->second->SetRenderer(renderer); |
1304 return true; | 1304 return true; |
1305 } | 1305 } |
1306 | 1306 |
1307 bool WebRtcVideoChannel2::GetRenderer(uint32 ssrc, VideoRenderer** renderer) { | 1307 bool WebRtcVideoChannel2::GetRenderer(uint32_t ssrc, VideoRenderer** renderer) { |
1308 if (ssrc == 0) { | 1308 if (ssrc == 0) { |
1309 *renderer = default_unsignalled_ssrc_handler_.GetDefaultRenderer(); | 1309 *renderer = default_unsignalled_ssrc_handler_.GetDefaultRenderer(); |
1310 return *renderer != NULL; | 1310 return *renderer != NULL; |
1311 } | 1311 } |
1312 | 1312 |
1313 rtc::CritScope stream_lock(&stream_crit_); | 1313 rtc::CritScope stream_lock(&stream_crit_); |
1314 std::map<uint32, WebRtcVideoReceiveStream*>::iterator it = | 1314 std::map<uint32_t, WebRtcVideoReceiveStream*>::iterator it = |
1315 receive_streams_.find(ssrc); | 1315 receive_streams_.find(ssrc); |
1316 if (it == receive_streams_.end()) { | 1316 if (it == receive_streams_.end()) { |
1317 return false; | 1317 return false; |
1318 } | 1318 } |
1319 *renderer = it->second->GetRenderer(); | 1319 *renderer = it->second->GetRenderer(); |
1320 return true; | 1320 return true; |
1321 } | 1321 } |
1322 | 1322 |
1323 bool WebRtcVideoChannel2::GetStats(VideoMediaInfo* info) { | 1323 bool WebRtcVideoChannel2::GetStats(VideoMediaInfo* info) { |
1324 info->Clear(); | 1324 info->Clear(); |
1325 FillSenderStats(info); | 1325 FillSenderStats(info); |
1326 FillReceiverStats(info); | 1326 FillReceiverStats(info); |
1327 webrtc::Call::Stats stats = call_->GetStats(); | 1327 webrtc::Call::Stats stats = call_->GetStats(); |
1328 FillBandwidthEstimationStats(stats, info); | 1328 FillBandwidthEstimationStats(stats, info); |
1329 if (stats.rtt_ms != -1) { | 1329 if (stats.rtt_ms != -1) { |
1330 for (size_t i = 0; i < info->senders.size(); ++i) { | 1330 for (size_t i = 0; i < info->senders.size(); ++i) { |
1331 info->senders[i].rtt_ms = stats.rtt_ms; | 1331 info->senders[i].rtt_ms = stats.rtt_ms; |
1332 } | 1332 } |
1333 } | 1333 } |
1334 return true; | 1334 return true; |
1335 } | 1335 } |
1336 | 1336 |
1337 void WebRtcVideoChannel2::FillSenderStats(VideoMediaInfo* video_media_info) { | 1337 void WebRtcVideoChannel2::FillSenderStats(VideoMediaInfo* video_media_info) { |
1338 rtc::CritScope stream_lock(&stream_crit_); | 1338 rtc::CritScope stream_lock(&stream_crit_); |
1339 for (std::map<uint32, WebRtcVideoSendStream*>::iterator it = | 1339 for (std::map<uint32_t, WebRtcVideoSendStream*>::iterator it = |
1340 send_streams_.begin(); | 1340 send_streams_.begin(); |
1341 it != send_streams_.end(); | 1341 it != send_streams_.end(); ++it) { |
1342 ++it) { | |
1343 video_media_info->senders.push_back(it->second->GetVideoSenderInfo()); | 1342 video_media_info->senders.push_back(it->second->GetVideoSenderInfo()); |
1344 } | 1343 } |
1345 } | 1344 } |
1346 | 1345 |
1347 void WebRtcVideoChannel2::FillReceiverStats(VideoMediaInfo* video_media_info) { | 1346 void WebRtcVideoChannel2::FillReceiverStats(VideoMediaInfo* video_media_info) { |
1348 rtc::CritScope stream_lock(&stream_crit_); | 1347 rtc::CritScope stream_lock(&stream_crit_); |
1349 for (std::map<uint32, WebRtcVideoReceiveStream*>::iterator it = | 1348 for (std::map<uint32_t, WebRtcVideoReceiveStream*>::iterator it = |
1350 receive_streams_.begin(); | 1349 receive_streams_.begin(); |
1351 it != receive_streams_.end(); | 1350 it != receive_streams_.end(); ++it) { |
1352 ++it) { | |
1353 video_media_info->receivers.push_back(it->second->GetVideoReceiverInfo()); | 1351 video_media_info->receivers.push_back(it->second->GetVideoReceiverInfo()); |
1354 } | 1352 } |
1355 } | 1353 } |
1356 | 1354 |
1357 void WebRtcVideoChannel2::FillBandwidthEstimationStats( | 1355 void WebRtcVideoChannel2::FillBandwidthEstimationStats( |
1358 const webrtc::Call::Stats& stats, | 1356 const webrtc::Call::Stats& stats, |
1359 VideoMediaInfo* video_media_info) { | 1357 VideoMediaInfo* video_media_info) { |
1360 BandwidthEstimationInfo bwe_info; | 1358 BandwidthEstimationInfo bwe_info; |
1361 bwe_info.available_send_bandwidth = stats.send_bandwidth_bps; | 1359 bwe_info.available_send_bandwidth = stats.send_bandwidth_bps; |
1362 bwe_info.available_recv_bandwidth = stats.recv_bandwidth_bps; | 1360 bwe_info.available_recv_bandwidth = stats.recv_bandwidth_bps; |
1363 bwe_info.bucket_delay = stats.pacer_delay_ms; | 1361 bwe_info.bucket_delay = stats.pacer_delay_ms; |
1364 | 1362 |
1365 // Get send stream bitrate stats. | 1363 // Get send stream bitrate stats. |
1366 rtc::CritScope stream_lock(&stream_crit_); | 1364 rtc::CritScope stream_lock(&stream_crit_); |
1367 for (std::map<uint32, WebRtcVideoSendStream*>::iterator stream = | 1365 for (std::map<uint32_t, WebRtcVideoSendStream*>::iterator stream = |
1368 send_streams_.begin(); | 1366 send_streams_.begin(); |
1369 stream != send_streams_.end(); | 1367 stream != send_streams_.end(); ++stream) { |
1370 ++stream) { | |
1371 stream->second->FillBandwidthEstimationInfo(&bwe_info); | 1368 stream->second->FillBandwidthEstimationInfo(&bwe_info); |
1372 } | 1369 } |
1373 video_media_info->bw_estimations.push_back(bwe_info); | 1370 video_media_info->bw_estimations.push_back(bwe_info); |
1374 } | 1371 } |
1375 | 1372 |
1376 bool WebRtcVideoChannel2::SetCapturer(uint32 ssrc, VideoCapturer* capturer) { | 1373 bool WebRtcVideoChannel2::SetCapturer(uint32_t ssrc, VideoCapturer* capturer) { |
1377 LOG(LS_INFO) << "SetCapturer: " << ssrc << " -> " | 1374 LOG(LS_INFO) << "SetCapturer: " << ssrc << " -> " |
1378 << (capturer != NULL ? "(capturer)" : "NULL"); | 1375 << (capturer != NULL ? "(capturer)" : "NULL"); |
1379 RTC_DCHECK(ssrc != 0); | 1376 RTC_DCHECK(ssrc != 0); |
1380 { | 1377 { |
1381 rtc::CritScope stream_lock(&stream_crit_); | 1378 rtc::CritScope stream_lock(&stream_crit_); |
1382 if (send_streams_.find(ssrc) == send_streams_.end()) { | 1379 if (send_streams_.find(ssrc) == send_streams_.end()) { |
1383 LOG(LS_ERROR) << "No sending stream on ssrc " << ssrc; | 1380 LOG(LS_ERROR) << "No sending stream on ssrc " << ssrc; |
1384 return false; | 1381 return false; |
1385 } | 1382 } |
1386 if (!send_streams_[ssrc]->SetCapturer(capturer)) { | 1383 if (!send_streams_[ssrc]->SetCapturer(capturer)) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1424 webrtc_packet_time); | 1421 webrtc_packet_time); |
1425 switch (delivery_result) { | 1422 switch (delivery_result) { |
1426 case webrtc::PacketReceiver::DELIVERY_OK: | 1423 case webrtc::PacketReceiver::DELIVERY_OK: |
1427 return; | 1424 return; |
1428 case webrtc::PacketReceiver::DELIVERY_PACKET_ERROR: | 1425 case webrtc::PacketReceiver::DELIVERY_PACKET_ERROR: |
1429 return; | 1426 return; |
1430 case webrtc::PacketReceiver::DELIVERY_UNKNOWN_SSRC: | 1427 case webrtc::PacketReceiver::DELIVERY_UNKNOWN_SSRC: |
1431 break; | 1428 break; |
1432 } | 1429 } |
1433 | 1430 |
1434 uint32 ssrc = 0; | 1431 uint32_t ssrc = 0; |
1435 if (!GetRtpSsrc(packet->data(), packet->size(), &ssrc)) { | 1432 if (!GetRtpSsrc(packet->data(), packet->size(), &ssrc)) { |
1436 return; | 1433 return; |
1437 } | 1434 } |
1438 | 1435 |
1439 int payload_type = 0; | 1436 int payload_type = 0; |
1440 if (!GetRtpPayloadType(packet->data(), packet->size(), &payload_type)) { | 1437 if (!GetRtpPayloadType(packet->data(), packet->size(), &payload_type)) { |
1441 return; | 1438 return; |
1442 } | 1439 } |
1443 | 1440 |
1444 // See if this payload_type is registered as one that usually gets its own | 1441 // 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... |
1481 webrtc_packet_time) != webrtc::PacketReceiver::DELIVERY_OK) { | 1478 webrtc_packet_time) != webrtc::PacketReceiver::DELIVERY_OK) { |
1482 LOG(LS_WARNING) << "Failed to deliver RTCP packet."; | 1479 LOG(LS_WARNING) << "Failed to deliver RTCP packet."; |
1483 } | 1480 } |
1484 } | 1481 } |
1485 | 1482 |
1486 void WebRtcVideoChannel2::OnReadyToSend(bool ready) { | 1483 void WebRtcVideoChannel2::OnReadyToSend(bool ready) { |
1487 LOG(LS_VERBOSE) << "OnReadyToSend: " << (ready ? "Ready." : "Not ready."); | 1484 LOG(LS_VERBOSE) << "OnReadyToSend: " << (ready ? "Ready." : "Not ready."); |
1488 call_->SignalNetworkState(ready ? webrtc::kNetworkUp : webrtc::kNetworkDown); | 1485 call_->SignalNetworkState(ready ? webrtc::kNetworkUp : webrtc::kNetworkDown); |
1489 } | 1486 } |
1490 | 1487 |
1491 bool WebRtcVideoChannel2::MuteStream(uint32 ssrc, bool mute) { | 1488 bool WebRtcVideoChannel2::MuteStream(uint32_t ssrc, bool mute) { |
1492 LOG(LS_VERBOSE) << "MuteStream: " << ssrc << " -> " | 1489 LOG(LS_VERBOSE) << "MuteStream: " << ssrc << " -> " |
1493 << (mute ? "mute" : "unmute"); | 1490 << (mute ? "mute" : "unmute"); |
1494 RTC_DCHECK(ssrc != 0); | 1491 RTC_DCHECK(ssrc != 0); |
1495 rtc::CritScope stream_lock(&stream_crit_); | 1492 rtc::CritScope stream_lock(&stream_crit_); |
1496 if (send_streams_.find(ssrc) == send_streams_.end()) { | 1493 if (send_streams_.find(ssrc) == send_streams_.end()) { |
1497 LOG(LS_ERROR) << "No sending stream on ssrc " << ssrc; | 1494 LOG(LS_ERROR) << "No sending stream on ssrc " << ssrc; |
1498 return false; | 1495 return false; |
1499 } | 1496 } |
1500 | 1497 |
1501 send_streams_[ssrc]->MuteStream(mute); | 1498 send_streams_[ssrc]->MuteStream(mute); |
(...skipping 12 matching lines...) Expand all Loading... |
1514 FilterRtpExtensions(extensions); | 1511 FilterRtpExtensions(extensions); |
1515 if (!RtpExtensionsHaveChanged(recv_rtp_extensions_, filtered_extensions)) { | 1512 if (!RtpExtensionsHaveChanged(recv_rtp_extensions_, filtered_extensions)) { |
1516 LOG(LS_INFO) << "Ignoring call to SetRecvRtpHeaderExtensions because " | 1513 LOG(LS_INFO) << "Ignoring call to SetRecvRtpHeaderExtensions because " |
1517 "header extensions haven't changed."; | 1514 "header extensions haven't changed."; |
1518 return true; | 1515 return true; |
1519 } | 1516 } |
1520 | 1517 |
1521 recv_rtp_extensions_ = filtered_extensions; | 1518 recv_rtp_extensions_ = filtered_extensions; |
1522 | 1519 |
1523 rtc::CritScope stream_lock(&stream_crit_); | 1520 rtc::CritScope stream_lock(&stream_crit_); |
1524 for (std::map<uint32, WebRtcVideoReceiveStream*>::iterator it = | 1521 for (std::map<uint32_t, WebRtcVideoReceiveStream*>::iterator it = |
1525 receive_streams_.begin(); | 1522 receive_streams_.begin(); |
1526 it != receive_streams_.end(); | 1523 it != receive_streams_.end(); ++it) { |
1527 ++it) { | |
1528 it->second->SetRtpExtensions(recv_rtp_extensions_); | 1524 it->second->SetRtpExtensions(recv_rtp_extensions_); |
1529 } | 1525 } |
1530 return true; | 1526 return true; |
1531 } | 1527 } |
1532 | 1528 |
1533 bool WebRtcVideoChannel2::SetSendRtpHeaderExtensions( | 1529 bool WebRtcVideoChannel2::SetSendRtpHeaderExtensions( |
1534 const std::vector<RtpHeaderExtension>& extensions) { | 1530 const std::vector<RtpHeaderExtension>& extensions) { |
1535 TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetSendRtpHeaderExtensions"); | 1531 TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetSendRtpHeaderExtensions"); |
1536 LOG(LS_INFO) << "SetSendRtpHeaderExtensions: " | 1532 LOG(LS_INFO) << "SetSendRtpHeaderExtensions: " |
1537 << RtpExtensionsToString(extensions); | 1533 << RtpExtensionsToString(extensions); |
1538 if (!ValidateRtpHeaderExtensionIds(extensions)) | 1534 if (!ValidateRtpHeaderExtensionIds(extensions)) |
1539 return false; | 1535 return false; |
1540 | 1536 |
1541 std::vector<webrtc::RtpExtension> filtered_extensions = | 1537 std::vector<webrtc::RtpExtension> filtered_extensions = |
1542 FilterRtpExtensions(extensions); | 1538 FilterRtpExtensions(extensions); |
1543 if (!RtpExtensionsHaveChanged(send_rtp_extensions_, filtered_extensions)) { | 1539 if (!RtpExtensionsHaveChanged(send_rtp_extensions_, filtered_extensions)) { |
1544 LOG(LS_INFO) << "Ignoring call to SetSendRtpHeaderExtensions because " | 1540 LOG(LS_INFO) << "Ignoring call to SetSendRtpHeaderExtensions because " |
1545 "header extensions haven't changed."; | 1541 "header extensions haven't changed."; |
1546 return true; | 1542 return true; |
1547 } | 1543 } |
1548 | 1544 |
1549 send_rtp_extensions_ = filtered_extensions; | 1545 send_rtp_extensions_ = filtered_extensions; |
1550 | 1546 |
1551 const webrtc::RtpExtension* cvo_extension = FindHeaderExtension( | 1547 const webrtc::RtpExtension* cvo_extension = FindHeaderExtension( |
1552 send_rtp_extensions_, kRtpVideoRotationHeaderExtension); | 1548 send_rtp_extensions_, kRtpVideoRotationHeaderExtension); |
1553 | 1549 |
1554 rtc::CritScope stream_lock(&stream_crit_); | 1550 rtc::CritScope stream_lock(&stream_crit_); |
1555 for (std::map<uint32, WebRtcVideoSendStream*>::iterator it = | 1551 for (std::map<uint32_t, WebRtcVideoSendStream*>::iterator it = |
1556 send_streams_.begin(); | 1552 send_streams_.begin(); |
1557 it != send_streams_.end(); | 1553 it != send_streams_.end(); ++it) { |
1558 ++it) { | |
1559 it->second->SetRtpExtensions(send_rtp_extensions_); | 1554 it->second->SetRtpExtensions(send_rtp_extensions_); |
1560 it->second->SetApplyRotation(!cvo_extension); | 1555 it->second->SetApplyRotation(!cvo_extension); |
1561 } | 1556 } |
1562 return true; | 1557 return true; |
1563 } | 1558 } |
1564 | 1559 |
1565 // Counter-intuitively this method doesn't only set global bitrate caps but also | 1560 // Counter-intuitively this method doesn't only set global bitrate caps but also |
1566 // per-stream codec max bitrates. This is to permit SetMaxSendBitrate (b=AS) to | 1561 // per-stream codec max bitrates. This is to permit SetMaxSendBitrate (b=AS) to |
1567 // raise bitrates above the 2000k default bitrate cap. | 1562 // raise bitrates above the 2000k default bitrate cap. |
1568 bool WebRtcVideoChannel2::SetMaxSendBandwidth(int max_bitrate_bps) { | 1563 bool WebRtcVideoChannel2::SetMaxSendBandwidth(int max_bitrate_bps) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1606 } | 1601 } |
1607 { | 1602 { |
1608 rtc::CritScope lock(&capturer_crit_); | 1603 rtc::CritScope lock(&capturer_crit_); |
1609 options_.cpu_overuse_detection.Get(&signal_cpu_adaptation_); | 1604 options_.cpu_overuse_detection.Get(&signal_cpu_adaptation_); |
1610 } | 1605 } |
1611 rtc::DiffServCodePoint dscp = options_.dscp.GetWithDefaultIfUnset(false) | 1606 rtc::DiffServCodePoint dscp = options_.dscp.GetWithDefaultIfUnset(false) |
1612 ? rtc::DSCP_AF41 | 1607 ? rtc::DSCP_AF41 |
1613 : rtc::DSCP_DEFAULT; | 1608 : rtc::DSCP_DEFAULT; |
1614 MediaChannel::SetDscp(dscp); | 1609 MediaChannel::SetDscp(dscp); |
1615 rtc::CritScope stream_lock(&stream_crit_); | 1610 rtc::CritScope stream_lock(&stream_crit_); |
1616 for (std::map<uint32, WebRtcVideoSendStream*>::iterator it = | 1611 for (std::map<uint32_t, WebRtcVideoSendStream*>::iterator it = |
1617 send_streams_.begin(); | 1612 send_streams_.begin(); |
1618 it != send_streams_.end(); | 1613 it != send_streams_.end(); ++it) { |
1619 ++it) { | |
1620 it->second->SetOptions(options_); | 1614 it->second->SetOptions(options_); |
1621 } | 1615 } |
1622 return true; | 1616 return true; |
1623 } | 1617 } |
1624 | 1618 |
1625 void WebRtcVideoChannel2::SetInterface(NetworkInterface* iface) { | 1619 void WebRtcVideoChannel2::SetInterface(NetworkInterface* iface) { |
1626 MediaChannel::SetInterface(iface); | 1620 MediaChannel::SetInterface(iface); |
1627 // Set the RTP recv/send buffer to a bigger size | 1621 // Set the RTP recv/send buffer to a bigger size |
1628 MediaChannel::SetOption(NetworkInterface::ST_RTP, | 1622 MediaChannel::SetOption(NetworkInterface::ST_RTP, |
1629 rtc::Socket::OPT_RCVBUF, | 1623 rtc::Socket::OPT_RCVBUF, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1671 return MediaChannel::SendPacket(&packet); | 1665 return MediaChannel::SendPacket(&packet); |
1672 } | 1666 } |
1673 | 1667 |
1674 bool WebRtcVideoChannel2::SendRtcp(const uint8_t* data, size_t len) { | 1668 bool WebRtcVideoChannel2::SendRtcp(const uint8_t* data, size_t len) { |
1675 rtc::Buffer packet(data, len, kMaxRtpPacketLen); | 1669 rtc::Buffer packet(data, len, kMaxRtpPacketLen); |
1676 return MediaChannel::SendRtcp(&packet); | 1670 return MediaChannel::SendRtcp(&packet); |
1677 } | 1671 } |
1678 | 1672 |
1679 void WebRtcVideoChannel2::StartAllSendStreams() { | 1673 void WebRtcVideoChannel2::StartAllSendStreams() { |
1680 rtc::CritScope stream_lock(&stream_crit_); | 1674 rtc::CritScope stream_lock(&stream_crit_); |
1681 for (std::map<uint32, WebRtcVideoSendStream*>::iterator it = | 1675 for (std::map<uint32_t, WebRtcVideoSendStream*>::iterator it = |
1682 send_streams_.begin(); | 1676 send_streams_.begin(); |
1683 it != send_streams_.end(); | 1677 it != send_streams_.end(); ++it) { |
1684 ++it) { | |
1685 it->second->Start(); | 1678 it->second->Start(); |
1686 } | 1679 } |
1687 } | 1680 } |
1688 | 1681 |
1689 void WebRtcVideoChannel2::StopAllSendStreams() { | 1682 void WebRtcVideoChannel2::StopAllSendStreams() { |
1690 rtc::CritScope stream_lock(&stream_crit_); | 1683 rtc::CritScope stream_lock(&stream_crit_); |
1691 for (std::map<uint32, WebRtcVideoSendStream*>::iterator it = | 1684 for (std::map<uint32_t, WebRtcVideoSendStream*>::iterator it = |
1692 send_streams_.begin(); | 1685 send_streams_.begin(); |
1693 it != send_streams_.end(); | 1686 it != send_streams_.end(); ++it) { |
1694 ++it) { | |
1695 it->second->Stop(); | 1687 it->second->Stop(); |
1696 } | 1688 } |
1697 } | 1689 } |
1698 | 1690 |
1699 WebRtcVideoChannel2::WebRtcVideoSendStream::VideoSendStreamParameters:: | 1691 WebRtcVideoChannel2::WebRtcVideoSendStream::VideoSendStreamParameters:: |
1700 VideoSendStreamParameters( | 1692 VideoSendStreamParameters( |
1701 const webrtc::VideoSendStream::Config& config, | 1693 const webrtc::VideoSendStream::Config& config, |
1702 const VideoOptions& options, | 1694 const VideoOptions& options, |
1703 int max_bitrate_bps, | 1695 int max_bitrate_bps, |
1704 const Settable<VideoCodecSettings>& codec_settings) | 1696 const Settable<VideoCodecSettings>& codec_settings) |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1909 if (capturer_->video_adapter() != nullptr) | 1901 if (capturer_->video_adapter() != nullptr) |
1910 old_adapt_changes_ += capturer_->video_adapter()->adaptation_changes(); | 1902 old_adapt_changes_ += capturer_->video_adapter()->adaptation_changes(); |
1911 | 1903 |
1912 capturer = capturer_; | 1904 capturer = capturer_; |
1913 capturer_ = NULL; | 1905 capturer_ = NULL; |
1914 } | 1906 } |
1915 capturer->SignalVideoFrame.disconnect(this); | 1907 capturer->SignalVideoFrame.disconnect(this); |
1916 return true; | 1908 return true; |
1917 } | 1909 } |
1918 | 1910 |
1919 const std::vector<uint32>& | 1911 const std::vector<uint32_t>& |
1920 WebRtcVideoChannel2::WebRtcVideoSendStream::GetSsrcs() const { | 1912 WebRtcVideoChannel2::WebRtcVideoSendStream::GetSsrcs() const { |
1921 return ssrcs_; | 1913 return ssrcs_; |
1922 } | 1914 } |
1923 | 1915 |
1924 void WebRtcVideoChannel2::WebRtcVideoSendStream::SetApplyRotation( | 1916 void WebRtcVideoChannel2::WebRtcVideoSendStream::SetApplyRotation( |
1925 bool apply_rotation) { | 1917 bool apply_rotation) { |
1926 rtc::CritScope cs(&lock_); | 1918 rtc::CritScope cs(&lock_); |
1927 if (capturer_ == NULL) | 1919 if (capturer_ == NULL) |
1928 return; | 1920 return; |
1929 | 1921 |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2372 this->decoder = | 2364 this->decoder = |
2373 new webrtc::VideoDecoderSoftwareFallbackWrapper(type, external_decoder); | 2365 new webrtc::VideoDecoderSoftwareFallbackWrapper(type, external_decoder); |
2374 } | 2366 } |
2375 } | 2367 } |
2376 | 2368 |
2377 WebRtcVideoChannel2::WebRtcVideoReceiveStream::~WebRtcVideoReceiveStream() { | 2369 WebRtcVideoChannel2::WebRtcVideoReceiveStream::~WebRtcVideoReceiveStream() { |
2378 call_->DestroyVideoReceiveStream(stream_); | 2370 call_->DestroyVideoReceiveStream(stream_); |
2379 ClearDecoders(&allocated_decoders_); | 2371 ClearDecoders(&allocated_decoders_); |
2380 } | 2372 } |
2381 | 2373 |
2382 const std::vector<uint32>& | 2374 const std::vector<uint32_t>& |
2383 WebRtcVideoChannel2::WebRtcVideoReceiveStream::GetSsrcs() const { | 2375 WebRtcVideoChannel2::WebRtcVideoReceiveStream::GetSsrcs() const { |
2384 return ssrcs_; | 2376 return ssrcs_; |
2385 } | 2377 } |
2386 | 2378 |
2387 WebRtcVideoChannel2::WebRtcVideoReceiveStream::AllocatedDecoder | 2379 WebRtcVideoChannel2::WebRtcVideoReceiveStream::AllocatedDecoder |
2388 WebRtcVideoChannel2::WebRtcVideoReceiveStream::CreateOrReuseVideoDecoder( | 2380 WebRtcVideoChannel2::WebRtcVideoReceiveStream::CreateOrReuseVideoDecoder( |
2389 std::vector<AllocatedDecoder>* old_decoders, | 2381 std::vector<AllocatedDecoder>* old_decoders, |
2390 const VideoCodec& codec) { | 2382 const VideoCodec& codec) { |
2391 webrtc::VideoCodecType type = CodecTypeFromName(codec.name); | 2383 webrtc::VideoCodecType type = CodecTypeFromName(codec.name); |
2392 | 2384 |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2745 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2737 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
2746 } | 2738 } |
2747 } | 2739 } |
2748 | 2740 |
2749 return video_codecs; | 2741 return video_codecs; |
2750 } | 2742 } |
2751 | 2743 |
2752 } // namespace cricket | 2744 } // namespace cricket |
2753 | 2745 |
2754 #endif // HAVE_WEBRTC_VIDEO | 2746 #endif // HAVE_WEBRTC_VIDEO |
OLD | NEW |