From 18cdbd4121b0f372171f5da6a16ccba421e8e839 Mon Sep 17 00:00:00 2001 From: KongQun Yang Date: Fri, 12 May 2017 14:46:24 -0700 Subject: [PATCH] Deprecate availability_time_offset MPD flag 'availability_time_offset' is not an attribute in MPD specification, but used to calculate availability_start_time to adjust segment availability time. A similar effect can be achieved with standard blessed suggested_presentation_delay flag. If suggested_presentation_delay is not set, player is expected to choose a suitable value. Change-Id: I1d540bd4347b4f04b6cc5ec0778e1a5392009b09 --- docs/design.md | 6 +----- packager/app/mpd_flags.cc | 5 ----- packager/app/mpd_flags.h | 1 - packager/app/packager_util.cc | 1 - packager/app/retired_flags.cc | 11 +++++++++++ packager/app/retired_flags.h | 1 + packager/mpd/base/mpd_builder.cc | 6 ++---- packager/mpd/base/mpd_options.h | 1 - 8 files changed, 15 insertions(+), 17 deletions(-) diff --git a/docs/design.md b/docs/design.md index bf8c7e97f5..f85a81e881 100644 --- a/docs/design.md +++ b/docs/design.md @@ -81,10 +81,6 @@ mpd_options.min_buffer_time = 5.0; // The below options are for live profile only. -// Offset with respect to the wall clock time for MPD availabilityStartTime -// and availabilityEndTime values, in seconds. -mpd_options.availability_time_offset = 10.0; - // Indicates to the player how often to refresh the media presentations, in // seconds. mpd_options.minimum_update_period = 5.0; @@ -93,7 +89,7 @@ mpd_options.minimum_update_period = 5.0; mpd_options.time_shift_buffer_depth = 1800.0; // Specifies a delay, in seconds, to be added to the media presentation time. -mpd_options.suggested_presentation_delay = 0.0; +mpd_options.suggested_presentation_delay = 10.0; ``` Using MpdBuilder Instance diff --git a/packager/app/mpd_flags.cc b/packager/app/mpd_flags.cc index a6939af360..9646ca3726 100644 --- a/packager/app/mpd_flags.cc +++ b/packager/app/mpd_flags.cc @@ -33,11 +33,6 @@ DEFINE_double(min_buffer_time, 2.0, "Specifies, in seconds, a common duration used in the definition " "of the MPD Representation data rate."); -DEFINE_double(availability_time_offset, - 10.0, - "Offset with respect to the wall clock time for MPD " - "availabilityStartTime and availabilityEndTime values, in " - " seconds. This value is used for live profile only."); DEFINE_double(minimum_update_period, 5.0, "Indicates to the player how often to refresh the media " diff --git a/packager/app/mpd_flags.h b/packager/app/mpd_flags.h index e7c9b1e1a9..f29e272771 100644 --- a/packager/app/mpd_flags.h +++ b/packager/app/mpd_flags.h @@ -15,7 +15,6 @@ DECLARE_bool(generate_static_mpd); DECLARE_bool(output_media_info); DECLARE_string(mpd_output); DECLARE_string(base_urls); -DECLARE_double(availability_time_offset); DECLARE_double(minimum_update_period); DECLARE_double(min_buffer_time); DECLARE_double(time_shift_buffer_depth); diff --git a/packager/app/packager_util.cc b/packager/app/packager_util.cc index 87b6858daa..975cb8dbd9 100644 --- a/packager/app/packager_util.cc +++ b/packager/app/packager_util.cc @@ -216,7 +216,6 @@ MpdOptions GetMpdOptions(bool on_demand_profile) { mpd_options.mpd_type = (on_demand_profile || FLAGS_generate_static_mpd) ? MpdType::kStatic : MpdType::kDynamic; - mpd_options.availability_time_offset = FLAGS_availability_time_offset; mpd_options.minimum_update_period = FLAGS_minimum_update_period; mpd_options.min_buffer_time = FLAGS_min_buffer_time; mpd_options.time_shift_buffer_depth = FLAGS_time_shift_buffer_depth; diff --git a/packager/app/retired_flags.cc b/packager/app/retired_flags.cc index 88e4e85899..19a6c54c55 100644 --- a/packager/app/retired_flags.cc +++ b/packager/app/retired_flags.cc @@ -16,6 +16,10 @@ DEFINE_bool(single_segment, true, "This flag is deprecated. Do not use."); DEFINE_bool(webm_subsample_encryption, true, "This flag is deprecated. Use vp9_subsample_encryption instead."); +DEFINE_double(availability_time_offset, + 10.0, + "This flag is deprecated. Use suggested_presentation_delay " + "instead which can achieve similar effect."); // The current gflags library does not provide a way to check whether a flag is // set in command line. If a flag has a different value to its default value, @@ -33,6 +37,13 @@ bool InformRetiredDefaultTrueFlag(const char* flagname, bool value) { return true; } +bool InformRetiredDefaultDoubleFlag(const char* flagname, double value) { + if (value != 0) + fprintf(stderr, "WARNING: %s is deprecated and ignored.\n", flagname); + return true; +} + DEFINE_validator(profile, &InformRetiredStringFlag); DEFINE_validator(single_segment, &InformRetiredDefaultTrueFlag); DEFINE_validator(webm_subsample_encryption, &InformRetiredDefaultTrueFlag); +DEFINE_validator(availability_time_offset, &InformRetiredDefaultDoubleFlag); diff --git a/packager/app/retired_flags.h b/packager/app/retired_flags.h index 4a2e7fe93f..829660f2fb 100644 --- a/packager/app/retired_flags.h +++ b/packager/app/retired_flags.h @@ -9,3 +9,4 @@ DECLARE_string(profile); DECLARE_bool(single_segment); DECLARE_bool(webm_subsample_encryption); +DECLARE_double(availability_time_offset); diff --git a/packager/mpd/base/mpd_builder.cc b/packager/mpd/base/mpd_builder.cc index 739565f009..e38a630d25 100644 --- a/packager/mpd/base/mpd_builder.cc +++ b/packager/mpd/base/mpd_builder.cc @@ -575,10 +575,8 @@ void MpdBuilder::AddDynamicMpdInfo(XmlNode* mpd_node) { if (availability_start_time_.empty()) { double earliest_presentation_time; if (GetEarliestTimestamp(&earliest_presentation_time)) { - availability_start_time_ = - XmlDateTimeNowWithOffset(mpd_options_.availability_time_offset - - std::ceil(earliest_presentation_time), - clock_.get()); + availability_start_time_ = XmlDateTimeNowWithOffset( + -std::ceil(earliest_presentation_time), clock_.get()); } else { LOG(ERROR) << "Could not determine the earliest segment presentation " "time for availabilityStartTime calculation."; diff --git a/packager/mpd/base/mpd_options.h b/packager/mpd/base/mpd_options.h index 5fdfee2899..5195eaf3be 100644 --- a/packager/mpd/base/mpd_options.h +++ b/packager/mpd/base/mpd_options.h @@ -23,7 +23,6 @@ enum class MpdType { kStatic, kDynamic }; struct MpdOptions { DashProfile dash_profile = DashProfile::kOnDemand; MpdType mpd_type = MpdType::kStatic; - double availability_time_offset = 0; double minimum_update_period = 0; // TODO(tinskip): Set min_buffer_time in unit tests rather than here. double min_buffer_time = 2.0;