| OLD | NEW |
| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 // Multiway: Number of temporal layers for each simulcast stream, for maximum | 69 // Multiway: Number of temporal layers for each simulcast stream, for maximum |
| 70 // possible number of simulcast streams |kMaxSimulcastStreams|. The array | 70 // possible number of simulcast streams |kMaxSimulcastStreams|. The array |
| 71 // goes from lowest resolution at position 0 to highest resolution. | 71 // goes from lowest resolution at position 0 to highest resolution. |
| 72 // For example, first three elements correspond to say: QVGA, VGA, WHD. | 72 // For example, first three elements correspond to say: QVGA, VGA, WHD. |
| 73 static const int | 73 static const int |
| 74 kDefaultConferenceNumberOfTemporalLayers[webrtc::kMaxSimulcastStreams] = | 74 kDefaultConferenceNumberOfTemporalLayers[webrtc::kMaxSimulcastStreams] = |
| 75 {3, 3, 3, 3}; | 75 {3, 3, 3, 3}; |
| 76 | 76 |
| 77 void GetSimulcastSsrcs(const StreamParams& sp, std::vector<uint32>* ssrcs) { | 77 void GetSimulcastSsrcs(const StreamParams& sp, std::vector<uint32_t>* ssrcs) { |
| 78 const SsrcGroup* sim_group = sp.get_ssrc_group(kSimSsrcGroupSemantics); | 78 const SsrcGroup* sim_group = sp.get_ssrc_group(kSimSsrcGroupSemantics); |
| 79 if (sim_group) { | 79 if (sim_group) { |
| 80 ssrcs->insert( | 80 ssrcs->insert( |
| 81 ssrcs->end(), sim_group->ssrcs.begin(), sim_group->ssrcs.end()); | 81 ssrcs->end(), sim_group->ssrcs.begin(), sim_group->ssrcs.end()); |
| 82 } | 82 } |
| 83 } | 83 } |
| 84 | 84 |
| 85 SimulcastBitrateMode GetSimulcastBitrateMode( | 85 SimulcastBitrateMode GetSimulcastBitrateMode( |
| 86 const VideoOptions& options) { | 86 const VideoOptions& options) { |
| 87 VideoOptions::HighestBitrate bitrate_mode; | 87 VideoOptions::HighestBitrate bitrate_mode; |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 codec->codecSpecific.VP8.numberOfTemporalLayers = | 332 codec->codecSpecific.VP8.numberOfTemporalLayers = |
| 333 kDefaultConferenceNumberOfTemporalLayers[0]; | 333 kDefaultConferenceNumberOfTemporalLayers[0]; |
| 334 | 334 |
| 335 return true; | 335 return true; |
| 336 } | 336 } |
| 337 | 337 |
| 338 bool ConfigureSimulcastCodec( | 338 bool ConfigureSimulcastCodec( |
| 339 const StreamParams& sp, | 339 const StreamParams& sp, |
| 340 const VideoOptions& options, | 340 const VideoOptions& options, |
| 341 webrtc::VideoCodec* codec) { | 341 webrtc::VideoCodec* codec) { |
| 342 std::vector<uint32> ssrcs; | 342 std::vector<uint32_t> ssrcs; |
| 343 GetSimulcastSsrcs(sp, &ssrcs); | 343 GetSimulcastSsrcs(sp, &ssrcs); |
| 344 SimulcastBitrateMode bitrate_mode = GetSimulcastBitrateMode(options); | 344 SimulcastBitrateMode bitrate_mode = GetSimulcastBitrateMode(options); |
| 345 return ConfigureSimulcastCodec(static_cast<int>(ssrcs.size()), bitrate_mode, | 345 return ConfigureSimulcastCodec(static_cast<int>(ssrcs.size()), bitrate_mode, |
| 346 codec); | 346 codec); |
| 347 } | 347 } |
| 348 | 348 |
| 349 void ConfigureSimulcastTemporalLayers( | 349 void ConfigureSimulcastTemporalLayers( |
| 350 int num_temporal_layers, webrtc::VideoCodec* codec) { | 350 int num_temporal_layers, webrtc::VideoCodec* codec) { |
| 351 for (size_t i = 0; i < codec->numberOfSimulcastStreams; ++i) { | 351 for (size_t i = 0; i < codec->numberOfSimulcastStreams; ++i) { |
| 352 codec->simulcastStream[i].numberOfTemporalLayers = num_temporal_layers; | 352 codec->simulcastStream[i].numberOfTemporalLayers = num_temporal_layers; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 ScreenshareLayerConfig config = ScreenshareLayerConfig::GetDefault(); | 464 ScreenshareLayerConfig config = ScreenshareLayerConfig::GetDefault(); |
| 465 | 465 |
| 466 // For screenshare in conference mode, tl0 and tl1 bitrates are piggybacked | 466 // For screenshare in conference mode, tl0 and tl1 bitrates are piggybacked |
| 467 // on the VideoCodec struct as target and max bitrates, respectively. | 467 // on the VideoCodec struct as target and max bitrates, respectively. |
| 468 // See eg. webrtc::VP8EncoderImpl::SetRates(). | 468 // See eg. webrtc::VP8EncoderImpl::SetRates(). |
| 469 codec->targetBitrate = config.tl0_bitrate_kbps; | 469 codec->targetBitrate = config.tl0_bitrate_kbps; |
| 470 codec->maxBitrate = config.tl1_bitrate_kbps; | 470 codec->maxBitrate = config.tl1_bitrate_kbps; |
| 471 } | 471 } |
| 472 | 472 |
| 473 } // namespace cricket | 473 } // namespace cricket |
| OLD | NEW |