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