Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: talk/media/webrtc/webrtcvideoengine2.cc

Issue 1291673006: Disallow simulcast for non-vp8. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: small unit test change (LE->EQ for stream count) Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | talk/media/webrtc/webrtcvideoengine2_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 if (other.red_rtx_payload_type != -1) { 296 if (other.red_rtx_payload_type != -1) {
297 if (output->red_rtx_payload_type != -1 && 297 if (output->red_rtx_payload_type != -1 &&
298 output->red_rtx_payload_type != other.red_rtx_payload_type) { 298 output->red_rtx_payload_type != other.red_rtx_payload_type) {
299 LOG(LS_WARNING) << "Conflict merging red_rtx_payload_type configs: " 299 LOG(LS_WARNING) << "Conflict merging red_rtx_payload_type configs: "
300 << output->red_rtx_payload_type << " and " 300 << output->red_rtx_payload_type << " and "
301 << other.red_rtx_payload_type; 301 << other.red_rtx_payload_type;
302 } 302 }
303 output->red_rtx_payload_type = other.red_rtx_payload_type; 303 output->red_rtx_payload_type = other.red_rtx_payload_type;
304 } 304 }
305 } 305 }
306
307 // Returns true if the given codec is disallowed from doing simulcast.
308 bool IsCodecBlacklistedForSimulcast(const std::string& codec_name) {
309 return CodecNamesEq(codec_name, kH264CodecName);
310 }
311
306 } // namespace 312 } // namespace
307 313
308 // Constants defined in talk/media/webrtc/constants.h 314 // Constants defined in talk/media/webrtc/constants.h
309 // TODO(pbos): Move these to a separate constants.cc file. 315 // TODO(pbos): Move these to a separate constants.cc file.
310 const int kMinVideoBitrate = 30; 316 const int kMinVideoBitrate = 30;
311 const int kStartVideoBitrate = 300; 317 const int kStartVideoBitrate = 300;
312 const int kMaxVideoBitrate = 2000; 318 const int kMaxVideoBitrate = 2000;
313 319
314 const int kVideoMtu = 1200; 320 const int kVideoMtu = 1200;
315 const int kVideoRtpBufferSize = 65536; 321 const int kVideoRtpBufferSize = 65536;
(...skipping 1776 matching lines...) Expand 10 before | Expand all | Expand 10 after
2092 if (codec.width < width) 2098 if (codec.width < width)
2093 width = codec.width; 2099 width = codec.width;
2094 if (codec.height < height) 2100 if (codec.height < height)
2095 height = codec.height; 2101 height = codec.height;
2096 } 2102 }
2097 2103
2098 VideoCodec clamped_codec = codec; 2104 VideoCodec clamped_codec = codec;
2099 clamped_codec.width = width; 2105 clamped_codec.width = width;
2100 clamped_codec.height = height; 2106 clamped_codec.height = height;
2101 2107
2102 encoder_config.streams = CreateVideoStreams( 2108 // By default, the stream count for the codec configuration should match the
2103 clamped_codec, parameters_.options, parameters_.max_bitrate_bps, 2109 // number of negotiated ssrcs. But if the codec is blacklisted for simulcast
2104 dimensions.is_screencast ? 1 : parameters_.config.rtp.ssrcs.size()); 2110 // or a screencast, only configure a single stream.
2111 size_t stream_count = parameters_.config.rtp.ssrcs.size();
2112 if (IsCodecBlacklistedForSimulcast(codec.name) || dimensions.is_screencast) {
2113 stream_count = 1;
2114 }
2115
2116 encoder_config.streams =
2117 CreateVideoStreams(clamped_codec, parameters_.options,
2118 parameters_.max_bitrate_bps, stream_count);
2105 2119
2106 // Conference mode screencast uses 2 temporal layers split at 100kbit. 2120 // Conference mode screencast uses 2 temporal layers split at 100kbit.
2107 if (parameters_.options.conference_mode.GetWithDefaultIfUnset(false) && 2121 if (parameters_.options.conference_mode.GetWithDefaultIfUnset(false) &&
2108 dimensions.is_screencast && encoder_config.streams.size() == 1) { 2122 dimensions.is_screencast && encoder_config.streams.size() == 1) {
2109 ScreenshareLayerConfig config = ScreenshareLayerConfig::GetDefault(); 2123 ScreenshareLayerConfig config = ScreenshareLayerConfig::GetDefault();
2110 2124
2111 // For screenshare in conference mode, tl0 and tl1 bitrates are piggybacked 2125 // For screenshare in conference mode, tl0 and tl1 bitrates are piggybacked
2112 // on the VideoCodec struct as target and max bitrates, respectively. 2126 // on the VideoCodec struct as target and max bitrates, respectively.
2113 // See eg. webrtc::VP8EncoderImpl::SetRates(). 2127 // See eg. webrtc::VP8EncoderImpl::SetRates().
2114 encoder_config.streams[0].target_bitrate_bps = 2128 encoder_config.streams[0].target_bitrate_bps =
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
2722 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; 2736 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id];
2723 } 2737 }
2724 } 2738 }
2725 2739
2726 return video_codecs; 2740 return video_codecs;
2727 } 2741 }
2728 2742
2729 } // namespace cricket 2743 } // namespace cricket
2730 2744
2731 #endif // HAVE_WEBRTC_VIDEO 2745 #endif // HAVE_WEBRTC_VIDEO
OLDNEW
« no previous file with comments | « no previous file | talk/media/webrtc/webrtcvideoengine2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698