From 28385c0fc050339ed769a302d0a63106195ef7e5 Mon Sep 17 00:00:00 2001 From: Aaron Vaage Date: Thu, 14 Sep 2017 10:31:16 -0700 Subject: [PATCH] Change Text Sample set_style to AppendStyle To ensure that the style data is formatted correctly, changing the set_style method to AppendStyle so that joining values will be done in controlled setting. Change-Id: Ia88e2d260b11339e6777ff018813e8aeb802a501 --- packager/media/base/text_sample.cc | 7 +++++++ packager/media/base/text_sample.h | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packager/media/base/text_sample.cc b/packager/media/base/text_sample.cc index 9effc25357..871126b497 100644 --- a/packager/media/base/text_sample.cc +++ b/packager/media/base/text_sample.cc @@ -21,6 +21,13 @@ void TextSample::SetTime(uint64_t start_time, uint64_t end_time) { duration_ = end_time - start_time; } +void TextSample::AppendStyle(const std::string& style) { + if (settings_.length()) { + settings_ += " "; + } + settings_ += style; +} + void TextSample::AppendPayload(const std::string& payload) { if (payload_.length()) { payload_ += "\n"; diff --git a/packager/media/base/text_sample.h b/packager/media/base/text_sample.h index 330851e9d4..db8b94aa04 100644 --- a/packager/media/base/text_sample.h +++ b/packager/media/base/text_sample.h @@ -26,8 +26,8 @@ class TextSample { uint64_t EndTime() const; void set_id(const std::string& id) { id_ = id; } - void set_settings(const std::string& settings) { settings_ = settings; } void SetTime(uint64_t start_time, uint64_t end_time); + void AppendStyle(const std::string& style); void AppendPayload(const std::string& payload); private: