Commit Graph

584 Commits

Author SHA1 Message Date
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
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 327cb8df88 Update WebM error message when segment is too big
To make it clearer.

#271

Change-Id: I6abfe94b417be293320516cfa654d909412e36c0
2017-09-19 22:30:39 +00: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 bc903d2d83 [HLS] Fix 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, media segment URL should be
relative to the media playlist instead of the master playlist.

Also make sure the path separator is "/" in URL instead of "\" on
Windows.

Fixes #253

Change-Id: I8e933750276435d94dd01bfa53ee2bc050dfd193
2017-09-18 19:11:42 +00:00
KongQun Yang 9c861d03f7 Report an error when disk is full
Previously packaging completes successfully without any error
or warning.

With the fix, an error will be reported if write fails. It may
appear as "Cannot close file error" as we use threaded IO, which
could delay the error reporting until Close() call, so the user
of the File API needs to make sure Close() returns successfully.

Also fixed a deadlock in threaded_io_file if internal_file->Write
fails.

Fixes #160

Change-Id: I17f945150fb4021d2dcdbe784e557673f53ca583
2017-09-15 22:22:12 +00:00
KongQun Yang 7627871428 Update Doxygen config file
Doxygen should run under src/ directory:

$ doxygen docs/Doxyfile

Outputs are created in out/doxygen.

Change-Id: I9dd1a9aa158851d37ff9a2e37f701757eb3e577c
2017-09-15 22:02:32 +00:00
Aaron Vaage 28385c0fc0 Change Text Sample set_style to AppendStyle
To ensure that the style data is formatted correctly, changing the
set_style method to AppendStyle so that joining values will be
done in controlled setting.

Change-Id: Ia88e2d260b11339e6777ff018813e8aeb802a501
2017-09-14 18:37:42 +00:00
Aaron Vaage a9d957e7f0 Move Muxer Creation To Own Method
Moved all the code to do with creating a muxer to its own function to
help isolate it.

Change-Id: Ib259da7aaa41d325632d5f9bb3d54ae9df8d0e31
2017-09-11 12:23:07 -07:00
KongQun Yang ea45ce3158 Add support for callback file
Change-Id: Ieb116bf3f645a35601f1182ed139c59ddaab8ad8
2017-09-07 19:26:26 +00:00
Aaron Vaage 7c5508555c Made Verify Functions Return Status
There are multiple functions we use to verify input from the user
and must of them would return a boolean expect for the top level
function which would return a Status. Each function would log a
message but to the user the error was not clear. This change makes
each verify function return a status so that the actual problem
will be surfaced easier.

Change-Id: I12ab43f8ca3a4d379b4309336644a70eb8cbbbe0
2017-09-06 22:22:55 +00:00
Aaron Vaage f2cbe8f9c1 Moved Encryption Handler Create to Own Method
Moved all the code used to create the encryption handler for a stream
to its own function.

Change-Id: I8801a194b470d899aa9fb26b4664e36e61d5d164
2017-08-30 16:26:41 -07:00
Aaron Vaage ec83d8a73a Implement MsToWebVTTTimestamp
Implemented the other end of the webvtt timestamp parsing as it will
be needed when we write out WebVtt files. Also changed the name of
the parse function to be more inline with the writing function.

Change-Id: I1f36ddbbf80028732b4cb1b15e871dec17767f63
2017-08-30 18:30:43 +00:00
Widevine Buildbot f20ad03caf Merge remote-tracking branch 'github/master' into HEAD 2017-08-29 20:46:52 +00: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
Ivan L. Isaev 1706b0bc3a multi-manifest (e.g. DASH + HLS) output support
Fixes #262
2017-08-29 13:42:33 -07:00
Aaron Vaage 2539920a5d Return Status from CreateRemuxJobs
Inside of CreateRemuxJobs, we would take a status value from another call,
log the message, and return a boolean. The caller of CreateRemuxJobs would
then create status from the boolean.

Now we will pass the status value from the other call directly to the caller
of CreateRemuxJobs. So that failures can be better communicate in our code.

This includes a pass of clang-format over packager/packager.cc.

Change-Id: I071e7bad13f916e963641b9e53699573fe1060ed
2017-08-28 12:57:23 -07:00
Aaron Vaage 591fd5456e Cleaned Up RunJobs
Rewrote the RunRemuxJobs function to use waitable events so that we never
get stuck waiting for a job to finish before getting to a thread that
has already exited.

This should allow us to end execution when a job failed rather than
waiting for all jobs before the failed job to finish.

Closes #94

Change-Id: I413f62561a7a4cab83b8905e75986230b6c498bc
2017-08-22 23:03:44 +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
Aaron Vaage e605203fa7 Added Origin Handler
Created a handler called OriginHandler that can be used by the Job class
(previously called RemuxJob). Origin handlers represent the start (or
origin) of a pipeline (chain of handlers).

Change-Id: Ibd748ae0a932b6e0ebb879ea292fcb83c548214b
2017-08-18 09:20:10 -07:00
David Cavar 34c5e011a5 Fairplay key system support
Support generation of fairplay key system tag: "com.apple.streamingkeydelivery" when --pssh 
includes fairplay key system id:

// Unofficial fairplay system id extracted from
// https://forums.developer.apple.com/thread/6185.
const uint8_t kFairplaySystemId[] = {0x29, 0x70, 0x1F, 0xE4, 0x3C, 0xC7,
                                     0x4A, 0x34, 0x8C, 0x5B, 0xAE, 0x90,
                                     0xC7, 0x43, 0x9A, 0x47};

Closes #258
2017-08-08 10:31:40 -07:00
KongQun Yang 085e038b89 Include /etc/ssl/ca-bundle.pem in curl ca bundle
This fixes cannot find curl ca problem on OpenSUSE.

Change-Id: I6c42abb48700d4c5c857cdeb647aa421681e6365
2017-08-04 12:28:02 -07:00
KongQun Yang 9e3dc06d20 Fix file permission issue with manifests
ImportantFileWriter::WriteFileAtomically uses mkstemp internally,
which set file permission to 0600, which is not what we want.
Update the code to not use mkstemp instead.

Also updated temporary file name logic to include process id in
the name so it can be unique across processes.

Fixes #259

Change-Id: I2d5a375925cf552bc0db5269f409d7522e63fca5
2017-08-01 15:42:55 -07:00
KongQun Yang 723079310f Disable IP_MULTICAST_ALL when setting up UDP multicast
This avoids interference caused when two sockets are bound to the
same port in different multicast groups.

Fixes #241

Change-Id: Iba1b3300e3850f1f268886b7a49f5a3315d95b80
2017-07-27 18:02:51 -07:00
KongQun Yang b451d3a7ca Consolidate various playlist_type types
Change-Id: If6fafc0867e7e1f3cd2ed612617e91c7cb144f20
2017-07-21 20:43:14 +00:00
KongQun Yang 61c58724ec Remove size parameter in OnMediaEnd
Derive file size from media ranges instead.

Also fix subsegment range reporting for WebM (internal variable,
no output affected).

Change-Id: I5f8152dff4c2cd5fbae5550992b86a669e278f7b
2017-07-21 20:42:44 +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 cc92cca6b9 Enable C++11 in gtest
Change-Id: I2860a34eee12bc2bdb584cc89c871da0ffb127ff
2017-07-17 20:14:23 +00:00
KongQun Yang eb98a87f7d Move packager/media/file to packager/file
Change-Id: Idc0d75a7ceab7c8ce460ef896fdefdec088124bb
2017-07-17 12:08:28 -07:00
Rintaro Kuroiwa a4c227f74a Add quotes around BYTERANGE attribute
- EXT-X-MAP BYTERANGE attribute requires quotations around it.

Change-Id: Iee073b4c40bbf41b4dc319e8a447905c004cea3b
2017-07-13 17:15:09 -07:00
Rintaro Kuroiwa 013a83c9d4 Change MediaPlaylist to return display resolution
- The master playlist should have the display resolution instead of the
  encoded resolution.
- Changed MediaPlaylist to return display resolution.

Change-Id: I162727d0bdeed0302518286e42a22b69a58fc4a3
2017-07-13 13:25:36 -07:00
Rintaro Kuroiwa d096f4b485 HLS byte range
- Use byte range format if segment_template is not set in MediaInfo.
- Change HlsNotifier::NotifyNewSegment() to take start byte offset.
- Change HlsNotifyMuxerListener to cache the segment information if
  MuxerOptions::segment_template is set.

Change-Id: Ida1b8b9198acc5c43e3a5d9a641c78c81bc9a6ac
2017-07-12 17:19:56 -07:00
Rintaro Kuroiwa 0dfdace280 Change MuxerListener::OnMediaEnd to take ranges
- Changed OnMediaEnd() to take (sub)segment ranges.
- Define a structure to pass the ranges.
- This requires muxers to "cache" the segment ranges but in most cases,
  they already do it, e.g. 'sidx' for mp4.

Change-Id: I16b974c1f0f54ca658cc6dbe605efff84a3f52eb
2017-07-11 15:59:16 -07:00
KongQun Yang 2db1867951 Write manifests atomically
In the original manifest updating process, the file was truncated first
before was written with new contents. There is a small chance that
the web server may read back empty file or incomplete file.

The new code makes the update operation atomic (by writing to a temporary
file first then replace the old file with the temporary file).

Fixes #186

Change-Id: I2fd564cb12b922b032c0e9f70d2132a5b12ff098
2017-07-07 11:05:19 -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 627af1558e Use VLOG(1) instead for unsupported stream type
Change-Id: I8ec3027edefa07f32bba3d3b39d0804d706d3798
2017-07-05 23:09:58 +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
Rintaro Kuroiwa e2401f02ec Make NaluReader skip encrypted portion
Change-Id: Ibb47a1e62cd8ac3057c8f1512a88280991e48b62
2017-06-22 22:09:59 +00:00
KongQun Yang a678948db4 Update gyp to generate standalone static libpackager
Change-Id: Ic62b2e4e8a9529da936aa5c64e93faad7187a79a
2017-06-22 13:38:27 -07: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 abbd495ad4 KEYFORMATVERSION should be 1 for HLS Widevine key system
Change-Id: I59c7852727b803bcdb1e49d33e36fca7f51e507c
2017-06-20 22:33:03 +00:00
Aaron Vaage 7c48cc4800 Group MediaPlaylists in AddMediaPlaylist
Resolving TODO in packager/hls/base/master_playlist.cc that asked for
media playlists to be grouped when they are added.

Change-Id: I01c7687400bc74ce45f271d0242d1c3bf3610cf2
2017-06-20 14:35:52 +00:00
Haoming Chen 78f4fd9d3f Fix an issue in NalUnitToByteStreamConverter.
- This fixes the issue when one NAL unit has multiple
  subsamples, which is allowed in spec and could happen
  when the clear_bytes exceeds 2^16 bytes.
- The new algorithm updates the subsample entries in
  following steps:
  1) When NaluReader parses a new NAL unit, the
  function splits subsamples and align them with the
  NAL unit. It also finds the range of subsamples
  for that NAL unit.
  2) Drop or update subsamples of that NAL unit,
  based on the type. Other inserted bytes are treated
  as a new all-clear subsample.
  3) Merge those subsamples if possible.
- This addresses #237.

Change-Id: I2cab47cd00d90e29ec52b90d4fde057c632193ac
2017-06-19 20:19:11 +00:00
KongQun Yang 096c22ee63 Rename shaka::ShakaPackager to shaka::Packager
Change-Id: I493d3a6cf4c27615d1515de7c43dc3c5b8e3224e
2017-06-16 23:08:06 +00:00
Aaron Vaage 26d39db0e7 Moved Timestamp Parsing For Easier Testing
Moved all the timestamp parsing code into its own class with its
own unit tests. This is to make testing easier.

Change-Id: I624472baba51dfa1254a9f4bae55ebb79e310855
2017-06-16 18:26:16 +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 1aeedd102e Use free-form strings for stream labels (track types)
Change-Id: I38489acbdfaf4bb491635fdc7f6b0cab77a53574
2017-06-13 15:04:00 -07:00