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

Unified Diff: webrtc/modules/video_coding/generic_encoder.cc

Issue 2986893002: Piggybacking simulcast id and ALR experiment id into video content type extension. (Closed)
Patch Set: Add metrics sliced on AlrExperiment group Created 3 years, 4 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 side-by-side diff with in-line comments
Download patch
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..804a6645aadbef11abf0e501e40f04cda1d790df 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,33 @@ 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 fake field trial.
sprang_webrtc 2017/08/24 09:13:16 -field trial I think it would be ok to not subtrac
ilnik 2017/08/25 12:35:07 Come on, we are writing in C++, not pascal. Things
+ 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);
+ // Only set simulcast id if there's a simulcast.
+ if (num_simulcast_svc_streams > 1) {
+ // 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)

Powered by Google App Engine
This is Rietveld 408576698