Commit Graph

538 Commits

Author SHA1 Message Date
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
KongQun Yang e97c89391a Address flakiness in ProducerConsumerQueueTest
1. Expect the time elapsed to be greater than kTimeout instead of
   approximately equal to kTimeout if there is a "wait";
2. Expect the time elapsed to be smaller than kTimeout instead of
   approximately equal to 0 if there is no "wait".

Also rename a variable in packager.cc to better reflect what it is.

Change-Id: I67975a6263b8dbc1124b78feae0f8e0d112bda50
2017-12-05 22:56:22 +00:00
KongQun Yang 9631ec71de Roll curl to 7.56.1
Fixes #285

Change-Id: I3cda80974e8cc66f11763c41c36d832565077374
2017-12-04 19:28:27 +00:00
KongQun Yang 7097270f13 Roll boringssl to fc9c67599d9bdeb2e0467085133b81a8e28f77a4
Change-Id: I8ff75ede6c5b6a51719163d208c96d6ec0be61bc
2017-12-04 19:27:34 +00:00
KongQun Yang 82e0fd2095 Default multicast interface address to "0.0.0.0" if absent
It aligns with what a lot of other apps are doing, e.g. tsplay.

Also added notes in docker to adjust network setting if wants to use
multicast in docker container.

Change-Id: I666a8979cc041c904f7ff8e3e022f800c0830d5d
2017-12-04 19:21:52 +00:00
KongQun Yang 0fdb0d02aa Log an error when seeing unsupported stream type in MPEG2TS
The error is logged only once to avoid log spamming.

Added definitions for the unsupported stream types for easy look up.

Change-Id: I097e2f05759bc84ef03f264cfabd2fb20da7c711
2017-12-01 14:56:22 -08:00
Kamesh Devarakonda e7540bf303 Dispatch Scte35Events.
This patch also fixes a bug which was introduced in
https://widevine-internal-review.googlesource.com/c/packager/+/38040
where it was inconsistently assumed that AdCueGenerator would be MIMO
while connecting with other handlers and at the same time it was assumed
SISO in the AdCueGenerator class. Now we assume SISO everywhere.

Change-Id: Icd8c40b5ccfe0d98f47f09a60ea1635f74dceef9
2017-12-01 02:23:36 +00:00
KongQun Yang 068e220ac7 Handle additional unused 'mdat' properly
The spec allows having more than one 'mdat' boxes even if it is not
used.

This is happening on some mp4 files in the wild:
http://www.sample-videos.com/.

Fixes #298.

Change-Id: I729cc94bee095560b5c4b3ee8511323f25f7ad5a
2017-12-01 00:28:30 +00:00
l-law 22c758ed06 Fix order of VPS, SPS, PPS in hvcC box of HEVC/MP4 (#300)
Fix order of VPS, SPS, PPS in hvcC box of HEVC/MP4

Fixes #297
2017-11-30 14:34:42 -08:00
Kamesh Devarakonda cc778f60ab Defined CueEvent struct.
Change-Id: If4ba55a7ff403248de9d0411c2ba8553b88c491b
2017-11-28 14:26:32 -05:00
Kamesh Devarakonda c4e7d02b80 Connect AdCueGenerator in the pipeline.
Change-Id: Iaae73661bc57ddecd2cc103dbd34d0c3102ffdaa
2017-11-27 21:09:26 +00:00
Kamesh Devarakonda 154e309f3f Remove unused argument.
Change-Id: I1ee3ca6527ec4ecce7dd57e18eee70a8c6a11eb0
2017-11-21 15:04:36 -05:00
Kamesh Devarakonda dac0328b47 Parse ad_cues flag.
Change-Id: I4f5897dcde20e73a01468b80a04d3f3142bc5e42
2017-11-20 16:39:16 -05:00
Kamesh Devarakonda 622ff64595 Add skeleton AdCueGenerator handler
Change-Id: I53ba982eb76c7f61122e226d295e6989fe425ae5
2017-11-17 00:06:27 +00:00
Kamesh Devarakonda dcf2d2fc0b Created a build target for files in media/public/
This new build target is explicitly listed in the packager/packager.gyp
file.

Change-Id: I49e68ea64ae9a9a30204a269a1af17744f9d25d7
2017-11-16 00:24:17 +00: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 61e36d7d21 Support encrypted E-AC3 in TS
Implemented E-AC3 MPEG-2 Stream Encryption Format for HTTP Live
Streaming specified in https://goo.gl/1sgcwY

Issue #279

Change-Id: I36c1a05e3d0529ff810eaf52bdca45414baa93eb
2017-11-13 22:54:07 +00:00
Kamesh Devarakonda 09cdb2bbec Removed unused structs PeriodInfo and MediaEvent.
Change-Id: I0504853ec555fd161df21e5680d26aab50648052
2017-11-09 17:28:31 +00:00
KongQun Yang 0a69779f7c Fix a parsing problem with AC3 in TS
Audio samples per frame for AC3 was not specified correctly earlier.

Also the number of channels is not correct if LFE channel is on.

Issue #165

Change-Id: Ibf20aa4c7aec43c07ec7cd394d631c537cb387dd
2017-11-07 18:47:09 -08:00
KongQun Yang 72df5af150 Support encrypted AC3 in TS
Implemented MPEG-2 Stream Encryption Format for HTTP Live Streaming
specified in https://goo.gl/N7Tvqi.

This change also moved ProgramMapTableWriter creation from TsWriter
to TsSegment.

Issue #165

Change-Id: Ia89dd16a5e6405706dd3d85ec6b6de580f7b13a7
2017-10-30 15:22:22 -07:00
KongQun Yang d7f531fe10 Add AC3 support in TS
EC3 and encrypted AC3 in TS are not handled yet.

Partially address #165

Change-Id: If4839ee7801eac902e64e9c677dd37709ec8e88b
2017-10-30 15:11:43 -07:00
KongQun Yang ad836a5cf1 Rename EsParserAdts to EsParserAudio
Change-Id: I8d9fc265a4cf740970256e1a46b172349f1bf794
2017-10-27 23:58:50 +00:00
KongQun Yang 79a54d7748 Cleanup ProgramMapTableWriter
Change-Id: I08093a0fc35dc15a20f6e72166ed46d3ab94b334
2017-10-27 23:58:32 +00:00
KongQun Yang 2a2493ec2e Refactor EsParserAdts to handle other audio
Rename will happen in next CL

Change-Id: I28df29bb264eea7a6225b0a4a2eb38de7968f9d6
2017-10-25 23:21:35 +00:00
KongQun Yang 867244645a Implement BitWriter
Change-Id: I5b7dfc2bc07227c2fe05f6de8857042bcab944c4
2017-10-25 16:19:12 -07:00
KongQun Yang b5a8185543 Refactor ProgramMapTableWriter
To make it easier to support more codecs.

Change-Id: Ifcde0f3d7d6f74015d723a0b74401a86c8e65a72
2017-10-25 20:25:56 +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 27c1900f12 [pssh-box] Support generating Widevine PSSH without content-id
Widevine PSSH with key-id and without content-id is now be supported.

Change-Id: I356590b79f79ff4c0310b22e5dc19b6d24ec4cee
2017-10-18 21:38:23 +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 c87c4c2327 [HLS] Fix single segment ULR isn't respecting folder location
Fixes #253

Change-Id: I61de1b28807ff8be9a881edd3adaa36612713dd8
2017-10-11 00:14:09 +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 ae17159b73 [HLS] Fix init segment URL isn't respecting folder locations
Problem occurs when the media playlists are in a sub-directory under
master playlist. If base_url is not set, segment URL should be
relative to the media playlist.

This only affects fMP4 as TS does not have init segment.

Fixes #253

Change-Id: Icddd9ed500d0a705e8b3260bfd4e916ecbba3f28
2017-10-06 17:19:13 -07:00
KongQun Yang 94a64bef03 Fix WebM parsing crash when the source content contains color elements
Also updates outdated comment in packager.h related to multi-manifests.

Fixes #275

Change-Id: Ia2eb235607860f92a3c19bd791d711209da85c08
2017-10-06 22:48:04 +00:00
Aaron Vaage 65d5ecc3cf Separated Text Processing From Audio/Video
To help isolate the differences between audio/video and text in
preparation for adding the better text support, this change moves
all audio/video job creation and text job creation into their
own functions.

Change-Id: Ia71cf82ac147672b70c69123eeabdfc6b41c4a3d
2017-10-02 11:31:20 -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
KongQun Yang 9a60760815 Change MediaSample::CopyFrom to MediaSample::Clone
Change-Id: Ibc8e6ba149496bb62179230e95aa6803a015b12b
2017-09-29 09:58:39 -07:00
KongQun Yang 92e1e39868 Update MediaSample to avoid redundent copying
Use std::shared_ptr<const uint8_t> with a custom deleter to
represent MediaSample::data_ instead of std::vector<uint8_t>.

MediaSample::data_ can be shared by multiple MediaSamples and it is
immutable. A new data instance must be created if the clients want to
modify the underlying data. The new data instance can be transferred
to MediaSample using provided MediaSample::TransferData function.
This avoids unnecessary data copying.

Change-Id: Ib59785a9e19d0abb3283179b12eb6779ee922f79
2017-09-28 14:01:30 -07:00
Aaron Vaage 6c0f2bebef Use TrickPlay Test Structure As Common Test Structure
Took the test structure for trick play and made a common test
structure that can be used for new tests. The next tests to
use this structure will be the new WebVtt pipeline.

Change-Id: I5faca306b8a2bd16b9f945d1ff5c336aed82bc35
2017-09-27 22:10:08 +00:00
KongQun Yang 9cb4018235 Add check formatting script
The script can be set as pre-commit hook to run clang-format
check automatically on every commit.

Change-Id: I05c8e5266ebc773c7949c64d7a885809070a58ec
2017-09-27 21:52:34 +00:00
Aaron Vaage 23a2893a35 Define Text Sample Matchers and Test Functions
This change create some matchers and text functions that
will be used by the upcoming webvtt work.

Change-Id: I2d7931d1bdabd761f74e8aee7524d5ecfb7cfdc4
2017-09-27 09:44:56 -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
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 b5800fad77 Created Mock Input and Output Media Handlers
Created media handlers that make testing a handler easier by providing
methods to send messages from upstream and check messages downstream.

Change-Id: I7b3ba3a51bcf0d73bcaacd46b2dcbc16f87d8694
2017-09-20 15:22:12 -07:00
Aaron Vaage 304f7d2a88 Rename "crypto_handler" to "encryption_handler"
Change-Id: I44307fad6f4f0c4c2f8b61c3c6b07867859c9867
2017-09-20 19:13:01 +00:00
Aaron Vaage 3495025051 Removed unused Muxer Options
Change-Id: Ibdca7ac59cbb9728cc3308b33f9d3d4b96a7d9dc
2017-09-20 10:52:38 -07:00