Commit Graph

373 Commits

Author SHA1 Message Date
KongQun Yang 32e3ff3e25 Set default --segment_duration to 6 seconds
This is recommended by Apple and other content providers:
https://apple.co/2uTTAc4

- Set default --clear_lead to 12 seconds, i.e. about 2 segments.
- Set default --fragment_duration to 0 so fragment (sub-segment) is not
  generated by default.

Change-Id: Ie6ec3ab6f0ce973547989c663a92b637a2fdc47c
2018-07-31 20:49:43 +00:00
KongQun Yang bd98436241 Normalize crypto_period_index to 0 for negative timestamp
It is possible to see a negative timestamp if the input mp4 file
contains EditList.

Also increase the queue size for EncryptionKey to be able to handle
smaller crypto_period_duration during testing.

Change-Id: I68278bf482d6662e771d9b80f4d5409605065aac
2018-07-31 12:56:33 -07:00
KongQun Yang 51d39d96a1 Add offset to tranport streams (MPEG2-TS, HLS Packed Audio)
Configurable with --transport_stream_offset_ms.

This is needed to compensate for possible negative timestamps in
inputs, which could happen on ISO-BMFF with EditLists.

Issue #112.

Change-Id: I0fce8766c9df2911b9bb859c1e54052a8ed2abfb
2018-07-26 23:20:21 +00:00
KongQun Yang 9a55d4033f Adjust timestamps in mp4 if there is an initial composition offset
In some ISO-BMFF files, there is an initial non-zero composition offset,
but there is no EditList present.

This is against ISO-BMFF spec recommentation [1] and we believe in most
cases it is just missing the EditList.

[1] 14496-12:2015 8.6.6.1
It is recommended that such an edit be used to establish a presentation
time of 0 for the first presented sample, when composition offsets are
used.

Issue: #112.
Fixes: b/110782437.

Change-Id: I23d33810ce536b09a1e22a2644828d824c1314f5
2018-07-26 23:20:21 +00:00
KongQun Yang 40ea1286b9 Add support for EditLists in ISO-BMFF
- EditLists in input files are parsed and applied to sample timestamps.
- An EditList will be inserted in the ISO-BMFF output if
  - There is an offset between the initial presentation timestamp (pts)
    and decoding timestamp (dts). Chrome, as of M67, still uses dts in
    buffered range API [1], which creates various problems when buffered
    range by pts does not align with buffered range by dts. There is
    another bug in Chrome that applies EditList to pts only [2]. This
    means that we can insert an EditList to align pts range and dts range.
  - MediaSamples have negative timestamps (e.g. for Audio Priming).

You may notice the below change on some contents:
- Some media duration is reduced by one or two frames. This is because
  EditList in the input file was ignored in the previous code, so video
  streams start with a zero dts and a non-zero pts; the smaller of dts
  and pts was used as the starting timestamp (related to the earlier
  workaround for Chrome's dts bug), so the calculated duration was
  actually a bit larger than the actual duration. Now with EditList
  applied, the initial pts is reduced to zero, so the media duration is
  also reduced to reflect the actual and correct media duration.

It may also result in negative timestamps in TS/HLS Packed Audio, which
will be addressed in a follow up CL.

Fixes #112.
Partially address b/110782437.

[1] https://crbug.com/718641, fixed but behind MseBufferByPts.
[2] https://crbug.com/354518. Chrome is planning to enable the fix for
    [1] before addressing this bug, so we are safe.

Change-Id: I59317740ad3807ca66fa74b3a18fdf7f32c96aeb
2018-07-26 23:20:21 +00:00
KongQun Yang 26997bb361 Fix flaky test in packager_test.py
MPD cannot be validated right now since we do not generate deterministic
mpd with multiple inputs due to thread racing.

Exclude mpd comparison in this case.

Change-Id: I03b68b4969a39e20927c8a9b1475f72493682696
2018-07-23 22:21:18 +00:00
KongQun Yang ff5945688d Generate DASH IF IOP compliant mpd with mpd_generator by default
I.e. enable --generate_dash_if_iop_compliant_mpd in mpd_generator by
default.

It was enabled in the main packager binary in v1.6.1.

Change-Id: Icfb19758c52c107e8ab17d3fb581923fa291cc0a
2018-07-23 22:11:00 +00:00
KongQun Yang 83f29ff964 packager_test.py: clean up output filename logic
Change-Id: I8df03d6ff6af0c621a7863d19d06e98b93fcb372
2018-07-16 23:06:08 +00:00
KongQun Yang 772400e2d5 Cleanup diff comparison in packager_test.py
Change-Id: I30ef75329060e15d54fdfa5fac44d499e3a6925a
2018-07-16 23:06:01 +00:00
KongQun Yang 71072d4e6d Combine some DASH/HLS tests into one
This saves some testing time and also make it easier to compare
DASH and HLS test results.

Change-Id: Ia4bdb39f1f5ef7ee7b3f8f37f83d7490109380c2
2018-07-16 14:59:16 -07:00
KongQun Yang b4ae6561f8 Cleanup packager_test.py
- Support decryption verification in _CheckTestResults
- Allow diff_files in _CheckTestResults
- Update all functional tests to use _CheckTestResults

Change-Id: I3f9c02f35808eba787becf9b1e5c1ce9238f943e
2018-07-16 19:13:02 +00:00
KongQun Yang 5dd21179ec Do not use harmonic mean in bandwidth calculation
Instead, caclulating average bandwidth by dividing the sum of the
sizes of every segment by the sum of the durations of every segment.
This aligns with the requirement in HLS spec:
https://tools.ietf.org/html/draft-pantos-http-live-streaming-23 4.1.

BandwidthEstimator is also simplified to handle all blocks only.

Fixes #361

Change-Id: I89e7d415a841f4d4048f199de8dae7ffa250467b
2018-07-12 10:46:47 -07:00
KongQun Yang 99a2ad03af [HLS] Support AVERAGE-BANDWIDTH
Issue #361

Change-Id: Id8eb8283675cba5ec7234d13c4ac235f34e3bec9
2018-07-12 10:43:49 -07:00
KongQun Yang 1742e03471 Drepcate --num_subsegments_per_sidx
This flag was designed for two purpose:
- Grouping fragments into subsegments, achieving three level hierarchy:
  segment < subsegment < fragment.
- Indicate whether to generate 'sidx' box in media segments (when the
  value is set to a negative number).

There are no practical use case for the first purpose. Removing it to
simplify the code and reduce the confusion.

Introduce another flag --generate_sidx_in_media_segments for the second
purpose.

Change-Id: I4be7cd42662fb324c1158b978e05768ee49dd048
2018-07-02 21:59:14 +00:00
KongQun Yang f089d1d0d4 Deprecate --mp4_use_decoding_timestamp_in_timeline
It was implemented to workaround Chromium's DTS
https://crbug.com/398130, but the workaround does not really work in
all situations.

Remove it now as we already have another workaround available.

Change-Id: I291f559d78120fb743a6679b7d927e5bbc5b6b4e
2018-07-02 21:59:01 +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
KongQun Yang 6b4a75b6ba Changed to use BandwidthEstimator in MediaPlaylist
Preparing for addressing #361.

Change-Id: I4b2e834948e681bc790efc61b63a24d44f70015d
2018-06-22 11:12:23 -07:00
Aaron Vaage d8830e3168 Remove "wvtt" from Master Playlist Codec String
Having "wvtt" in the codec string (in the master playlist) causes
errors on some older Apple products. As including it is optional,
we are opted to omit it to ensure support for all Apple products.

Close #402

Change-Id: Ib1072bcc26a3ff66e3a6d3204789c0c8c678d4db
2018-06-20 17:31:51 +00:00
KongQun Yang 55cc50baa0 Use new vp09 codec string for WebM by default
Configurable under flag --use_legacy_vp9_codec_string, which defaults
to false as all major browsers and platforms support new style vp09
codec string already.

Closes #406.

Change-Id: I22e917777f9d66db815ff9d55eb47b6d55806269
2018-06-12 23:31:28 +00:00
KongQun Yang 55050fe6b5 [Ad Insertion] Avoid adjusting EPT except for the first file
EPT (earliest presentation time) may be adjusted not to be lower than
the decoding timestamp (dts), but the adjustment should only be done
on the first file when there is one file per Representation per Period.
The second file and onwards should not be adjusted otherwise a GAP
would be created.

Closes #384
Closes b/78517422

Change-Id: I56771ad8fbbe6a87b832ec58854cfbf37d5f1817
2018-06-01 15:53:02 -07:00
Aaron Vaage b9dee56294 Rebuild Text WebVtt to MP4 WebVtt
The previous text to mp4 webvtt pipeline was incomplete. It
did not insert ad cues and it could only insert a segment
after a sample ended.

Now the pipeline supports ad cue insert and segment insertion
mid text sample. This required the pipeline to use the text
chunker (to split samples and insert segments) and required
a major overhaul of the text to mp4 converter.

Before the converter came before the chunker. This meant that
the converter only expected to see stream info and text samples.
Moving the converter after the cue aligner and chunker means
that the convert had to be aware of segments and cues.

The general approach is the same, however the converter will
convert the samples per-segment as the chunker will introduce
duplicate samples if a sample spans across segments.

Closes #362
Closes #382

Change-Id: I0f54a40524c36a602ad3804a0da26e80851c92fd
2018-06-01 19:49:56 +00:00
KongQun Yang 6e4820eedc [Ad Insertion] Support one file per Representation per Period
Allow the output file to contain template identifiers like $Number$,
$Time$ etc. Unlike the actual template used in SegmentTemplate, the
identifiers in output will be populated before pushing to the DASH
manifest.

Issue: #384

Change-Id: Ife1caadb6fccd32167fa1bc83fe2afcb2d2ad087
2018-05-31 23:59:21 +00:00
KongQun Yang 1b70c6772a Fix MPD@duration not set with MpdGenerator
Fixes: #401.

Change-Id: I5cd7c691d9cf4f187d12e5de60bf641e753f800c
2018-05-30 13:19:45 -07:00
KongQun Yang fe944f0656 Update MpdGenerator to allow inject version for testing
- Add command line flag --test_packager_version to inject packager
  version; packager_main.cc is also updated to use the same flag.
- Also add a MpdGenerator test in packager_test.py.

Change-Id: I9a11a0ee5502ba30a8acc4d44ebbfaabbe0f2f6e
2018-05-30 13:16:33 -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 4d8ce0ff5d Extract bitrates in ES descriptor for AAC if available
Change-Id: I1aa53b519e8751400bea6b33936cb2e7a05958dc
2018-05-22 11:59:58 -07: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
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
KongQun Yang 0af2c5cdcf Integrate PackedAudioWriter
Closes #342.

Change-Id: I2fb4a651ad90448ab226b386c92c94e11ff9f9a8
2018-05-16 18:12:42 -07: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 bbd5e074ee Add a test outputing DASH and HLS at the same time
Change-Id: I38c0ca9ed206536a4fd84e8c9c074609250013cc
2018-05-14 23:55:30 +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
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 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 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
KongQun Yang 224b597b48 Support approximate SegmentTimeline
It is not always possible to align segment duration to target duration
exactly. For example, for AAC with sampling rate of 44100, there are
always 1024 audio frames per sample, so the sample duration is
1024/44100. For a target duration of 2 seconds, the closest segment
duration would be 1.984 or 2.00533.

This feature allows MPD generator to treat these segments as having
the same duration, thus allows MPD generator to generate less
SegmentTimeline entries and potentially no SegmentTimeline entries
(replaced with SegmentTemplate@duration instead if
  --segment_template_constant_duration flag is enabled).

Under flag --allow_approximate_segment_timeline. Disabled by default.

Fixes #330.

Change-Id: I5044eaa348ebbf45bf792a2af53fc95a115ae21b
2018-04-30 17:15:47 -07:00
Aaron Vaage 902dfb905a Create Tests For Bandwidth
Created HLS and DASH tests that include overriding the
computed bandwidth value.

Issue #389

Change-Id: I6063fe780f6a68e2e7a7ad4440c9d76bacbbffe3
2018-04-30 15:44:55 -07:00
Haoming Chen dddbb19701 Rename Playready to PlayReady.
Change-Id: I11e0b0a0cc32aec574804e7cb02291dc3174357c
2018-04-26 11:38:31 -07:00
Haoming Chen aa4b573342 Implement multi DRM support. (Part 3)
- Allow including Widevine and Common SystemID PSSH boxes
  for PlayReadyKeySource.
- --playready_key_id and --playready_key flags are deprecated.
- --enable_raw_key_encryption already supports playready PSSH generation.

Addresses issue #245

Change-Id: I072d4f43a3239875959e4c5b1eb6854415d7367e
2018-04-26 18:14:22 +00:00
KongQun Yang b2932d5a33 Fix bitrate for DASH on-demand profile too
Removed the logic in MuxerListener to estimate bandwidth from file
size and duration, since it is not compliant to the spec.

MpdBuilder will estimate bandwidth from segment size and duration
if bandwidth is not specified in MediaInfo.

Here is the statement from DASH spec (23009-1:2014):

Consider a hypothetical constant bitrate channel of
bandwidth with the value of this attribute in bits per second
(bps). Then, if the Representation is continuously delivered
at this bitrate, starting at any SAP that is indicated either by
@startwithsap or by any Segment Index box, a client can
be assured of having enough data for continuous playout
providing playout begins after @minbuffertime *
@bandwidth bits have been received (i.e. at time
@minbuffertime after the first bit is received).
For dependent Representations this value specifies the
bandwidth according to the above definition for the
aggregation of this Representation and all complementary
Representations.

Fixes #376.

Change-Id: I0fddce39e709d0cded0a4c9ae59adbbcc97ec5ea
2018-04-24 23:25:02 +00:00
KongQun Yang adc9549e2d Add new URL fields in MediaInfo
The file_name fields will be used to solely indicate file paths on the
designated file system, and they are used to do normal file operations,
including file creation, file updating and file removal if needed;
added new xxx_url fields, for the URLs that should appear on DASH
manifest or HLS playlists.

xxx_url are the URIs of the media in the manifest. The fields are
converted from file_name fields but adjusted to be relative to DASH
manifest path or HLS playlist path, optionally with base_url prepended.

Previously the file_name fields are converted in place to indicate
URLs when passing to manifest / playlist builders. The original file
names were lost, which made it difficult to remove files outside of
live window.

Now that the input file names are preserved. File system APIs can
operate on the original file names while manifest / playlist generation
functions can operate on URLs.

Issue: #233

Change-Id: I36a64f16e3d1261ce91783a86588f24ad1371662
2018-04-23 22:49:47 +00:00
KongQun Yang 43be3c8e8b Use max bitrate in Representation@bandwidth instead of average bitrate
According to DASH spec (23009-1:2014):

Consider a hypothetical constant bitrate channel of
bandwidth with the value of this attribute in bits per second
(bps). Then, if the Representation is continuously delivered
at this bitrate, starting at any SAP that is indicated either by
@startwithsap or by any Segment Index box, a client can
be assured of having enough data for continuous playout
providing playout begins after @minbuffertime *
@bandwidth bits have been received (i.e. at time
@minbuffertime after the first bit is received).
For dependent Representations this value specifies the
bandwidth according to the above definition for the
aggregation of this Representation and all complementary
Representations.

This suggests that max bitrate should be used instead of average
bitrate.

Also cleaned up BandwidthEstimator code.

Fixes #376.

Change-Id: Ibf5896394c5c6bb820849771a2129c59202d2273
2018-04-17 22:39:58 +00:00
KongQun Yang 0ef078a23b Fix default_language not effective with 2-char code
Two-character ISO-639 code in --default_language was ignored due to
a bug in language code matching as the language code in stream is
always converted to 3-character code.

Fixes #371.

Change-Id: I8618938af583a417446636ff9efe1c72ce822c33
2018-04-13 20:08:12 +00:00
KongQun Yang 4549b1d569 Remove pto_adjustment flag
This flag was introduced to workaround a rounding error in Chrome
(probably in other browsers too).

Also although this flag avoids the first frame of a Period to be
dropped due to rounding error but it could cause the last frame of a
Period to be dropped.

Now that we use a high precision Period@duration, we do not expect to
see rounding errors any more. The player would be a better place for
the workaround even if it is still needed.

Related issue: #368.

Change-Id: I3bd517ecc6d548ff62e0c13394edb49d4bc68e8f
2018-04-13 20:07:47 +00:00
KongQun Yang 09dc0a1907 Collect and generate license notice
Under flag --licenses

Bug: 74447460

Change-Id: If99c4e927431ce08158e3734428e3b4d23d62c75
2018-04-13 00:29:55 +00:00
KongQun Yang 772aa7c93f Do not force earliest_presentation_time to 0 for VOD
Instead, the actual earliest presentation time is used except for
the first segment if there is an offset between presentation time
(pts) and decoding time (dts).

Chrome (as of v66) reports dts instead of pts in buffered ranges in
MSE API. To avoid breaking Chrome, the earliest_presentation_time
of the first segment is set to its dts as Chrome does not like negative
values for
  adjusted dts = dts + Period@start (0 for the first period)
                 - presentationTimeOffset (earliest_presentation_time).

Fixes #303.

Change-Id: I5ca80e05d5570961400499436f2bcc01f06e69e0
2018-04-09 18:39:15 +00:00
KongQun Yang 222737d5b5 Support UTCTiming
UTCTiming schemeIdUri and value pairs can be provided to packager using
--utc_timings flag. It should be comma separated list of
schemeIdUri=value pairs.

Note that urn:mpeg:dash:utc:direct:2014 scheme is not supported as it
requires the MPD to be dynamically generated on the fly when MPD is
served to client.

Fixes #311.

Change-Id: Ibc07af8a6d8b2b6261ba3ecd2c02f23809f96614
2018-04-04 01:37:01 +00:00
KongQun Yang 634ee65663 Generate a more accurate time in Period@duration
Chrome internally uses time accurate to microseconds, which is
implemented per MSE spec (https://www.w3.org/TR/media-source/).

Generate Period@duration with better precision to avoid possible
buffered range gaps in Chrome (possibly other browsers too), which
may lead to other problems like playback stall.

b/74238961
Fixes #368.

Change-Id: I357a0f62b67f75c7ca044bb99ea4e3c8bbb6fecd
2018-04-03 21:42:33 +00:00
Aaron Vaage 113a7d123b Don't Output Empty Text Samples
Only output text samples to webvtt text output when they have a payload.

Change-Id: I958d2b4f087209f540fa32cef002cd2cef37c65c
2018-04-03 18:29:41 +00:00
Aaron Vaage e5fe2a76d2 Created Text Padder Handler To Fill Gaps
Created a media handler to come after parsers that will handle filling
in gaps between text samples. The padder takes a min duration, and if
the samples do not cover the min duration when flushed, one last empty
sample will be injected so that the samples will go up to the min duration.

Change-Id: I88605059664d09279676edac418ff3d4990d7556
2018-04-02 23:11:26 +00:00
KongQun Yang 14aab56474 Allow SyncPointQueue to be cancelled
Change-Id: Idbf6ee7a5d9721681811189fca4190e7a0286c83
2018-03-27 19:14:37 +00:00
Haoming Chen fac16cbf0a Implement multi DRM support. (Part 2)
- Allow including  Widevine and Playready PSSH boxes for RawKeySource.

Partially addresses issue #245

Change-Id: I8a48d6dbbbc21c76cf2c44384dd70286ccf80363
2018-03-26 20:18:22 +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
KongQun Yang 6ffa344553 Moves AdaptationSet@id management out of Period class
It is now managed in SimpleMpdNotifier.

This avoids unnecessary increment in AdaptationSet id counter.

Also makes sure the AdaptationSet is sorted by id in XML output.

Change-Id: Ibcd0b047a71c19cd30ad7d8af9a2ed0bb05e043e
2018-03-22 12:15:43 -07:00
Aaron Vaage 631bbdc883 Update Encrypted Tests to Use DiffDir
This changes almost all encrypted tests to use DiffDir. The remaining
un-updated tests are tests that won't match every time.

Change-Id: I858bbaa0beea34887cc3100eb784aa2aecd5a0a5
2018-03-13 16:37:10 +00:00
Aaron Vaage fb2dfe129c Update CheckTestResults to sanitize media info
Change MediaInfo media paths in test output to only use the filename so
that they can be compared between test runs.

Change-Id: I26bb3f5ce79a83400b8a162c61cf5b54e41f9c70
2018-03-13 16:37:10 +00:00
Aaron Vaage 5fee0391fb Change all HLS tests to generate iframe playlists
iframe playlists will be given a name based on the output name of
the main stream. This is done to ensure unique filenames between
different video output streams.

Change-Id: Id0de9c5834599e9d896243e30569c55f34e7cd68
2018-03-07 17:29:47 -08:00
Aaron Vaage b2ce6322b6 Remove Test File Index in packager_test.py
Instead of using the test file's index in a list to create the output
name, use the original filename and the descriptor.

This caused some problems with file name collisions when some tests
were using the same name. That was fixed by changing the names. This
will go away once they are transitioned to use DiffDir like the other
tests.

Change-Id: I0a4c480406705ca63fcea61c86c67d4a5f739295
2018-03-06 21:38:04 +00:00
KongQun Yang b24a95b1aa Rewrite init segment in MultiSegmentSegmenter::DoFinalize
This is called when reaching end of the file of the media. The duration
of the media is updated.

Fixes #340.

Change-Id: I446f2d341b02125d4a7d8c958bda269b5403cb9c
2018-03-05 14:25:08 -08:00
Haoming Chen 76d68de6c1 Implement multi DRM support. (Part 1)
- Refactoring current clearkey DRM support for Widevine key source.
- Add playready pssh box in Widevine key source encrypted content.

Partially addresses issue #245

Change-Id: Id30ef02ff9f8dc0e2c58d62479e07896452919cc
2018-03-03 01:39:16 +00:00
Aaron Vaage 7dd88ca5b2 Create CheckLiveTestResults
Created a method to compare test output for live tests. This wraps
CheckTestResults but first replaces the times that would diff between
manifests.

Change-Id: Iafb51a28a9bcb9f32b210c6d76bf23e2b9a3e0d6
2018-03-02 21:00:03 +00:00
Aaron Vaage 74c53239dd Updated Nested Directories Test
This require a change to the update gold method as it would not
create nested directories. Instead it deletes the old directory
and copies the whole new directory over. This made the code simplier
and far-less error prone.

Change-Id: I1da5d9bda171b0f106d1425b204139dfbcb39b42
2018-03-02 12:21:39 -08:00
Aaron Vaage 4ace2754fd Avoid Full Path until Needed in packager_test.py
To make working with file names easier in packager_test.py _GetStream
the full path is not created until needed so that multiple paths can
use the same root filename.

Change-Id: I23a9231433b22ab5cef9b88bd6359f351da56eda
2018-03-02 10:27:35 -08:00
Aaron Vaage cd16e95d79 Make All Output Filenames Similar
Changed all output file names (not paths) to follow the pattern that
any qualifier (e.g. trick play) will be join the current name using '-'
but will use '_' within itself (e.g. trick_play_1).

Change-Id: Ib0247bf1ca6d94815fedaaf73d3a400d31c20c40
2018-03-02 10:27:34 -08:00
KongQun Yang ee9b7f6392 Calculate presentationTimeOffset and Period@duration from segments
Prefer timestamps from Video AdaptationSets if available - this avoids
possible video playback jitters due to gaps.

presentationTimeOffset is not applied to the first period as it may in
negative dts which Chrome does not like: https://crbug.com/398141.

It is safe to apply to subsequent periods as the actual offset applied
takes Period@start into consideration:

    offset = Period@start - presentationTimeOffset

The result timestamp with offset applied is close to Period@start, so
it is unlikely to result in a negative dts value.

Closes b/73899306.

Change-Id: If8361f5469610093b3aac6675754536ad7e83c4c
2018-03-01 08:55:10 -08:00
Aaron Vaage 30b5fdf19f Add Text Codec To Codec String
This change has the hls master playlist add the text codec string
to the list of codecs in a variant.

Bug: 72942756

Change-Id: Ib25bb2064a291d10d7b1d261a4307991df62220c
2018-02-28 19:23:36 +00:00
Aaron Vaage c7929b1505 Remove "with" from test names
Remove the leading "with" from test directories.

Bug: 73830478
Change-Id: I45a0914b5a0e56ec9d3340ec81eb5048c1d653a3
2018-02-27 17:43:16 -08:00
Aaron Vaage bbdcf5ee91 Fix Wrong Remove Function in Packager Test
Change-Id: I58350c2041abfd3b9c533003d408d447b9213123
2018-02-27 22:30:30 +00:00
Aaron Vaage a097aa4d3b Update Many Tests to Use CheckTestResults
Updated as many tests as we easily could. The tests that were not updated
all use live manifests or encryption that all require some "help", either
by dealing with times differing or with verifying decryption.

Bug: 73830478
Change-Id: I6803c2d960b71b459eb57b7a5e562164bb713e2a
2018-02-27 13:32:32 -08:00
Aaron Vaage 60160fe602 Change Old Test Names to Current Standard
Change-Id: Ib74b1726f6515ec562fdb82a2af390e43c36b94f
2018-02-27 13:32:32 -08:00
Aaron Vaage 6e0088c4c0 Change "AudioVideo" test to use DiffDir
Changed the end-to-end test "AudioVideo" to use diff dir
instead of manually checking each file.

Change-Id: Ic1ce1e3664cde7b2b2db262a9fde0cbe2f5b400a
2018-02-27 17:12:50 +00:00
KongQun Yang b81b832522 Create GetStream
Created GetStream, a function used to get the stream descriptor for a
single stream. This allows for finer control over the stream compared
to the batch GetStreams.

Added "trick_play_factor" to GetStream so that the trick play factor
did not have to be added the stream descriptor value and "injected"
into the stream.

Change-Id: Ifbde64b961a673aafa5f6d21f33a68d02fb46610
2018-02-27 17:12:36 +00:00
Aaron Vaage 9547000eb6 Fix Update Golden With DiffDir
Change-Id: I30c79a2acaae2d3066982d84776aaa922e183515
2018-02-27 17:12:28 +00:00
Aaron Vaage a82ac20dbb Updated "testFirstStream" to use DiffDir
Change-Id: I8c279ba0c208f1e56d53460ae134b3ed8c5f552c
2018-02-23 10:10:34 -08:00
Aaron Vaage 7096ca8998 HLS WebVtt End-to-End Tests
Created end-to-end tests for the segmented webvtt text in HLS. The
text stream is longer than both audio and video, so there are more
text segments than video/audio.

Change-Id: Ib860ccd3f2ac0048983fdeebe3847a0b9dcbc160
2018-02-23 16:55:50 +00:00
Aaron Vaage 393f989839 Create DiffDir in packager_test.py
Created a method to diff the output dir against the golden copy
of the output dir. The goal with this is to simplify our end-to-end
test structure by removing the need to track the output files within
the test runner.

With all the golden output in one directory, this makes it easier to
setup end-to-end tests and even allows the golden files to be playable.

This should not affect the repo size too much as duplicate files will
only be stored in the git object store once.

Tests will migrate to this in separate CLs.

Change-Id: Id1be9f8f60c9e362b9b615445dd8ca7da996af4c
2018-02-20 11:09:06 -08:00
KongQun Yang 74f6cefb82 Change "live" setting to be "segmented"
Changed the "live" setting in _GetStreams to be "segmented" so that it
make sense in a more general sense.

Change-Id: I2ceaad67653e1e2237533b68fccbc9fe3fabfc9b
2018-02-17 00:24:24 +00:00
KongQun Yang 11cbbd86fb Fix fMP4 'cbcs' playback issue in Safari
Looks like Safari does not like v0 tenc box.

- Use v1 tenc box for cbcs and cens protection_scheme as required by
  CENCv3 spec.
- Set crypt_byte_block and skip_byte_block to 0 for full sample
  encryption cbcs and cens.

Fixes #326

Change-Id: I5581cd856fffc4ff104d950f3ca19b9337d57a78
2018-02-08 23:40:46 -08:00
KongQun Yang 7dcab4c799 Fix '--temp_dir' option does not work problem
Fixes #322

Change-Id: Ia0ea32029c81fd8ac5661f8002154e2a54d3a84d
2018-02-07 13:46:13 -08:00
Aaron Vaage a82edb5228 Make StreamDescriptor Object
Create a StreamDescriptor class that can be used to build the stream
descriptor command line argument.

Change-Id: Ifcba4f37d69a1a36c4add51a2a10c3f0c8b2ccd7
2018-02-07 19:22:05 +00:00
KongQun Yang 221ac81772 Prefer Period@duration for static MPD with >1 periods
It is easier to insert Ad Periods with Period@duration compared to
Period@start.

Change-Id: Ib52e81612562bf60b0e0513a09d9a31c42b09604
2018-02-07 01:13:28 +00:00
Aaron Vaage 48cb55c8d4 Correct WEBVTT Header In Sample Test Files
The old vtt sample data has the header as "WEBVTT FILE" which does
not reflect what the spec says it should be.

This changes it to "WEBVTT" as described in the WebVTT spec.

Change-Id: Ib54396a8b937501a835dafe966bf05b95b0b22c4
2018-02-07 00:07:16 +00:00
KongQun Yang 2d5e2b0903 Fix DCHECK of SimpleThread on invalid command line options
- Construct SimpleThreads only after all workers have been successfully
  initialized

b/72999680

Change-Id: I4016321a4bdd27b1de746c50c5f1d7a60d7ae9f1
2018-02-06 22:41:38 +00:00
KongQun Yang 8257eea804 Bug fixes and clean-ups for I-Frame playlists
- Add empty lines between different types of renditions to improve
  readability.
- Group variants with the same audio/text group together, as it is
  where the Adaptation occurs.
- Write master playlist after writing media playlists. This makes
  more sense and it is also necessary to have the bandwidth of
  the last iframe playist segment correctly computed.
- For fMP4, I-Frame segment must include the 'moof' header.
- Fix a problem that hls_iframe_playlist_name is not passed to
  MuxerListenerFactory.

Issue: #287

Change-Id: Icf37c5de1dc29f85ae3f419cbc3264d04ca491a4
2018-02-05 17:36:28 -08:00
KongQun Yang 570a2d1a15 Support 'iframe_playlist_name' stream descriptor
Issue: #287

Change-Id: I484761dfacadce05175d16c4c12454f0ed932579
2018-02-02 22:00:18 +00:00
Aaron Vaage 44847a0737 Changed Group Name Fallback
If no hls group name is given, we would default to "audio" but as
we are working to support text, this won't make sense to see
GROUP="audio" on a text stream.

Instead default to "default-audio-group" for audio streams. A specific
text default will be added later.

Bug: #205

Change-Id: Iefc8bfd35708286619d0004348294d98f2c38482
2018-02-01 10:24:58 -08:00
KongQun Yang 4194f0746e [DASH][WebM] Fix subsegmentAlignment not set problem
MuxerListener::OnNewSegment was not sent for WebM SingleSegmentSegmenter.

Change-Id: Iecae84e7a7c1a8a4d3f577158fa286b9c9959934
2018-01-31 19:58:15 +00:00
KongQun Yang 84f1f96f05 Rename SAMPLE-AES-CENC to SAMPLE-AES-CTR
Per the definition in the latest specification:
https://storage.googleapis.com/wvdocs/Widevine_DRM_HLS.pdf

Change-Id: Ic9b222c72ca8fbc4ae011e6557f2c4daaad2e624
2018-01-29 15:45:16 -08:00
KongQun Yang 9ecee46658 Fix SAMPLE-AES EC3 encryption
The IV was incorrectly updated across samples.

Created a new cryptor SampleAesEc3Cryptor specially for SAMPLE-AES
EC3 encryption / decryption. The new cryptor uses constant-iv, and
makes sure the IV is reset to the initial value at the beginning
of each audio frame and chained across syncframes within the the
audio frame.

Also added E-AC3 end to end test.

Fixes #279

Change-Id: I0aa60c17836daeef5ba433a05e5ff0906191d9ac
2018-01-24 03:02:49 +00:00
KongQun Yang 1455f43c02 Share chunkers from the same input except for WVM
Updated test files and added end to end tests for AdCues.

Change-Id: I28f57c2f0d15f65fa04f599fae446a5c1373bf47
2018-01-22 17:43:25 -08:00
KongQun Yang d9871330e7 Move common manifest flags out of mpd_flags.cc
Also updated documentations.

Fixes #304

Change-Id: I5e8e87b005ebfa9dc78d47e2501585b083120f6c
2018-01-19 21:02:54 +00:00
KongQun Yang 3c30ec3a11 Fix test failures in previous CL
Change-Id: I54dea7fe62f30a9a9648559922c02d5bad0236e3
2018-01-18 18:26:10 -08:00
KongQun Yang 32d26094ba [HLS] Support AUTOSELECT and DEFAULT in EXT-X-MEDIA
According to HLS spec: https://goo.gl/MiqjNd 4.3.4.1.1. Rendition Groups
- A Group MUST NOT have more than one member with a DEFAULT attribute of
  YES.
- Each EXT-X-MEDIA tag with an AUTOSELECT=YES attribute SHOULD have a
  combination of LANGUAGE[RFC5646], ASSOC-LANGUAGE, FORCED, and
  CHARACTERISTICS attributes that is distinct from those of other
  AUTOSELECT=YES members of its Group.

We tag the first rendition with a particular language in an audio group
with 'AUTOSELECT'; it is tagged with 'DEFAULT' too if the language
matches --default_language.

Fixes #315

Change-Id: Iacc0bc8c89ebffce8717fa65e82d6daf5a1f6adc
2018-01-19 02:10:07 +00:00
KongQun Yang 53892c7467 Add end to end test for ac3
Also updated bear-640x360.ts test files.

Change-Id: Iff53800b7b4706fb2f6d94682b9446406a94cd6f
2018-01-18 17:23:20 -08:00
Aaron Vaage 49933737cd Moved MuxerFactory to own file
To remove the direct dependencies between packager.cc and the different
muxer implementations, this change remove the muxer factory to its
own file.

Change-Id: I4a1503c493f0f4d10a67e78461f96da3f4238944
2018-01-10 17:51:26 +00:00
KongQun Yang fcc334d652 [Doc] Fix a few problems
- Add --time_shift_buffer_depth to HLS doc.
- Fix a problem in HLS tutorial

Partially address #304, fixes #305

Change-Id: I60bc1eb659a30beb0a6ab73433f4cc99a7deab07
2017-12-21 23:07:59 +00:00
Michael Stillwell a8f46fcd2e Update playlist_name docs (#307)
Make it clear that shaka packager will create the playlist file.

#305
2017-12-20 10:25:58 -08:00
Aaron Vaage dedbd8b724 Isolate Job Management
Moved all code dealing with jobs into its own class so that the
packager code does not need to worry about initializing, running,
or stopping jobs.

Change-Id: I3e9ef1f22bd93d671f77d59ad15f23d1239078cf
2017-12-13 18:35:51 +00:00
KongQun Yang 2d025dae2d Include shared_library and mpd_generator in ci and releases
Change-Id: Ie9449cbca711324831cb15e83d0efaf7a43cf9ef
2017-12-12 23:11:01 +00:00
KongQun Yang b3194866a6 [HLS] Add CHANNELS attribute to #EXT-X-MEDIA
As specified in HLS spec (https://tools.ietf.org/html/rfc8216):

All audio EXT-X-MEDIA tags SHOULD have a CHANNELS attribute.  If a
Master Playlist contains two Renditions encoded with the same
codec but a different number of channels, then the CHANNELS
attribute is REQUIRED; otherwise, it is OPTIONAL.

Fixes #299

Change-Id: Ic2308c39b170178b11cb0d94c3a8083c8b5f3353
2017-12-12 01:04:21 +00:00
Kamesh Devarakonda dac0328b47 Parse ad_cues flag.
Change-Id: I4f5897dcde20e73a01468b80a04d3f3142bc5e42
2017-11-20 16:39:16 -05:00
Kamesh Devarakonda 8c877379b6 Defined Scte35Event struct and out of band cue marker flags
Change-Id: I5a4db1a691544cbedf2ccfbaf6f71169a8eed6e7
2017-11-16 00:13:29 +00:00
KongQun Yang 5cf2b17ade Add --hls_key_uri to allow setting fairplay/identity key uri
Change-Id: I52e0f56cd10390faf515170f407ea488a6b3c9fc
2017-11-14 15:49:27 +00:00
KongQun Yang d66d307fc2 Rename fixed_key to raw_key
Change-Id: I1ee9398387b54aa685a5bef5b8704849e62ebae3
2017-10-24 21:52:01 +00:00
KongQun Yang 7c38963c29 [doc] Update raw key tutorial
Change-Id: Ife841975c036cf8042c9775583c409e0daa089c7
2017-10-24 21:51:39 +00:00
KongQun Yang 1bf1ec2445 Add multi-key support in fixed/raw keys
The keys can be specified in --keys option, with the form of
  label=<label>:key_id=<32-digit hex string>:key=<32-digit hex string>,label=...

There can be multiple "label=..." block. The DRM label can be one
of "AUDIO, SD, HD, UHD1, UHD2" or a custom label.

Mark --key and --key_id as deprecated. We can achieve the same result
with --keys=label=:key_id=<key_id>:key=<key>.

Also add a new optional field in stream descriptor: drm_label, which
is used to overwrite the internally generated DRM label for the stream.
If not provided, the DRM label is generated automatically based on
audio/video information, e.g. resolution.

Code changes:
- Merged RawKeyEncryptionParams and RawKeyDecryptionParams into
  RawKeyParams.
- Make FixedKeySource accepts RawKeyParams as input.

Change-Id: Ic8c2f071cc71188e13f14bc6396fc2b3ffa5cac6
2017-10-24 21:04:49 +00:00
KongQun Yang c9cc68ba82 [Playready] Allow unencrypted client cert private key
Change-Id: I3244b428f8e3e32787520d9dd0f015e6d9301fe0
2017-10-18 21:37:36 +00:00
Joey Parrish e2bb22c633 Update docs for HLS descriptor fields
These fields are no longer required, and have sensible defaults.

Change-Id: I35bd489c8e6058f3272210cb6f3b0f504819e7c0
2017-10-17 11:37:44 -07:00
KongQun Yang e889578a2d Creates directories in the output path if not exist
Also added end to end tests for single segment HLS and multi-segment
HLS.

Fixes #276

Change-Id: I27e5d57cdc3ab79a8e5ae0c3a8da46fcf2c467b6
2017-10-11 20:19:51 +00:00
KongQun Yang 0861452932 [Test] Rotate key_ids in PSSH as well for key rotation
Note that fixed key / raw key rotation should not be used in production.

Change-Id: I87fca41ebd00f3cadbf157ff129b8e6a9ca04e7c
2017-10-09 16:44:14 -07:00
KongQun Yang 937ecfbdcd Move language tag convertion to packager.cc
This fixes shared_library not able to compile problem.

Also removed StreamDescriptorList and replaced with expicit
comparison to make the code clearer.

Also removed an out-dated DCHECK that mpd_notifier and hls_notifier
does not co-exist.

Change-Id: I3d04b8880741fecf0931a764cc12e50aa5e392b9
2017-09-29 18:05:03 -07:00
Aaron Vaage 8067fd4818 Made Trick Play A 1:1 Handler
Before the trick play handler would have one input and multiple
outputs. The normal media handler API for adding handlers had to
be ignored when setting-up the trick play handler.

This changes the trick play handler to have one input and one output.
It uses the standard AddHandler method calls. When initialized, the
trick play factor must be provided.

This included a run of 'clang-format' over all edited files.

Change-Id: I7b3cdf0a2472e2f89ab194867c4b984e26f18f24
2017-09-26 08:25:04 -07:00
KongQun Yang 21b0ca6ea5 Cleanup README
Moved build instructions and docker instructions to separate docs.

Removed command samples which are no longer needed as we have better
tutorials now.

Change-Id: I340c5653a6553158325970dd86d76fa11e69bcbd
2017-09-19 18:44:39 -07:00
KongQun Yang b5e6cf36ab Remove the all zero KID in manifest for key rotation
Closes b/64035941

Change-Id: I382b6478889dd73bc422decf0cbf4d32cd9bb68d
2017-08-29 20:44:32 +00:00
KongQun Yang 675f2631b8 Move HlsParams to hls_params.h
Change-Id: I25189623512834da8bd998c388c4cb0edebc6f47
2017-08-18 11:57:41 -07:00
KongQun Yang 556ff56559 Consolidate MpdParams into MpdOptions
Change-Id: I7f37277ef87597548c2fbf219963cd8725ae4c05
2017-08-18 11:57:41 -07:00
KongQun Yang 4e82ab13bd Consolidate Mp4OutputParams into MuxerOptions
Change-Id: I533e40ef9eb84453c15cbdb7ef42fc85bef5125d
2017-08-18 11:57:34 -07:00
KongQun Yang 9eaf1dcae0 Consolidate ChunkingParams and ChunkingOptions
Change-Id: Ibbb85981d2b424432b61ca693e28334ef00d475e
2017-08-18 11:55:45 -07:00
KongQun Yang c7c201b00c Consolidate EncryptionParam and EncryptionOptions
Change-Id: I8a5b5c329d4731341a3184d50bed061aa00cdeda
2017-08-18 17:37:45 +00:00
KongQun Yang b451d3a7ca Consolidate various playlist_type types
Change-Id: If6fafc0867e7e1f3cd2ed612617e91c7cb144f20
2017-07-21 20:43:14 +00:00
Yohann Connell 8d2b87c773 Adding the ability to provide the group_id in Widevine Cenc requests
Change-Id: I4903cc9422433f20b76d084578d8fc06d7ed45a8
2017-07-20 09:46:25 -07:00
KongQun Yang eb98a87f7d Move packager/media/file to packager/file
Change-Id: Idc0d75a7ceab7c8ce460ef896fdefdec088124bb
2017-07-17 12:08:28 -07:00
KongQun Yang 11210b400a Workaround Edge problem with non-zero clear lead
Somehow Edge requires sinf box to be put after avcC box:
https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12658991/

b/37913785

Change-Id: I201c96768328b3910001dba49a9ddda7f06f3c20
2017-07-06 22:48:09 +00:00
KongQun Yang 3bad4ca700 Move status.h under packager/
Change-Id: I4a7f34c575c1c8b9a9a275f3889cf8641cfdd471
2017-06-30 11:35:18 -07:00
KongQun Yang e56d1faaf0 Make HLS with key rotation work
- Remove the TS key rotation not supported check as there is nothing
  to be done for key rotation in TS for SAMPLE-AES.
- Fix IV updated problem in new segments even if crypto period does
  not change.
- Avoid duplicate EXT-X-KEY tags if it does not change.
- Make EXT-X-DISCONTINUITY-SEQUENCE match with number of removed
  EXT-X-DISCONTINUITY.
- Added end to end test for HLS with key rotation.

Change-Id: I73cb82e9f5575fcdf63ee643228efe78e6766302
2017-06-29 21:03:36 +00:00
KongQun Yang 5bad2fbd5c Update the description for @bandwidth to make it clearer
Change-Id: Ib5a084c0ffea9efe0b4173248daddc53498c4498
2017-06-24 01:09:55 +00:00
KongQun Yang b4aa34b803 Support live and event HLS playlists
Closes #114

Change-Id: I6440383c3dc022fba5a9926839f79b9ed8a51f55
2017-06-24 01:09:32 +00:00
KongQun Yang 96ced40ec2 Move command parsing tests into separate class
Change-Id: I6aeba632d69b1867c7d7745f0c8c9fd8f8e275d9
2017-06-20 22:33:55 +00:00
KongQun Yang 03889e6465 Move hex string out of packager.h
Also added validation failure tests in packager_test.py.

Change-Id: I6697a3138d57889110250404205536dd5cd53cd0
2017-06-20 22:33:47 +00:00
KongQun Yang 096c22ee63 Rename shaka::ShakaPackager to shaka::Packager
Change-Id: I493d3a6cf4c27615d1515de7c43dc3c5b8e3224e
2017-06-16 23:08:06 +00:00
Aaron Vaage 0caab0a4b4 Add resolution to HLS manifests
The HLS manifests output by the packager did not have the RESOLUTION
attribute on EXT-X-STREAM-INF tags. This change adds the resolution
tag when resolution values are present.

Close #235

Change-Id: I15ca6de47cb34793cf6a940123d593261627baa4
2017-06-16 01:28:55 +00:00
KongQun Yang 05a5a41969 Support generation of libpackager.so (shared_library)
Shared libpackager can be built by setting libpackager_type to
shared_library, e.g.

GYP_DEFINES='libpackager_type=shared_library' gclient runhooks
ninja -C out/Debug

will generate libpackager.so in out/Debug/lib directory.

Here is a few other changes to make shared_library builds and
tests pass:

- Add several test parameters to packager.h, which is needed for
  testing.
- Create a protoc.gypi from build/protoc.gypi but depending on
  protobuf_full_do_not_use instead of protobuf_lite, since we need
  protobuf_full_do_not_use for text parsing and generation of media
  info proto. Somehow shared_library build does not allow mixed use
  of protobuf_full_do_not_use and protobuf_lite.
- Remove the use of LazyInstance in version/version.cc and use static
  variable directly. This is because LazyInstance needs AtExitManager
  which may not be easy to setup when calling GetVersion.
- Allow skipping testPackageWvmInputWithoutStrippingParameterSetNalus
  with flag --shared_library, which is needed as shared_library build
  does not support --strip_parameter_set_nalus flag yet.

Fixes #227

Change-Id: Iff05a50baa28134faa7218664c96114cb9e70329
2017-06-13 20:42:32 +00:00
KongQun Yang 2816a7262e Integrate packager top level library
Change-Id: Ic2e2ef79d2f5db5aab6565835aaaf6cb1c7e44bb
2017-06-13 13:40:26 -07:00
KongQun Yang db45711750 Implement top level API: packager.cc/h
Change-Id: I2b4fbc0b9f6df5617e9f59173e144c7be1b01d2b
2017-06-13 19:23:34 +00:00
KongQun Yang a0bd3dd565 The retired availability_time_offset flag should have value 0
Change-Id: I6a34c362c0c5252853f0883b54c19c434bd1d8b8
2017-06-01 14:55:16 -07:00
KongQun Yang 19be04ecce Fix git not found on some Windows setups
Change-Id: I0403212f383e60ef75b426170783933f4d73b211
2017-05-26 13:52:42 -07:00
Haoming Chen 32b088c4bc Add sample usage for trick play in README.md.
Change-Id: I1c1f4af37b3573ffdbcc4368826417f1d07da437
2017-05-23 18:33:33 +00:00
KongQun Yang 18cdbd4121 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
2017-05-22 23:14:16 +00:00
sylt bfe302bd5c Add support for skip_encryption stream descriptor (#219)
This option makes it possible to control encryption for specific streams,
e.g. for audio and video separately.
2017-05-22 10:17:58 -07:00
Haoming Chen da8877d8a2 Rename trick play rate to trick play factor.
- Add a "tpf" abbreviation in stream descriptor for
  trick_play_factor.

Change-Id: Ia09313bb9778456b53bdb0a8cc46d2ba8caa2ac2
2017-05-17 21:51:34 +00:00
Kongqun Yang 5fc6e540f3 Include protection_scheme in Widevine CENC request
Widevine license server added support for protection_schemes recently;
If CENC request includes protection_scheme in the CENC request, server
will return with a PSSH with protection_scheme filled in.

Change-Id: I6dcac498b5e039503d6ac0f6e057737f7c53efaf
2017-05-16 01:18:39 +00:00
KongQun Yang d9e7e2f1d0 Generate two sample entries only if there is clear lead
This addresses playready broken with clear lead = 0.

clear lead != 0 is still broken with playready on Edge. We think it is
likely an Edge bug, which does not support multiple sample entry boxes,
thus does not support clear lead.

b/37913785

Change-Id: I7adb77a913dccf669153b03b31b4a1e1c98d1cb0
2017-05-15 14:13:52 -07:00
Haoming Chen 4ba5bec660 Integrate trick play.
- Add trick play adaptation in mpd. This addresses #178.

Change-Id: Id6cc08c788eda074c261d0274768051837b84541
2017-05-09 13:33:11 -07:00
KongQun Yang 1e2da22c88 Add support for WebM colour element
Change-Id: I359cde97171118d3b928a9dd6650d11fade8f4a9
2017-05-02 20:22:17 +00:00