From cb2ec22a06701cf03c311ec4569c42fd513a495d Mon Sep 17 00:00:00 2001 From: Aaron Vaage Date: Tue, 1 May 2018 14:44:58 -0700 Subject: [PATCH] Set Text Time Scale In Tests Problem: The time scale for text was being set to zero in our tests because it was never needed. Change: This changes it to use MS as that is what's most common and requires the least amount of changes. Change-Id: Ia046ac1994b4cede079d2f801275c7f058d5bdd3 --- packager/media/base/media_handler_test_base.cc | 5 ++++- .../media/chunking/cue_alignment_handler_unittest.cc | 9 ++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/packager/media/base/media_handler_test_base.cc b/packager/media/base/media_handler_test_base.cc index 1130a5df1d..ae983e8f96 100644 --- a/packager/media/base/media_handler_test_base.cc +++ b/packager/media/base/media_handler_test_base.cc @@ -215,10 +215,13 @@ std::unique_ptr MediaHandlerTestBase::GetSegmentInfo( } std::unique_ptr MediaHandlerTestBase::GetTextStreamInfo() const { + // Assume that text will use milliseconds. + const uint64_t kTimeScaleMs = 1000; + // None of this information is actually used by the text out handler. // The stream info is just needed to signal the start of the stream. return std::unique_ptr( - new TextStreamInfo(0, 0, 0, kUnknownCodec, "", "", 0, 0, "")); + new TextStreamInfo(0, kTimeScaleMs, 0, kUnknownCodec, "", "", 0, 0, "")); } std::unique_ptr MediaHandlerTestBase::GetTextSample( diff --git a/packager/media/chunking/cue_alignment_handler_unittest.cc b/packager/media/chunking/cue_alignment_handler_unittest.cc index 129a43f866..b719f224d8 100644 --- a/packager/media/chunking/cue_alignment_handler_unittest.cc +++ b/packager/media/chunking/cue_alignment_handler_unittest.cc @@ -29,7 +29,6 @@ const size_t kThreeOutput = 3; const bool kEncrypted = true; const bool kKeyFrame = true; -const uint64_t kNoTimeScale = 0; const uint64_t kMsTimeScale = 1000; const char* kNoId = ""; @@ -156,7 +155,7 @@ TEST_F(CueAlignmentHandlerTest, TextInputWithNoCues) { testing::InSequence s; EXPECT_CALL(*Output(kTextStream), - OnProcess(IsStreamInfo(kParent, kNoTimeScale, !kEncrypted))); + OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted))); EXPECT_CALL(*Output(kTextStream), OnProcess(IsTextSample(kNoId, kSample0Start, kSample0End, kNoSettings, kNoPayload))); @@ -210,7 +209,7 @@ TEST_F(CueAlignmentHandlerTest, TextAudioVideoInputWithNoCues) { testing::InSequence s; EXPECT_CALL(*Output(kTextStream), - OnProcess(IsStreamInfo(kParent, kNoTimeScale, !kEncrypted))); + OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted))); EXPECT_CALL(*Output(kTextStream), OnProcess(IsTextSample(kNoId, kSample0Start, kSample0End, kNoSettings, kNoPayload))); @@ -445,7 +444,7 @@ TEST_F(CueAlignmentHandlerTest, TextInputWithCues) { testing::InSequence s; EXPECT_CALL(*Output(kTextStream), - OnProcess(IsStreamInfo(kParent, kNoTimeScale, !kEncrypted))); + OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted))); EXPECT_CALL(*Output(kTextStream), OnProcess(IsTextSample(kNoId, kSample0Start, kSample0End, kNoSettings, kNoPayload))); @@ -510,7 +509,7 @@ TEST_F(CueAlignmentHandlerTest, TextAudioVideoInputWithCues) { testing::InSequence s; EXPECT_CALL(*Output(kTextStream), - OnProcess(IsStreamInfo(kParent, kNoTimeScale, !kEncrypted))); + OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted))); EXPECT_CALL(*Output(kTextStream), OnProcess(IsTextSample(kNoId, kSample0Start, kSample0End, kNoSettings, kNoPayload)));