Commit Graph

1113 Commits

Author SHA1 Message Date
Aaron Vaage cf3fc61fbe Fix incorrect data_reference_index in TextSampleEntry
In the text sample box (for mp4) there was a value called
"data_reference_index" that was never initialized. This meant
that it took on various values can caused different results
between runs.

Change-Id: I4b18ac97ec4700f6e651b14898ef250713a4253c
2018-05-25 19:33:54 +00:00
Aaron Vaage d7dcf9c7c7 Run Clang Format on Box Definitions
Change-Id: Ibfbfe025e7b914ddfa2f7c81d419d7b4f9212554
2018-05-25 19:33:45 +00:00
Aaron Vaage 388d49cf98 Rename webvtt_output_handler files
Renamed all the files called "webvtt_output_handler*" to
"webvtt_text_output_handler*" to better reflect the class name
in them.

Change-Id: I977bab362076974a124f263bcefff716ed8b6a0f
2018-05-25 18:56:54 +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 b01de0bfb6 Disallow Copy and Assign WebVtt File Buffer
We should never need to copy or assign the webvtt file buffer
so this change enforces that.

Change-Id: I119865e96c0188781adbe115beb2486b1b56542a
2018-05-24 21:47:56 +00:00
Aaron Vaage d56efd147a Disallow Copy and Assign For WebVTT Output
We don't want to allow any handler to be copyable or assigned-over
so this change enforces that for the webvtt output handler.

Change-Id: Ie0d59d6dbfb7a5e00bb4dd1422cd696d1a2d6072
2018-05-24 14:46:23 -07:00
Aaron Vaage b3c148607f Simplify WebVtt Output
Before, the webvtt output handler was written so that it could
share code between a segmented and non-segmented handler. As
we are not worried about that right now, this change simplifies
the handler to just be about segmented output.

Change-Id: I29dbc4e3a4ffbeb7ea10e23db489ee74b398a6c4
2018-05-24 18:09:48 +00:00
KongQun Yang 1a52a9b7c0 Fix potential incorrect target duration in iFrame Playlist
This may happen if media segments do not start with iframes.

Change-Id: Ie7b2d33a14405a5dcd071644f2fa3d5f9656dd07
2018-05-23 10:33:48 -07:00
KongQun Yang cf40accaa8 [HLS] Fixing AdCues handling in iframe playlists
Previously for the last iframe in a segment, we wait for the next
segment to arrive before writing the EXTINF tag. If an Ad Cue comes
in before the next segment, the EXT-X-PLACEMENT_OPPORTUNITY tag would
be inserted before the iframe in previous segment.

Fixes #378, #396.

Change-Id: I1ede72a4d4edca94781c7b05bc25397d67916d1a
2018-05-22 16:02:28 -07:00
KongQun Yang 14caaf1e1c Update CHANGLOG for v2.1.0
Change-Id: Iac9e425b8eb9e8eac28d38ea69431298d026ada3
2018-05-22 19:53:03 +00:00
KongQun Yang 4d8ce0ff5d Extract bitrates in ES descriptor for AAC if available
Change-Id: I1aa53b519e8751400bea6b33936cb2e7a05958dc
2018-05-22 11:59:58 -07:00
KongQun Yang 734b4161f8 Ignore unsupported audio codec in the source content
Instead of failing immediately, ignore unsupported audio codec when
parsing the source file, as there may be more than one stream in the
source file. This allows the supported streams to be packaged.

Closes #395.

Change-Id: I01005a93a19012c19065251647c9b06dd25c673a
2018-05-22 18:35:34 +00:00
KongQun Yang 317425d92f Fix TS mimetype in DASH
Change-Id: I64235d02206bda9a7c18d396b2889bb28091ab5d
2018-05-21 20:31:40 +00:00
KongQun Yang b58753278c Add end to end tests for packed audio
Issue: #342.

Change-Id: Iaa890450615573da84b8934b2ba3ee3602d6fb74
2018-05-21 20:30:26 +00:00
Aaron Vaage 5bb5a58b7f Removed Unused Cue class
The Cue class was from a previous WebVTT implementation and
is not used in the current implementation. It was missed when the
other classes were removed. This change removes it.

Change-Id: I661ab3fcd80b5e5ef98b5213746b341a4028d1a1
2018-05-21 18:46:57 +00:00
KongQun Yang dd68b3e386 Update HLS examples to use elementary audio with TS output
Issue: #342.

Change-Id: Idd173c76d67d20d9c88be5ef2d6bfc1ce85b5523
2018-05-18 20:35:43 +00:00
KongQun Yang 8fc17c3653 Remove 'Package' from py.test names
Change-Id: Ifd4400c797eee3573fe732e017e2a05354d35a29
2018-05-18 20:34:18 +00:00
KongQun Yang 59941a101a Support entitlement license with Widevine key server
- Added a new --enable_entitlement_license flag, which sets
  'enable_entitlement_license' in Widevine CommonEncryptionRequest;
- Support 'boxes' in Widevine CommonEncryptionResponse.

b/78171767

Change-Id: Id399fc7fcb2948c571e12c8af7687cfcfcef41fe
2018-05-17 21:03:05 +00:00
KongQun Yang 7f7843d241 Clean up output format determination
Requiring output format determined from 'output' to be consistent with
output format determined from 'segment_template'.

Change-Id: I32cbd63fcd6e2a4272dd0db531c1d5b385315445
2018-05-17 17:33:47 +00:00
Aaron Vaage df6661b93d Fixed Incorrect BOM used in WEBVTT Header
When originally implementing the webvtt parser, there was a
misunderstanding in what the BOM was suppose to be
(https://en.wikipedia.org/wiki/Byte_order_mark). This corrects the
misunderstanding.

Close #397

Change-Id: I250d392db228e5e9b86684614b57adc5d8a4e5fe
2018-05-17 17:33:31 +00:00
KongQun Yang 0af2c5cdcf Integrate PackedAudioWriter
Closes #342.

Change-Id: I2fb4a651ad90448ab226b386c92c94e11ff9f9a8
2018-05-16 18:12:42 -07:00
KongQun Yang 39beb99d6c Implemented PackedAudioWriter
Issue #342.

Change-Id: Ic1379b00e38f818460f24ad57122ca22c5b5285a
2018-05-16 21:52:18 +00:00
KongQun Yang 33c4f344e7 Implemented PackedAudioSegmenter
Per HLS specification:
https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-3.4

Issue #342.

Change-Id: Iba7fae7a9b8912bcd13ae55d25b22a5803f7f7ea
2018-05-16 21:52:11 +00:00
KongQun Yang 5965b3e136 Move TS encrypted audio setup for HLS to hls_audio_util
Change-Id: Ibbc1fe2a8013abded6df2f2f57701ec328d3e5c6
2018-05-16 01:04:14 +00:00
KongQun Yang 8333908df1 Implemented Id3Tag class to handle ID3 tag
Also switched the original code in mp4 to use the new Id3Tag class.

Change-Id: I1db2c6c6142ed98b72a432980a6a54815f1a8cc4
2018-05-16 01:04:02 +00:00
Aaron Vaage 8f3a45c497 Respect Output Format In Packager Test
Make sure to use the output format when given when setting up our
tests. Not doing so results in text always being set to "vtt" when
the output format is "mp4".

Change-Id: I11c5f861091598a67fc76dc19b1b16a9a773a2e0
2018-05-15 23:35:54 +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 d3fd4e9c05 Create Test For Ad Cues
Create an end-to-end test for ad cues. This test's final result is not
correct but illustrates the problem we have in the cue insertion and will
be fixed by a later CL.

Change-Id: Ia8b43a53848941be52cf9ade018668e6477e8df2
2018-05-15 21:55:40 +00:00
KongQun Yang ae82cd16f3 Remove the usage of JsonWriter in WidevineKeySource
Uses protobuf JSON util instead.

packager/base/json_writer comes from Chromium base. We are going to
replace it with abseil, which does not have a JSON library.

The code is much more cleaner now.

This is unfortunately, at the expense of increased output binary size.
packager binary increases by another 100KB.

Change-Id: I83a9217a484cad3c41147ad9a75311384347c49c
2018-05-15 20:10:43 +00:00
KongQun Yang b209aeeb7a Remove the usage of JsonWriter in SimpleHlsNotifier
Use protobuf utilities instead.

packager/base/json_writer comes from Chromium base. We are going
to switch to abseil which does not have a JSON library.

This is unfortunately, at the expense of increased output binary size.
packager binary increases by about 300KB due to:
- Protos cannot be compiled with LITE_RUNTIME any more.
- Additional protobuf library needed to convert between JSON and proto.

Change-Id: I45a497376925b42d147ffcaabcfc2fa4dbdeacc1
2018-05-15 20:06:54 +00:00
KongQun Yang bbd5e074ee Add a test outputing DASH and HLS at the same time
Change-Id: I38c0ca9ed206536a4fd84e8c9c074609250013cc
2018-05-14 23:55:30 +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
KongQun Yang b5a73fc1d5 Refactor ProtectionSystemSpecificInfo class to struct
This is in preparation of supporting entitlement license API, where
common encryption server may return concatenated PSSHs directly.

Refactored ProtectionSystemSpecificInfo into a struct containing
concatenated PSSHs. This will make it easier to pass PSSHs around.

Also, most of the time, users of ProtectionSystemSpecificInfo do
not care what is in PSSH; so moved PSSH box parsing and building out
of ProtectionSystemSpecificInfo.

b/78171767

Change-Id: I1c4d5e7e23efd2f7d4b2b9704378323112e47f00
2018-05-11 00:10:07 +00:00
KongQun Yang 6b86b085b4 Add Widevine CommonEncryption proto
Change-Id: I18b3991604ff197d0d50f68b0528244b11125025
2018-05-10 23:16:34 +00:00
KongQun Yang f68b4252b8 Sync protobuf to v3.3.0
disable-clang-format

Change-Id: I520178aa9bb8fd8a00a7009279bf30d7cdb8d5a8
2018-05-10 23:07:59 +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
KongQun Yang 2ea347f45c Rewrite RawKeySource::GetCryptoPeriodKey
To allow generating Widevine / Playready PSSHs if the corresponding
PSSH generator is specified.

Note that Key Rotation with RawKeySource is designed to be used for
testing only.

Change-Id: Icaf9e74955c082a7b000bd6a08f4561f2e01a2e2
2018-05-09 00:00:15 +00:00
KongQun Yang ba3e054e7e Allow clang-format in presubmit to be disabled
By having 'disable-clang-format' in commit message.

If you have the script setup as git pre-commit, it can be disabled
by '--no-verify' option.

Change-Id: I6fb358e85105255fddde41f950e986c74b7defc9
2018-05-08 23:59:52 +00:00
KongQun Yang a78c3d3224 Use MessageDifferencer for proto comparison
Change-Id: Ifa4c56d09a7e9c5c71a37ec70f81d546fe58f0a9
2018-05-08 21:30:50 +00:00
KongQun Yang 440ba442f6 Add BufferWriter::AppendString
Change-Id: Id8a7d09fd76eeb95600e108c70c2e38ddd18a7ab
2018-05-08 21:25:01 +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
KongQun Yang 0b2e1a6b40 Add update_docs.sh script for docs generation
Change-Id: I6195dc84cf0ecf69680d857b35320b068a9c54fb
2018-05-03 18:35:44 +00:00
KongQun Yang 8767d20f38 Fix potential slice header size off by one byte in H265
In H265Parser::ParseSliceHeader, the parser does not handle
byte_alignment() from the spec. byte_alignment() reportedly contains
at least one bit, which is not handled right now.

See Section 7.3.2.12 Rec. ITU-T H.265 v3 (04/2015).

Also added a few size sanity checks in H265Parser to make sure the
code does not crash if an invalid input is provided.

Fixes #383.

Change-Id: I33b31396058fc5ba67a0fc119be5fe56ec9443b0
2018-05-03 18:13:07 +00:00
KongQun Yang 764c7077a2 Fix documentation syntaxes for RST option-list
http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#option-lists

RST only accepts two forms for option argument:
- Begins with a letter and consists of [a-zA-Z0-9_].
- Begins with "<" and ends with ">"; any characters except angle
  brackets are allowed internally.

Updated documents to obey the above rule.

Also cleaned up the documents to follow the syntaxes defined in
http://docopt.org/.

Change-Id: I06c6fa6db524325373053b26fc99169469664f01
2018-05-03 18:08:12 +00:00
KongQun Yang 2d919b5a31 Fix potential partial DASH segments during live packaging
Packager uses ThreadedIO to write media segments and manifest /
playlists. There was a possibility that media segments write being
delayed and scheduled after updating manifest / playlists.

This CL fixes the race condition.

Also added a note on how segments can be synced to cloud storage to
avoid the race condition during file sync.

Also added a live WebM test.

Fixes #386.

Change-Id: Icf9c38cdec715fa3dc2836eab1511131e129fe41
2018-05-03 09:26:23 -07:00
KongQun Yang c7e1271f58 Support AAC with program_config_element()
Fixes #387.

Note that the output will not play in Chrome until the Chrome bug
https://crbug.com/837832 is fixed.

Change-Id: Ic3e917161cedfa773c0a18b4a5d7b1254c6f1313
2018-05-02 23:21:17 +00:00
KongQun Yang a7463f60c1 Enable segment auto removal for live packaging
The number of preserved segments outside live window can be
configured using flag --preserved_segments_outside_live_window,
which is default to 50, i.e. 5 minutes for 6s segment.

Note that the segment removal will be disabled if it is set to 0.

Only HLS live playlist and DASH dynamic MPD are affected by this flag.

- Also add end to end tests.

Fixes #223.

Change-Id: I8a566efebe2f1552c7d9509ab017bade5a4a1c98
2018-05-02 00:18:42 +00:00
KongQun Yang b6f0da246f Add support for FLAC codec
Implemented according to spec:
  https://github.com/xiph/flac/blob/master/doc/isoflac.txt

Closes #345.

Change-Id: If2e277d8eac4baff5965faa0e13c44c334f6184d
2018-05-02 00:16:51 +00:00