Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 912 LOG(LS_WARNING) << "Attempting to get RTP receive parameters for stream " | 912 LOG(LS_WARNING) << "Attempting to get RTP receive parameters for stream " |
| 913 << "with ssrc " << ssrc << " which doesn't exist."; | 913 << "with ssrc " << ssrc << " which doesn't exist."; |
| 914 return webrtc::RtpParameters(); | 914 return webrtc::RtpParameters(); |
| 915 } | 915 } |
| 916 | 916 |
| 917 // TODO(deadbeef): Return stream-specific parameters. | 917 // TODO(deadbeef): Return stream-specific parameters. |
| 918 webrtc::RtpParameters rtp_params = CreateRtpParametersWithOneEncoding(); | 918 webrtc::RtpParameters rtp_params = CreateRtpParametersWithOneEncoding(); |
| 919 for (const VideoCodec& codec : recv_params_.codecs) { | 919 for (const VideoCodec& codec : recv_params_.codecs) { |
| 920 rtp_params.codecs.push_back(codec.ToCodecParameters()); | 920 rtp_params.codecs.push_back(codec.ToCodecParameters()); |
| 921 } | 921 } |
| 922 rtp_params.encodings[0].ssrc = it->second->GetPrimarySsrc(); | |
| 922 return rtp_params; | 923 return rtp_params; |
| 923 } | 924 } |
| 924 | 925 |
| 925 bool WebRtcVideoChannel2::SetRtpReceiveParameters( | 926 bool WebRtcVideoChannel2::SetRtpReceiveParameters( |
| 926 uint32_t ssrc, | 927 uint32_t ssrc, |
| 927 const webrtc::RtpParameters& parameters) { | 928 const webrtc::RtpParameters& parameters) { |
| 928 TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetRtpReceiveParameters"); | 929 TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetRtpReceiveParameters"); |
| 929 rtc::CritScope stream_lock(&stream_crit_); | 930 rtc::CritScope stream_lock(&stream_crit_); |
| 930 auto it = receive_streams_.find(ssrc); | 931 auto it = receive_streams_.find(ssrc); |
| 931 if (it == receive_streams_.end()) { | 932 if (it == receive_streams_.end()) { |
| (...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2199 | 2200 |
| 2200 WebRtcVideoChannel2::WebRtcVideoReceiveStream::WebRtcVideoReceiveStream( | 2201 WebRtcVideoChannel2::WebRtcVideoReceiveStream::WebRtcVideoReceiveStream( |
| 2201 webrtc::Call* call, | 2202 webrtc::Call* call, |
| 2202 const StreamParams& sp, | 2203 const StreamParams& sp, |
| 2203 webrtc::VideoReceiveStream::Config config, | 2204 webrtc::VideoReceiveStream::Config config, |
| 2204 WebRtcVideoDecoderFactory* external_decoder_factory, | 2205 WebRtcVideoDecoderFactory* external_decoder_factory, |
| 2205 bool default_stream, | 2206 bool default_stream, |
| 2206 const std::vector<VideoCodecSettings>& recv_codecs, | 2207 const std::vector<VideoCodecSettings>& recv_codecs, |
| 2207 bool red_disabled_by_remote_side) | 2208 bool red_disabled_by_remote_side) |
| 2208 : call_(call), | 2209 : call_(call), |
| 2209 ssrcs_(sp.ssrcs), | 2210 stream_params_(sp), |
|
sakal
2016/06/16 09:33:59
Since we are storing so many variables from Stream
| |
| 2210 ssrc_groups_(sp.ssrc_groups), | |
| 2211 stream_(NULL), | 2211 stream_(NULL), |
| 2212 default_stream_(default_stream), | 2212 default_stream_(default_stream), |
| 2213 config_(std::move(config)), | 2213 config_(std::move(config)), |
| 2214 red_disabled_by_remote_side_(red_disabled_by_remote_side), | 2214 red_disabled_by_remote_side_(red_disabled_by_remote_side), |
| 2215 external_decoder_factory_(external_decoder_factory), | 2215 external_decoder_factory_(external_decoder_factory), |
| 2216 sink_(NULL), | 2216 sink_(NULL), |
| 2217 last_width_(-1), | 2217 last_width_(-1), |
| 2218 last_height_(-1), | 2218 last_height_(-1), |
| 2219 first_frame_timestamp_(-1), | 2219 first_frame_timestamp_(-1), |
| 2220 estimated_remote_start_ntp_time_ms_(0) { | 2220 estimated_remote_start_ntp_time_ms_(0) { |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 2240 } | 2240 } |
| 2241 } | 2241 } |
| 2242 | 2242 |
| 2243 WebRtcVideoChannel2::WebRtcVideoReceiveStream::~WebRtcVideoReceiveStream() { | 2243 WebRtcVideoChannel2::WebRtcVideoReceiveStream::~WebRtcVideoReceiveStream() { |
| 2244 call_->DestroyVideoReceiveStream(stream_); | 2244 call_->DestroyVideoReceiveStream(stream_); |
| 2245 ClearDecoders(&allocated_decoders_); | 2245 ClearDecoders(&allocated_decoders_); |
| 2246 } | 2246 } |
| 2247 | 2247 |
| 2248 const std::vector<uint32_t>& | 2248 const std::vector<uint32_t>& |
| 2249 WebRtcVideoChannel2::WebRtcVideoReceiveStream::GetSsrcs() const { | 2249 WebRtcVideoChannel2::WebRtcVideoReceiveStream::GetSsrcs() const { |
| 2250 return ssrcs_; | 2250 return stream_params_.ssrcs; |
| 2251 } | |
| 2252 | |
| 2253 uint32_t WebRtcVideoChannel2::WebRtcVideoReceiveStream::GetPrimarySsrc() const { | |
| 2254 std::vector<uint32_t> primary_ssrcs_; | |
|
perkj_webrtc
2016/06/16 13:28:28
nit: This is a local variable and should be named
sakal
2016/06/16 14:29:07
Done.
| |
| 2255 stream_params_.GetPrimarySsrcs(&primary_ssrcs_); | |
| 2256 | |
| 2257 if (primary_ssrcs_.empty()) { | |
| 2258 LOG(LS_WARNING) << "Empty primary ssrcs vector, returning 0"; | |
| 2259 return 0; | |
|
sakal
2016/06/16 09:33:59
I am not sure if this should ever happen.
| |
| 2260 } else { | |
| 2261 return primary_ssrcs_[0]; | |
|
sakal
2016/06/16 09:33:59
I am not sure if receiving side ever has multiple
| |
| 2262 } | |
| 2251 } | 2263 } |
| 2252 | 2264 |
| 2253 WebRtcVideoChannel2::WebRtcVideoReceiveStream::AllocatedDecoder | 2265 WebRtcVideoChannel2::WebRtcVideoReceiveStream::AllocatedDecoder |
| 2254 WebRtcVideoChannel2::WebRtcVideoReceiveStream::CreateOrReuseVideoDecoder( | 2266 WebRtcVideoChannel2::WebRtcVideoReceiveStream::CreateOrReuseVideoDecoder( |
| 2255 std::vector<AllocatedDecoder>* old_decoders, | 2267 std::vector<AllocatedDecoder>* old_decoders, |
| 2256 const VideoCodec& codec) { | 2268 const VideoCodec& codec) { |
| 2257 webrtc::VideoCodecType type = CodecTypeFromName(codec.name); | 2269 webrtc::VideoCodecType type = CodecTypeFromName(codec.name); |
| 2258 | 2270 |
| 2259 for (size_t i = 0; i < old_decoders->size(); ++i) { | 2271 for (size_t i = 0; i < old_decoders->size(); ++i) { |
| 2260 if ((*old_decoders)[i].type == type) { | 2272 if ((*old_decoders)[i].type == type) { |
| 2261 AllocatedDecoder decoder = (*old_decoders)[i]; | 2273 AllocatedDecoder decoder = (*old_decoders)[i]; |
| 2262 (*old_decoders)[i] = old_decoders->back(); | 2274 (*old_decoders)[i] = old_decoders->back(); |
| 2263 old_decoders->pop_back(); | 2275 old_decoders->pop_back(); |
| 2264 return decoder; | 2276 return decoder; |
| 2265 } | 2277 } |
| 2266 } | 2278 } |
| 2267 | 2279 |
| 2268 if (external_decoder_factory_ != NULL) { | 2280 if (external_decoder_factory_ != NULL) { |
| 2269 webrtc::VideoDecoder* decoder = | 2281 webrtc::VideoDecoder* decoder = |
| 2270 external_decoder_factory_->CreateVideoDecoder(type); | 2282 external_decoder_factory_->CreateVideoDecoderWithParams(type, |
| 2283 { stream_params_.id }); | |
| 2271 if (decoder != NULL) { | 2284 if (decoder != NULL) { |
| 2272 return AllocatedDecoder(decoder, type, true); | 2285 return AllocatedDecoder(decoder, type, true); |
| 2273 } | 2286 } |
| 2274 } | 2287 } |
| 2275 | 2288 |
| 2276 if (type == webrtc::kVideoCodecVP8) { | 2289 if (type == webrtc::kVideoCodecVP8) { |
| 2277 return AllocatedDecoder( | 2290 return AllocatedDecoder( |
| 2278 webrtc::VideoDecoder::Create(webrtc::VideoDecoder::kVp8), type, false); | 2291 webrtc::VideoDecoder::Create(webrtc::VideoDecoder::kVp8), type, false); |
| 2279 } | 2292 } |
| 2280 | 2293 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2454 if (decoder.payload_type == payload_type) { | 2467 if (decoder.payload_type == payload_type) { |
| 2455 return decoder.payload_name; | 2468 return decoder.payload_name; |
| 2456 } | 2469 } |
| 2457 } | 2470 } |
| 2458 return ""; | 2471 return ""; |
| 2459 } | 2472 } |
| 2460 | 2473 |
| 2461 VideoReceiverInfo | 2474 VideoReceiverInfo |
| 2462 WebRtcVideoChannel2::WebRtcVideoReceiveStream::GetVideoReceiverInfo() { | 2475 WebRtcVideoChannel2::WebRtcVideoReceiveStream::GetVideoReceiverInfo() { |
| 2463 VideoReceiverInfo info; | 2476 VideoReceiverInfo info; |
| 2464 info.ssrc_groups = ssrc_groups_; | 2477 info.ssrc_groups = stream_params_.ssrc_groups; |
| 2465 info.add_ssrc(config_.rtp.remote_ssrc); | 2478 info.add_ssrc(config_.rtp.remote_ssrc); |
| 2466 webrtc::VideoReceiveStream::Stats stats = stream_->GetStats(); | 2479 webrtc::VideoReceiveStream::Stats stats = stream_->GetStats(); |
| 2467 info.decoder_implementation_name = stats.decoder_implementation_name; | 2480 info.decoder_implementation_name = stats.decoder_implementation_name; |
| 2468 info.bytes_rcvd = stats.rtp_stats.transmitted.payload_bytes + | 2481 info.bytes_rcvd = stats.rtp_stats.transmitted.payload_bytes + |
| 2469 stats.rtp_stats.transmitted.header_bytes + | 2482 stats.rtp_stats.transmitted.header_bytes + |
| 2470 stats.rtp_stats.transmitted.padding_bytes; | 2483 stats.rtp_stats.transmitted.padding_bytes; |
| 2471 info.packets_rcvd = stats.rtp_stats.transmitted.packets; | 2484 info.packets_rcvd = stats.rtp_stats.transmitted.packets; |
| 2472 info.packets_lost = stats.rtcp_stats.cumulative_lost; | 2485 info.packets_lost = stats.rtcp_stats.cumulative_lost; |
| 2473 info.fraction_lost = | 2486 info.fraction_lost = |
| 2474 static_cast<float>(stats.rtcp_stats.fraction_lost) / (1 << 8); | 2487 static_cast<float>(stats.rtcp_stats.fraction_lost) / (1 << 8); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2613 rtx_mapping[video_codecs[i].codec.id] != | 2626 rtx_mapping[video_codecs[i].codec.id] != |
| 2614 fec_settings.red_payload_type) { | 2627 fec_settings.red_payload_type) { |
| 2615 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2628 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
| 2616 } | 2629 } |
| 2617 } | 2630 } |
| 2618 | 2631 |
| 2619 return video_codecs; | 2632 return video_codecs; |
| 2620 } | 2633 } |
| 2621 | 2634 |
| 2622 } // namespace cricket | 2635 } // namespace cricket |
| OLD | NEW |