| Index: webrtc/modules/video_coding/generic_encoder.cc
|
| diff --git a/webrtc/modules/video_coding/generic_encoder.cc b/webrtc/modules/video_coding/generic_encoder.cc
|
| index cdb244da96a3f26f4d5370d88c1425b35f83aed7..c8541077c9c60f2ece5ae110bc6215e6e424400a 100644
|
| --- a/webrtc/modules/video_coding/generic_encoder.cc
|
| +++ b/webrtc/modules/video_coding/generic_encoder.cc
|
| @@ -13,6 +13,7 @@
|
| #include <vector>
|
|
|
| #include "webrtc/api/video/i420_buffer.h"
|
| +#include "webrtc/modules/pacing/alr_detector.h"
|
| #include "webrtc/modules/video_coding/encoded_frame.h"
|
| #include "webrtc/modules/video_coding/media_optimization.h"
|
| #include "webrtc/rtc_base/checks.h"
|
| @@ -20,6 +21,7 @@
|
| #include "webrtc/rtc_base/optional.h"
|
| #include "webrtc/rtc_base/timeutils.h"
|
| #include "webrtc/rtc_base/trace_event.h"
|
| +#include "webrtc/system_wrappers/include/field_trial.h"
|
|
|
| namespace webrtc {
|
|
|
| @@ -231,13 +233,15 @@ EncodedImageCallback::Result VCMEncodedFrameCallback::OnEncodedImage(
|
|
|
| rtc::Optional<size_t> outlier_frame_size;
|
| rtc::Optional<int64_t> encode_start_ms;
|
| + size_t num_simulcast_svc_streams = 1;
|
| uint8_t timing_flags = TimingFrameFlags::kInvalid;
|
| {
|
| rtc::CritScope crit(&timing_params_lock_);
|
|
|
| // Encoders with internal sources do not call OnEncodeStarted and
|
| // OnFrameRateChanged. |timing_frames_info_| may be not filled here.
|
| - if (simulcast_svc_idx < timing_frames_info_.size()) {
|
| + num_simulcast_svc_streams = timing_frames_info_.size();
|
| + if (simulcast_svc_idx < num_simulcast_svc_streams) {
|
| auto encode_start_map =
|
| &timing_frames_info_[simulcast_svc_idx].encode_start_time_ms;
|
| auto it = encode_start_map->find(encoded_image.capture_time_ms_);
|
| @@ -299,6 +303,30 @@ EncodedImageCallback::Result VCMEncodedFrameCallback::OnEncodedImage(
|
| encoded_image.timing_.flags = TimingFrameFlags::kInvalid;
|
| }
|
|
|
| + // Piggyback ALR experiment group id and simulcast id into the content type.
|
| + uint8_t experiment_id = 0;
|
| + rtc::Optional<AlrDetector::AlrExperimentSettings> experiment_settings;
|
| + if (encoded_image.content_type_.IsScreenshare()) {
|
| + experiment_settings = AlrDetector::ParseAlrSettingsFromFieldTrial(
|
| + AlrDetector::kScreenshareProbingBweExperimentName);
|
| + } else {
|
| + experiment_settings = AlrDetector::ParseAlrSettingsFromFieldTrial(
|
| + AlrDetector::kStrictPacingAndProbingExperimentName);
|
| + }
|
| + if (experiment_settings) {
|
| + // 0 would mean no experiment, therefore adding 1. It will be subtracted at
|
| + // the receive side before reporting the experiment group.
|
| + experiment_id = experiment_settings->group_id + 1;
|
| + }
|
| +
|
| + // TODO(ilnik): This will force content type extension to be present even
|
| + // for realtime video. At the expense of miniscule overhead we will get
|
| + // sliced receive statistics.
|
| + encoded_image.content_type_.SetExperimentId(experiment_id);
|
| + // We count simulcast streams from 1 on the wire.
|
| + encoded_image.content_type_.SetSimulcastId(
|
| + static_cast<uint8_t>(simulcast_svc_idx + 1));
|
| +
|
| Result result = post_encode_callback_->OnEncodedImage(
|
| encoded_image, codec_specific, fragmentation_header);
|
| if (result.error != Result::OK)
|
|
|