Index: webrtc/modules/video_coding/video_codec_initializer.cc |
diff --git a/webrtc/modules/video_coding/video_codec_initializer.cc b/webrtc/modules/video_coding/video_codec_initializer.cc |
index c759e84a36d8bd19db81cff0af6e291d2f204daa..df8f1365419dc4d405b3c4f556a505c4cf194312 100644 |
--- a/webrtc/modules/video_coding/video_codec_initializer.cc |
+++ b/webrtc/modules/video_coding/video_codec_initializer.cc |
@@ -22,6 +22,15 @@ |
#include "webrtc/system_wrappers/include/clock.h" |
namespace webrtc { |
+namespace { |
+bool TemporalLayersConfigured(const std::vector<VideoStream>& streams) { |
+ for (const VideoStream& stream : streams) { |
+ if (stream.temporal_layer_thresholds_bps.size() > 0) |
+ return true; |
+ } |
+ return false; |
+} |
+} // namespace |
bool VideoCodecInitializer::SetupCodec( |
const VideoEncoderConfig& config, |
@@ -121,12 +130,8 @@ VideoCodec VideoCodecInitializer::VideoEncoderConfigToVideoCodec( |
*video_codec.VP8() = VideoEncoder::GetDefaultVp8Settings(); |
video_codec.VP8()->numberOfTemporalLayers = static_cast<unsigned char>( |
streams.back().temporal_layer_thresholds_bps.size() + 1); |
- bool temporal_layers_configured = false; |
- for (const VideoStream& stream : streams) { |
- if (stream.temporal_layer_thresholds_bps.size() > 0) |
- temporal_layers_configured = true; |
- } |
- if (nack_enabled && !temporal_layers_configured) { |
+ |
+ if (nack_enabled && !TemporalLayersConfigured(streams)) { |
LOG(LS_INFO) << "No temporal layers and nack enabled -> resilience off"; |
video_codec.VP8()->resilience = kResilienceOff; |
} |
@@ -144,6 +149,13 @@ VideoCodec VideoCodecInitializer::VideoEncoderConfigToVideoCodec( |
} |
video_codec.VP9()->numberOfTemporalLayers = static_cast<unsigned char>( |
streams.back().temporal_layer_thresholds_bps.size() + 1); |
+ |
+ if (nack_enabled && !TemporalLayersConfigured(streams) && |
+ video_codec.VP9()->numberOfSpatialLayers == 1) { |
+ LOG(LS_INFO) << "No temporal or spatial layers and nack enabled -> " |
+ << "resilience off"; |
+ video_codec.VP9()->resilienceOn = false; |
+ } |
break; |
} |
case kVideoCodecH264: { |