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 2136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2147 external(external) { | 2147 external(external) { |
2148 if (external) { | 2148 if (external) { |
2149 external_decoder = decoder; | 2149 external_decoder = decoder; |
2150 this->decoder = | 2150 this->decoder = |
2151 new webrtc::VideoDecoderSoftwareFallbackWrapper(type, external_decoder); | 2151 new webrtc::VideoDecoderSoftwareFallbackWrapper(type, external_decoder); |
2152 } | 2152 } |
2153 } | 2153 } |
2154 | 2154 |
2155 WebRtcVideoChannel::WebRtcVideoReceiveStream::~WebRtcVideoReceiveStream() { | 2155 WebRtcVideoChannel::WebRtcVideoReceiveStream::~WebRtcVideoReceiveStream() { |
2156 if (flexfec_stream_) { | 2156 if (flexfec_stream_) { |
| 2157 MaybeDissociateFlexfecFromVideo(); |
2157 call_->DestroyFlexfecReceiveStream(flexfec_stream_); | 2158 call_->DestroyFlexfecReceiveStream(flexfec_stream_); |
2158 } | 2159 } |
2159 call_->DestroyVideoReceiveStream(stream_); | 2160 call_->DestroyVideoReceiveStream(stream_); |
2160 ClearDecoders(&allocated_decoders_); | 2161 ClearDecoders(&allocated_decoders_); |
2161 } | 2162 } |
2162 | 2163 |
2163 const std::vector<uint32_t>& | 2164 const std::vector<uint32_t>& |
2164 WebRtcVideoChannel::WebRtcVideoReceiveStream::GetSsrcs() const { | 2165 WebRtcVideoChannel::WebRtcVideoReceiveStream::GetSsrcs() const { |
2165 return stream_params_.ssrcs; | 2166 return stream_params_.ssrcs; |
2166 } | 2167 } |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2327 LOG(LS_INFO) | 2328 LOG(LS_INFO) |
2328 << "RecreateWebRtcVideoStream (recv) because of SetRecvParameters"; | 2329 << "RecreateWebRtcVideoStream (recv) because of SetRecvParameters"; |
2329 RecreateWebRtcVideoStream(); | 2330 RecreateWebRtcVideoStream(); |
2330 ClearDecoders(&old_decoders); | 2331 ClearDecoders(&old_decoders); |
2331 } | 2332 } |
2332 } | 2333 } |
2333 | 2334 |
2334 void WebRtcVideoChannel::WebRtcVideoReceiveStream:: | 2335 void WebRtcVideoChannel::WebRtcVideoReceiveStream:: |
2335 RecreateWebRtcVideoStream() { | 2336 RecreateWebRtcVideoStream() { |
2336 if (stream_) { | 2337 if (stream_) { |
| 2338 MaybeDissociateFlexfecFromVideo(); |
2337 call_->DestroyVideoReceiveStream(stream_); | 2339 call_->DestroyVideoReceiveStream(stream_); |
2338 stream_ = nullptr; | 2340 stream_ = nullptr; |
2339 } | 2341 } |
2340 webrtc::VideoReceiveStream::Config config = config_.Copy(); | 2342 webrtc::VideoReceiveStream::Config config = config_.Copy(); |
2341 config.rtp.protected_by_flexfec = (flexfec_stream_ != nullptr); | 2343 config.rtp.protected_by_flexfec = (flexfec_stream_ != nullptr); |
2342 stream_ = call_->CreateVideoReceiveStream(std::move(config)); | 2344 stream_ = call_->CreateVideoReceiveStream(std::move(config)); |
| 2345 MaybeAssociateFlexfecWithVideo(); |
2343 stream_->Start(); | 2346 stream_->Start(); |
2344 } | 2347 } |
2345 | 2348 |
2346 void WebRtcVideoChannel::WebRtcVideoReceiveStream:: | 2349 void WebRtcVideoChannel::WebRtcVideoReceiveStream:: |
2347 MaybeRecreateWebRtcFlexfecStream() { | 2350 MaybeRecreateWebRtcFlexfecStream() { |
2348 if (flexfec_stream_) { | 2351 if (flexfec_stream_) { |
| 2352 MaybeDissociateFlexfecFromVideo(); |
2349 call_->DestroyFlexfecReceiveStream(flexfec_stream_); | 2353 call_->DestroyFlexfecReceiveStream(flexfec_stream_); |
2350 flexfec_stream_ = nullptr; | 2354 flexfec_stream_ = nullptr; |
2351 } | 2355 } |
2352 if (flexfec_config_.IsCompleteAndEnabled()) { | 2356 if (flexfec_config_.IsCompleteAndEnabled()) { |
2353 flexfec_stream_ = call_->CreateFlexfecReceiveStream(flexfec_config_); | 2357 flexfec_stream_ = call_->CreateFlexfecReceiveStream(flexfec_config_); |
2354 flexfec_stream_->Start(); | 2358 flexfec_stream_->Start(); |
| 2359 MaybeAssociateFlexfecWithVideo(); |
2355 } | 2360 } |
2356 } | 2361 } |
2357 | 2362 |
| 2363 void WebRtcVideoChannel::WebRtcVideoReceiveStream:: |
| 2364 MaybeAssociateFlexfecWithVideo() { |
| 2365 if (stream_ && flexfec_stream_) { |
| 2366 stream_->AddSecondarySink(flexfec_stream_); |
| 2367 } |
| 2368 } |
| 2369 |
| 2370 void WebRtcVideoChannel::WebRtcVideoReceiveStream:: |
| 2371 MaybeDissociateFlexfecFromVideo() { |
| 2372 if (stream_ && flexfec_stream_) { |
| 2373 stream_->RemoveSecondarySink(flexfec_stream_); |
| 2374 } |
| 2375 } |
| 2376 |
2358 void WebRtcVideoChannel::WebRtcVideoReceiveStream::ClearDecoders( | 2377 void WebRtcVideoChannel::WebRtcVideoReceiveStream::ClearDecoders( |
2359 std::vector<AllocatedDecoder>* allocated_decoders) { | 2378 std::vector<AllocatedDecoder>* allocated_decoders) { |
2360 for (size_t i = 0; i < allocated_decoders->size(); ++i) { | 2379 for (size_t i = 0; i < allocated_decoders->size(); ++i) { |
2361 if ((*allocated_decoders)[i].external) { | 2380 if ((*allocated_decoders)[i].external) { |
2362 external_decoder_factory_->DestroyVideoDecoder( | 2381 external_decoder_factory_->DestroyVideoDecoder( |
2363 (*allocated_decoders)[i].external_decoder); | 2382 (*allocated_decoders)[i].external_decoder); |
2364 } | 2383 } |
2365 delete (*allocated_decoders)[i].decoder; | 2384 delete (*allocated_decoders)[i].decoder; |
2366 } | 2385 } |
2367 allocated_decoders->clear(); | 2386 allocated_decoders->clear(); |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2641 stream.temporal_layer_thresholds_bps.resize(GetDefaultVp9TemporalLayers() - | 2660 stream.temporal_layer_thresholds_bps.resize(GetDefaultVp9TemporalLayers() - |
2642 1); | 2661 1); |
2643 } | 2662 } |
2644 | 2663 |
2645 std::vector<webrtc::VideoStream> streams; | 2664 std::vector<webrtc::VideoStream> streams; |
2646 streams.push_back(stream); | 2665 streams.push_back(stream); |
2647 return streams; | 2666 return streams; |
2648 } | 2667 } |
2649 | 2668 |
2650 } // namespace cricket | 2669 } // namespace cricket |
OLD | NEW |