Commit Graph

55 Commits

Author SHA1 Message Date
Caitlin O'Callaghan cd018a71c3
Low latency DASH support (#979)
# LL-DASH Support
These changes add support for LL-DASH streaming. 

**NOTE:** LL-HLS support is still in progress, but it's coming. :) 

## Testing
`./chunking_unittest --gtest_filter="ChunkingHandlerTest.LowLatencyDash"`

`./media_event_unittest --gtest_filter="MpdNotifyMuxerListenerTest.LowLatencyDash"`

`./mpd_unittest --gtest_filter="PeriodTest.LowLatencyDashMpdGetXml"`
`./mpd_unittest --gtest_filter="SimpleMpdNotifierTest.NotifyAvailabilityTimeOffset"`
`./mpd_unittest --gtest_filter="SimpleMpdNotifierTest.NotifySegmentDuration"`
`./mpd_unittest --gtest_filter="LowLatencySegmentTest.LowLatencySegmentTemplate"`

Note, packager_test must be run from the main project directory
`./out/Release/packager_test --gtest_filter="PackagerTest.LowLatencyDashEnabledAndUtcTimingNotSet"`
`./out/Release/packager_test --gtest_filter="PackagerTest.LowLatencyDashEnabledAndUtcTimingNotSet"`
2021-08-25 08:38:05 -07:00
Joey Parrish cfbe5c08c2 cleanup: Convert all time parameters to signed
This converts all time parameters to signed, finishing a cleanup that
was started in 2018 in b4256bf0.  This changes the type of:
  - timestamps
    - PTS specifically
  - timestamp offsets
  - timescales
  - durations

This excludes:
  - MP4 box definitions
  - DTS specifically

This is meant to address signed/unsigned conversion issues on arm64
that caused some test cases to fail.

Change-Id: Ic752a20cbc6e31fea6bc0894d1771833171e7cbe
2021-08-05 18:24:15 +00:00
Joey Parrish ae89145015 Fix vector+unique_ptr issues with MSVS 2019
Because a StreamState object contains a unique_ptr, it is not
copyable.  A vector of StreamStates, therefore, causes a compile error
on resize or push_back, both of which invoke the copy constructor.

I don't know why MSVS complains, but clang does not.

To fix this, I'm changing vector<StreamState> into deque<StreamState>.

At this point static_library builds are working in MSVS 2019.
shared_library builds are still not working.

Issue #867 (MSVS 2019)
Issue #336 (progress toward replacing Travis & Appveyor with GitHub
  Actions, which uses MSVS 2019)
b/190743862 (internal; tracking replacement of Travis)

Change-Id: Iaa9d5fc357102d15eac96c29ebeee7c7236e976b
2021-06-14 12:17:24 -07:00
Jacob Trimble b2220eb0c6 Add text fragment and setting types.
This sets the groundwork for more generic text cues by having a more
generic object for the settings and the body.  This also changes the
TextSample to be immutable and accepts the fields in the constructor
instead of using setters.

Change-Id: I76b09ce8e8471a49e6bf447e8c187f867728a4bf
2020-10-19 10:39:17 -07:00
KongQun Yang 9a26ec1e83 Ignore extra Ad cues at the end of the stream
They will result in empty DASH representations, which is not spec
compliant.

For text, if the cue is before the max end time, it will still be
dispatched as the text samples intercepted by the cue can be split into
two at the cue point.

Bug: 111359775.

Change-Id: I55c2025c4e9d64c88e6a685c0cf3024a0cc4a6d8
2018-07-24 18:46:30 +00:00
KongQun Yang 571ee24f3e Use PTS instead of DTS in ChunkingHandler
DTS was used in ChunkingHandler. As a result, SegmentInfo contained
timestamp in DTS. MP4Muxer has a logic to change SegmentInfo to use
PTS but not in other muxers.

Benefits of using PTS in ChunkingHandler:

- De-dup the redundant logic in MP4Muxer
- Ensure consistent behavior in different output containers
- Consistent with other timestamps, e.g. Ad Cue timestamps

Issue #413

Change-Id: Ib671badf144e0c0866d60f4ff0ac0cbbdd33817e
2018-07-02 21:58:45 +00:00
Aaron Vaage 5f072e3b08 Start Segments At First Sample in Text Chunker
We always assumed that text stream started at zero in the text chunker.
This meant that if the text stream started later than zero (like in a
live stream) we would generate a lot of empty segments.

Instead the text chunker will assume that segments should be adjusted
to align with multiple of segment duration. The text chunker will assume
that an earlier component in the pipeline (i.e. text padder) will ensure
that the first sample has the time that we want to start segments at
(even it needs to add an empty sample).

Issue #416

Change-Id: Ie45844354d6e9448787cae896841b5ab31721ed6
2018-07-02 17:57:10 +00:00
Aaron Vaage 5a9a49034b Merge Create and Dispatch in Cue Alignment Tests
Originally the create and dispatch of stream data in the cue
alignment tests were separate to improve readability. The idea was
to separate building each stream and dispatching the streams muxed
together would make it easier to understand the streams.

However, coming back to the code, this did not hold up as it took just as
long to understand the code. So merging the two together allows for the
code to be more concise.

Change-Id: I77f6bb67e7fb0ca7af0553c3baf07082770da74c
2018-06-21 18:27:01 +00:00
Aaron Vaage b980cf3019 Reduce What We Check in Cue Alignment Tests
Reduce which variables we check in the cue alignment tests by replacing
the less important variables with "_".

Change-Id: Id8770b5f2045ad5c8ac6eee54d6a291d933a4b6f
2018-06-20 17:29:36 +00:00
Aaron Vaage e0ce59aa91 Add is_key_frame in IsMediaSample Matcher
Added the key frame field to the IsMediaSample mather. All
tests that do not care about a sample being a keyframe (or not)
have been updated to use "_".

Change-Id: I44180687c58c260b6856e683d647f532227b14d5
2018-06-18 16:05:22 +00:00
Aaron Vaage fbc4952e21 Updated StreamData Matchers to Use Matchers
Updated all the stream data matcher we use in our unit tests
to allow us to use matchers in them. We are now able to use "_"
to ignore specific parameters.

With this we were able to replace the different version of
matchers for each stream data type with a single instance for
each type.

Includes updates to printing strings to the listener. Strings
now go through a "pretty" function to help make it easier to
read them in the output.

Change-Id: I146351b54fccd63ab9ec936877e6c6b30f9aa9fc
2018-06-13 15:36:22 -07:00
Aaron Vaage 440adb3086 Remove Text Time Scale Assumption From Cue Alignment
In the cue aligner, we assumed that all text will be in milliseconds.
This was the last place with that assumption. This change removes that
assumption and uses the stream info's time scale.

Issue #399

Change-Id: Ie21bf27148e020bd85111dcace0bbdff3419c1ac
2018-06-13 13:44:21 -07:00
Aaron Vaage dbce84f3ea Remove Time Scale Assumptions From Text Chunker
Before, the text chunker would assume that all text streams were in
MS, which is not a safe assumption to make.

This changes it to take the time scale from StreamInfo and work
natively with scaled time units.

This required updating the tests. While doing so the tests were
rewritten with the goal to make them easier to read.

Closes: #399

Change-Id: Ib792ad306f40d749763418cde645337913a6046b
2018-06-13 17:43:49 +00:00
Aaron Vaage 30b189cb99 Make Test Util 'GetTextStreamInfo' require Time Scale
Make the text stream info factory method in media_handler_test_base
require the caller to specify the time scale.

Issue: #399
Change-Id: Ibdfb183e0aa3f4ff50edf6b58c4e9b966006c6d2
2018-06-13 17:43:35 +00:00
Aaron Vaage b69eb49f77 Add Missing ASSERT_OK Calls in Cue Alignment Tests
The SetUpAndInitialize function returns a status. We were not
asserting that it return an OK status. This change adds the
missing ASSERT_OK calls.

Change-Id: I044f60c0450d46fc0f6495319b1ed7ef8ab6e794
2018-05-24 22:14:07 +00:00
Aaron Vaage 2e9c2fe024 Fix Cue Insertion at Text Stream End
Problem : Text samples have variable length and therefore act
          more like continuous samples whereas audio and video
          act more like discrete samples. Since we use sample
          start time, a cue event could be inserted after the
          start time of the last text sample and never get
          inserted as there are no more samples.

Change : After all streams have requested flushing, we make sure
         to collect all remaining cue events from the sync point
         queue and insert them into each stream.

Issue #362

Change-Id: Id8f136f7ef53531f7a7f412613eac352324e0130
2018-05-15 22:01:09 +00:00
Aaron Vaage f619affb8f Store More Than One Cue
In the cue alignment handler, instead of storing just one cue, store
a full queue. This will make it easier to handle text streams that
end before audio and text.

Change-Id: Ida97008fa015639350261bd3f76f4cb901747c66
2018-05-14 22:10:07 +00:00
Aaron Vaage ff0fd500b8 Store Stream Data and Not CueEvent
In the cue aligner, instead of storing the cue event, store a
stream data so that we don't need to know the stream index when
sending the cue event downstream.

Change-Id: Ice27da021fad2872e2a23975b959630a9d43b736
2018-05-14 22:09:51 +00:00
Aaron Vaage ec3bbfff16 Isolate Video and Non Video Actions In Cue Aligner
To make it easier to understand what a video stream and a non
video streams is doing in the cue aligner, each stream type is
given their own functions.

Change-Id: I8b8ca403721bcb06ca3056004420902667a30f6c
2018-05-09 13:50:49 -07:00
Aaron Vaage df19a48aa0 Use Common Hint
Use a common hint for all stream states as the hint is always
updated when we get a new cue event. Cue events are only gotten
when be pass the hint, so there should only need to be one hint.

Change-Id: I0838110b9b10325a9e99f8fca0b11f0a6b48f8a0
2018-05-09 19:48:45 +00:00
Aaron Vaage 9a9f7d58b2 Update Cue Alignment Tests To Interweave Sample Data
Problem: Sending samples to the cue alignmenet handler did
         not reflect what was more likely to happen. In our
         tests we would send all the samples for one stream
         then all the samples for another stream. This created
         some special cases that would either not happen in
         reality or miss cases that would likely happen in
         reality.

Changes: Changes all tests to dispatch samples in an interlaced
         pattern that better reflects muxed content.

Change-Id: I985092154b62eb12d95499663d195ca6c103bc19
2018-05-07 16:25:10 +00:00
Aaron Vaage cb2ec22a06 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
2018-05-01 22:43:13 +00:00
Aaron Vaage 2563ae7fe9 Add Missing Header Guards To Cue Aligner
Change-Id: I0f9e892172932dc560101865df6539736388721a
2018-04-26 17:51:02 +00:00
Aaron Vaage d5e820c744 Fix Spelling Mistake in Cue Alignment Handler
"bufferring" -> "buffering"

Change-Id: Ib516460295a52f0e5aa09583432868cf0efb3fe3
2018-04-06 13:16:55 -07:00
Aaron Vaage a11cbf93a7 Handle CueEvent in TextChunker
Updated TextChunker to handle incoming CueEvents. Connecting the
text chunker with the cue alignment handler will happen in a later
CL.

Issue: #362

Change-Id: Ib1fa9f457cf4ec0ce413dadcfa7eed5895ecd628
2018-03-29 11:03:15 -07:00
KongQun Yang 14aab56474 Allow SyncPointQueue to be cancelled
Change-Id: Idbf6ee7a5d9721681811189fca4190e7a0286c83
2018-03-27 19:14:37 +00:00
KongQun Yang db45e0868a Generate full segment after cue point
Also added RETURN_IF_ERROR status macro.

Change-Id: I04643b6252ea5623128f9a16fa744a255c91be17
2018-03-27 19:14:26 +00:00
Aaron Vaage 8f565bf388 Change Text Sample to Use int64_t
Changed Text Sample to use int64_t so that it will use the same
type for time as Media Sample.

Change-Id: I4cfbfdc60c37bb511517993976cd1a459bdf6667
2018-03-26 20:46:58 +00:00
Aaron Vaage 56caecd073 Rename WebVttSegmenter To TextChunker
Renamed the webvtt segmenter to text chunker as there is nothing
webvtt specific in the code.

Change-Id: I0111c50d545fa168d945b39bc8a78c46c62678be
2018-03-26 17:58:56 +00:00
Aaron Vaage 2dd198a9d2 Move WebVtt Segmenter To Chunking Directory
Move the webvtt segmenter to the chunking directory so that it
can be converted to a general purpose text chunker.

Change-Id: I9ecd7ee39cb73070dab07b64f65ef24af1404813
2018-03-26 17:58:38 +00:00
KongQun Yang 4e57259d2a Integrate CueAlignmentHandler
Also changed ChunkingHandler to be one-one handler.

Issue: #355

Change-Id: Ie98a96bcc0ddded347699c9f333f604826976d11
2018-03-26 17:58:30 +00:00
Aaron Vaage 3b5b2bccca Implements SyncPointQueue and CueAlignmentHandler
SyncPointQueue manages all cue points and returns aligned cue
points to the callers (CueAlignmentHandlers).

CueAlignmentHandler is responsible for aligning cues from different
streams. It uses SyncPointQueue internally to align / synchronize the
cue points.

Issue: #355

Change-Id: I281fecb46a3ca7172d71e7495bdd07b8efdeb283
2018-03-22 18:21:40 +00:00
Aaron Vaage 833b8165f1 Change Scte35 to use double for time
Change-Id: I2588d3c86d48dc2d9f3692aa0aab28b9de63d109
2018-03-15 18:11:00 -07:00
Aaron Vaage 834ceffd18 Change CueEvent to use time in seconds
Change-Id: I03527db76905f25f0a142940f5fcf73e2a92d42f
2018-03-16 01:10:10 +00:00
Aaron Vaage 387fe8e33b Isolated OnMediaSample in Chunker
Change-Id: I3af45543a1da1d1cf0b0741dd732dc71b2c30abe
2018-02-23 23:16:35 +00:00
Aaron Vaage 21acb41e63 Isolate OnScte35Event in ChunkerHandler
Change-Id: I9b34f959c22df498a338eb49c87b67003617ead2
2018-02-23 23:12:11 +00:00
Aaron Vaage d9d2cb3e1f Isolate OnStreamInfo in Chunking Handler
Change-Id: If35b9f545f96237095177438a5f95f964cbbfe3d
2018-02-23 23:12:00 +00:00
KongQun Yang c9fb2b4a85 Use start_time from CueEvent in NotifyCueEvent
Instead of using next segment start time, as CueEvent time may not
align with segment start time exactly.

Also remove the incorrect DCHECK in ChunkingHandler when processing
kScte35Event.

Change-Id: I4987740c99c8d0d25c9b99bddc5e557e45d308e0
2018-01-20 01:18:38 +00:00
KongQun Yang feabf770bf Sync streams coming to ChunkingHandler
Change-Id: I50d1a64f2ec3c50dfb1b7282241b47f3a55e26ce
2018-01-18 16:23:59 +00:00
KongQun Yang db74d6756e Propage CueEvent to MpdNotifier/HlsNotifier
Change-Id: I9828af11a28300d20cc8742251bbe1b4ebfdbad1
2018-01-04 18:25:03 +00:00
Kamesh Devarakonda 4e3a24fb41 Determine chunking point
Change-Id: Ic5690f803c1a2c22b80785aefbc1f1cef2f11c38
2017-12-12 14:24:28 -05:00
Kamesh Devarakonda 7e46ad1021 Capture SCTE35 events
Change-Id: Id06239ed4820104fecbca08a4103a47ecbed5eda
2017-12-12 01:20:52 +00:00
KongQun Yang 8e96dd3b37 Address gcc build failures in some platforms
Seeing some failures on some platforms when compiled with clang
disabled:
  GYP_DEFINES="clang=0" gclient runhooks

Several changes to make it work:
1. Mark packager code with packager_code=1 in GYP definitions.
2. Disable a few checks in non-packager code, which we do not have
   direct control: dangling-else, deprecated-declarations,
                   unused-function
3. Fix the relevant errors in packager code.
4. Revert HAVE_STROPTS_H in curl config which is not available in
   all linux distributions.

Fixes #286
Fixes #293

Change-Id: I729b41f99403c5ad9487c6cc4a7dc06f6323cef8
2017-12-07 11:45:26 -08:00
Aaron Vaage 31bf6dab59 Separate MediaHandlerTestBase From FakeMediaHandler
To allow more tests to use the MediaHandlerTestBase and get access to the
helpful creation methods, this change moves the use of FakeMediaHandler
and setting up the graph to a sub class.

Change-Id: I90dd151e3c96d8fbe4bd02a1d6b11e66a279d95b
2017-09-25 16:41:06 -07:00
Aaron Vaage 16eff80497 Made StreamData Have Const Pointers
In prep for changes to Trick Play, we want to make all messages
copy on write so that if the same message is sent to multiple
handlers, it is not possible for one handler to change the data
another handler is using.

Change-Id: I554166ca11c532412e4dfced5603972ca24dc2bb
2017-09-19 21:06:29 +00:00
KongQun Yang 9eaf1dcae0 Consolidate ChunkingParams and ChunkingOptions
Change-Id: Ibbb85981d2b424432b61ca693e28334ef00d475e
2017-08-18 11:55:45 -07:00
KongQun Yang 3bad4ca700 Move status.h under packager/
Change-Id: I4a7f34c575c1c8b9a9a275f3889cf8641cfdd471
2017-06-30 11:35:18 -07:00
KongQun Yang b09c8f6521 Update EncryptionHandler to support key rotation and SampleAes
This CL also removes EncryptionConfig stream data type and merges it
into StreamInfo/SegmentInfo instead.

Change-Id: Idb70ce503e61d3c951225cc78b6b15c084e16dcd
2017-03-21 23:50:53 +00:00
Kongqun Yang 0cb0f79c33 Fix build break in Windows (#211)
Change-Id: I0ed7a712fd02ea4dddd9c20541c2df653dc456cb
2017-03-17 12:45:28 -07:00
Kongqun Yang 8806f78655 Use size_t as the type of stream_index
Change-Id: Ica8ffeccc45c1adf5def6fe9b2edde5708d6b432
2017-03-16 20:54:48 +00:00