| 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 2234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 ssrcs_; |
| 2251 } | 2251 } |
| 2252 | 2252 |
| 2253 WebRtcVideoChannel2::WebRtcVideoReceiveStream::AllocatedDecoder | 2253 WebRtcVideoChannel2::WebRtcVideoReceiveStream::AllocatedDecoder |
| 2254 WebRtcVideoChannel2::WebRtcVideoReceiveStream::CreateOrReuseVideoDecoder( | 2254 WebRtcVideoChannel2::WebRtcVideoReceiveStream::CreateOrReuseVideoDecoder( |
| 2255 uint32_t ssrc, |
| 2255 std::vector<AllocatedDecoder>* old_decoders, | 2256 std::vector<AllocatedDecoder>* old_decoders, |
| 2256 const VideoCodec& codec) { | 2257 const VideoCodec& codec) { |
| 2257 webrtc::VideoCodecType type = CodecTypeFromName(codec.name); | 2258 webrtc::VideoCodecType type = CodecTypeFromName(codec.name); |
| 2258 | 2259 |
| 2259 for (size_t i = 0; i < old_decoders->size(); ++i) { | 2260 for (size_t i = 0; i < old_decoders->size(); ++i) { |
| 2260 if ((*old_decoders)[i].type == type) { | 2261 if ((*old_decoders)[i].type == type) { |
| 2261 AllocatedDecoder decoder = (*old_decoders)[i]; | 2262 AllocatedDecoder decoder = (*old_decoders)[i]; |
| 2262 (*old_decoders)[i] = old_decoders->back(); | 2263 (*old_decoders)[i] = old_decoders->back(); |
| 2263 old_decoders->pop_back(); | 2264 old_decoders->pop_back(); |
| 2264 return decoder; | 2265 return decoder; |
| 2265 } | 2266 } |
| 2266 } | 2267 } |
| 2267 | 2268 |
| 2268 if (external_decoder_factory_ != NULL) { | 2269 if (external_decoder_factory_ != NULL) { |
| 2269 webrtc::VideoDecoder* decoder = | 2270 webrtc::VideoDecoder* decoder = |
| 2270 external_decoder_factory_->CreateVideoDecoder(type); | 2271 external_decoder_factory_->CreateVideoDecoderForSsrc(ssrc, type); |
| 2271 if (decoder != NULL) { | 2272 if (decoder != NULL) { |
| 2272 return AllocatedDecoder(decoder, type, true); | 2273 return AllocatedDecoder(decoder, type, true); |
| 2273 } | 2274 } |
| 2274 } | 2275 } |
| 2275 | 2276 |
| 2276 if (type == webrtc::kVideoCodecVP8) { | 2277 if (type == webrtc::kVideoCodecVP8) { |
| 2277 return AllocatedDecoder( | 2278 return AllocatedDecoder( |
| 2278 webrtc::VideoDecoder::Create(webrtc::VideoDecoder::kVp8), type, false); | 2279 webrtc::VideoDecoder::Create(webrtc::VideoDecoder::kVp8), type, false); |
| 2279 } | 2280 } |
| 2280 | 2281 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2293 webrtc::kVideoCodecUnknown, false); | 2294 webrtc::kVideoCodecUnknown, false); |
| 2294 } | 2295 } |
| 2295 | 2296 |
| 2296 void WebRtcVideoChannel2::WebRtcVideoReceiveStream::ConfigureCodecs( | 2297 void WebRtcVideoChannel2::WebRtcVideoReceiveStream::ConfigureCodecs( |
| 2297 const std::vector<VideoCodecSettings>& recv_codecs, | 2298 const std::vector<VideoCodecSettings>& recv_codecs, |
| 2298 std::vector<AllocatedDecoder>* old_decoders) { | 2299 std::vector<AllocatedDecoder>* old_decoders) { |
| 2299 *old_decoders = allocated_decoders_; | 2300 *old_decoders = allocated_decoders_; |
| 2300 allocated_decoders_.clear(); | 2301 allocated_decoders_.clear(); |
| 2301 config_.decoders.clear(); | 2302 config_.decoders.clear(); |
| 2302 for (size_t i = 0; i < recv_codecs.size(); ++i) { | 2303 for (size_t i = 0; i < recv_codecs.size(); ++i) { |
| 2304 uint32_t ssrc = ssrcs_.empty() ? 0 : ssrcs_[0]; |
| 2303 AllocatedDecoder allocated_decoder = | 2305 AllocatedDecoder allocated_decoder = |
| 2304 CreateOrReuseVideoDecoder(old_decoders, recv_codecs[i].codec); | 2306 CreateOrReuseVideoDecoder(ssrc, old_decoders, recv_codecs[i].codec); |
| 2305 allocated_decoders_.push_back(allocated_decoder); | 2307 allocated_decoders_.push_back(allocated_decoder); |
| 2306 | 2308 |
| 2307 webrtc::VideoReceiveStream::Decoder decoder; | 2309 webrtc::VideoReceiveStream::Decoder decoder; |
| 2308 decoder.decoder = allocated_decoder.decoder; | 2310 decoder.decoder = allocated_decoder.decoder; |
| 2309 decoder.payload_type = recv_codecs[i].codec.id; | 2311 decoder.payload_type = recv_codecs[i].codec.id; |
| 2310 decoder.payload_name = recv_codecs[i].codec.name; | 2312 decoder.payload_name = recv_codecs[i].codec.name; |
| 2311 config_.decoders.push_back(decoder); | 2313 config_.decoders.push_back(decoder); |
| 2312 } | 2314 } |
| 2313 | 2315 |
| 2314 // TODO(pbos): Reconfigure RTX based on incoming recv_codecs. | 2316 // TODO(pbos): Reconfigure RTX based on incoming recv_codecs. |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2613 rtx_mapping[video_codecs[i].codec.id] != | 2615 rtx_mapping[video_codecs[i].codec.id] != |
| 2614 fec_settings.red_payload_type) { | 2616 fec_settings.red_payload_type) { |
| 2615 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2617 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
| 2616 } | 2618 } |
| 2617 } | 2619 } |
| 2618 | 2620 |
| 2619 return video_codecs; | 2621 return video_codecs; |
| 2620 } | 2622 } |
| 2621 | 2623 |
| 2622 } // namespace cricket | 2624 } // namespace cricket |
| OLD | NEW |