Fix code to handle crashes for non-VP8.

Unit tests will be submitted Monday, submitting this part to get the
Android bots green.

BUG=1667, 1788
R=glaznev@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/44789004

Cr-Commit-Position: refs/heads/master@{#8811}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8811 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pbos@webrtc.org
2015-03-20 19:52:56 +00:00
parent b6817d793f
commit b9557a9bb7
2 changed files with 32 additions and 3 deletions

View File

@@ -1587,7 +1587,13 @@ void WebRtcVideoChannel2::WebRtcVideoSendStream::SetCodecAndOptions(
// Set RTX payload type if RTX is enabled.
if (!parameters_.config.rtp.rtx.ssrcs.empty()) {
parameters_.config.rtp.rtx.payload_type = codec_settings.rtx_payload_type;
if (codec_settings.rtx_payload_type == -1) {
LOG(LS_WARNING) << "RTX SSRCs configured but there's no configured RTX "
"payload type. Ignoring.";
parameters_.config.rtp.rtx.ssrcs.clear();
} else {
parameters_.config.rtp.rtx.payload_type = codec_settings.rtx_payload_type;
}
}
if (IsNackEnabled(codec_settings.codec)) {
@@ -1843,8 +1849,13 @@ void WebRtcVideoChannel2::WebRtcVideoSendStream::RecreateWebRtcStream() {
parameters_.encoder_config.encoder_specific_settings =
ConfigureVideoEncoderSettings(codec_settings.codec, parameters_.options);
stream_ = call_->CreateVideoSendStream(parameters_.config,
parameters_.encoder_config);
webrtc::VideoSendStream::Config config = parameters_.config;
if (!config.rtp.rtx.ssrcs.empty() && config.rtp.rtx.payload_type == -1) {
LOG(LS_WARNING) << "RTX SSRCs configured but there's no configured RTX "
"payload type the set codec. Ignoring RTX.";
config.rtp.rtx.ssrcs.clear();
}
stream_ = call_->CreateVideoSendStream(config, parameters_.encoder_config);
parameters_.encoder_config.encoder_specific_settings = NULL;
@@ -1907,6 +1918,11 @@ WebRtcVideoChannel2::WebRtcVideoReceiveStream::CreateOrReuseVideoDecoder(
webrtc::VideoDecoder::Create(webrtc::VideoDecoder::kVp8), type, false);
}
if (type == webrtc::kVideoCodecVP9) {
return AllocatedDecoder(
webrtc::VideoDecoder::Create(webrtc::VideoDecoder::kVp9), type, false);
}
// This shouldn't happen, we should not be trying to create something we don't
// support.
assert(false);

View File

@@ -349,6 +349,19 @@ bool VideoSendStream::ReconfigureVideoEncoder(
video_codec.codecSpecific.VP8.numberOfTemporalLayers =
static_cast<unsigned char>(
streams.back().temporal_layer_thresholds_bps.size() + 1);
} else if (video_codec.codecType == kVideoCodecVP9) {
if (config.encoder_specific_settings != NULL) {
video_codec.codecSpecific.VP9 = *reinterpret_cast<const VideoCodecVP9*>(
config.encoder_specific_settings);
}
video_codec.codecSpecific.VP9.numberOfTemporalLayers =
static_cast<unsigned char>(
streams.back().temporal_layer_thresholds_bps.size() + 1);
} else if (video_codec.codecType == kVideoCodecH264) {
if (config.encoder_specific_settings != NULL) {
video_codec.codecSpecific.H264 = *reinterpret_cast<const VideoCodecH264*>(
config.encoder_specific_settings);
}
} else {
// TODO(pbos): Support encoder_settings codec-agnostically.
assert(config.encoder_specific_settings == NULL);