Commit Graph

77 Commits

Author SHA1 Message Date
Thomas Inskip 65e558b19c KeySource changes to support media decryption.
Renamed EncryptionKeySource and WidevineEncryptionKeySource to KeySource and
WidevineKeySource respectively.

Replaced Initialize method with FetchKeys.

Added unit tests.

content_id parameter is now binary. Specified in command line with hex string.

Change-Id: I8010ca62d036cefb3a7c105e0eefee25bbf06d61
2014-09-03 12:06:58 -07:00
KongQun Yang f4d0ef432e Remove "testing" from gtest/gmock include header
This is to remove dependency on Chromium directory layouts, to make it
easier for integration.

Change-Id: If23512c9e4a70462d70ff965e59339a33541746c
2014-08-21 18:04:44 -07:00
KongQun Yang 3e6190ec2b Deprecate normalize_presentation_timestamp
Force earliest_presentation_timestamp to start from 0 by default for
single segment segmenter.

Change-Id: Icfc14e27051c6edfb7a86559045c50a0ce51a62e
2014-07-23 22:55:54 +00:00
KongQun Yang 301f8c134d Enable more compilation checks in clang
These checks were disabled in Chromium due to historical reason.

Also fix compilation errors as a result of the above mentioned change.

Change-Id: I5d240f2f11aa5920598f954d696a15bdcbf78fd8
2014-07-09 21:39:57 +00:00
Thomas Inskip b3d7e7db93 Fix for reported build break.
Fix for broken unit test on 32-bit platforms.

Change-Id: Ie9c314b4ea14be2cb3e51c8b06374b22ffdf9200
2014-07-01 11:54:59 -07:00
Thomas Inskip 79d3c4f4ec Hooked MPD flags up to MpdOptions.
Added calculation of availabilityStartTime MPD attribute.

Change-Id: I00876005c71f28ea83fb5d9ba0ad1f19f1d08e69
2014-06-28 11:28:05 +00:00
Thomas Inskip efe52e62dc Implemented name/value pair stream descriptors.
Implemented user-specified bandwidth.

Change-Id: If01f26867d4285bcbc899310d3f1b98b928bed89
2014-06-30 18:34:18 -07:00
KongQun Yang f609b2947c Key Rotation: Get the initial crypto index from first request
This change also updates the WidevineEncryptionKeySource to be able to support
KeyRotation enabled and disabled requests simultaneously.

Change-Id: I5178cafc0dbabbb64ac9af9969d3bf7d8117a4dd
2014-06-28 11:28:05 +00:00
KongQun Yang 2af92f67d2 More fix for issues on 32-bit OS
Somehow it worked fine on 32-bit Ubuntu but not on 32-bit Redhat.

Change-Id: Icfa4ec651dedd74edadf5a65f997f649c2693115
2014-06-26 23:45:22 +00:00
KongQun Yang 4519dda07c Fix a race condition in WidevineEncryptionKeySource
The race condition could cause incorrect progress in current crypto
period index.

Change-Id: I76a1a3be16e2266fd07b5bbf73cb9470eafaac4b
2014-06-23 15:22:11 -07:00
KongQun Yang 0f49af6cc1 Fix problems on 32-bit fresh linux box
There are two different problems:

1. int64/uint64 formatting: %lu formats unsigned long. However, the
definition of long is different on 32-bit machine and 64-bit machine.
We need to use a macro to format int64/uint64 correctly.

2. The packager target is dependent on openssl.

Change-Id: I5d51a500c3cb8bcd4b4049ab7ec5a985ac486a76
2014-06-23 13:48:41 -07:00
KongQun Yang 1927109818 Adjust WidevineEncryptionKeySource to handle timeout
Change-Id: Iac4a86acae2e522c6cfc84ce02ae7ec1dd30c47e
2014-06-20 21:32:23 +00:00
KongQun Yang 419d463eaa Modify HttpFetcher to use libcurl
With libcurl, HttpFetcher now supports timeout and https.

Two additional changes:
1. Remove happyhttp which is no longer needed;
2. Add README.packager for curl

Bug: 13658515
Bug: 14301830

Change-Id: I13c2835e7feca9abf36e5bb8f7bc35a7db9ec94c
2014-06-20 10:36:24 -07:00
KongQun Yang 5b1980651f Support segment template identifier $Time$
Also add support for format tags.

Also change default fragment_duration to 10s, i.e. to have the same
value as --segment_duration. So by default, only one fragment per
(sub)segment is generated.

Change-Id: I21123723c3998b656037a397eb7b58b3d91721bb
2014-06-09 18:09:12 -07:00
KongQun Yang 1899d5c3b0 Add back Initialize which starts key fetching thread
The key production thread was started in constructor. The default http
fetcher might have already been used to fetch keys before it is modified
by set_http_fetcher. This could lead to flaky unittest.

Change-Id: I977b6450862d87ffeb5cb219bcd46b33d877e550
2014-06-05 18:21:13 +08:00
KongQun Yang cdf0aa178d Support configurable policy in Widevine encryption
Bug: 13658473
Change-Id: I90bbaa2e34687e7456c9a247d51c64cd91782891
2014-06-05 17:58:19 +08:00
Thomas Inskip fe744f4724 Made video decoder configuration changes into a non-fatal condition.
Issued warning rather than exiting with an error so that playback
may (hopefully) continue. We see this type of situation with the
Envivio encoders, which effect trivial changes in encoding midstream.

Change-Id: Ifa552066f602157adbfa0b882cb75e479b067645
2014-06-04 17:43:33 -07:00
Thomas Inskip 7fe5b5171a Renamed packager_main to single_packager.
Did some re-factoring to share code with upcoming (multi stream) packager.

Change-Id: I2b3845e48ba6aa63a95ecc276abcb52c8355d8d5
2014-05-27 15:42:10 -07:00
KongQun Yang 815b90753f Use OpenSSL RAND_bytes for random IV generation
base::RandBytes may not be cryptographically strong.

Bug: 13658504
Change-Id: Id5dcd4e512f05c2f06302654277f2fd11a53f2b7
2014-05-07 17:34:11 -07:00
Kongqun Yang 1f315ba921 Support key rotation in widevine encryption key source
Change-Id: I05ded15fa666119c86a1d3f1c99123b9cda60b49
2014-05-07 18:37:01 +00:00
Kongqun Yang 1773d08b8d Add new flag max_sd_pixels to determine SD or HD track
Change-Id: If841af98345177cf1832b9e5b91148168b000f44
2014-05-05 11:35:44 -07:00
Kongqun Yang 30cb6948e5 Add MediaParser::Flush to flush the parser
Change-Id: Ic12a045dda47ccd270c8c3e9e83768e04a53ad58
2014-04-29 20:33:04 +00:00
Thomas Inskip 67bdd89ba2 Implemented H.264 byte stream to unit stream conversion and other components
needed for MPEG-2 TS h.264 video demux and transmux.

Change-Id: I878cdd141140cfd6833d75c7133301b1d65f1da0
2014-04-24 18:27:47 +00:00
Thomas Inskip 4a39a0fc98 Renamed mp2t::MediaParser to mp2t::Mp2tMediaParser, removed filters namespace.
Change-Id: Ib4de2863d5e746b32703d49e721473a2ff6c8de7
2014-04-24 10:17:23 -07:00
Thomas Inskip faa12bd191 Merge "Added ADTS header parsing, removal, and conversion to AudioSpecificConfig. Hooked up mp2t media parser, audio transmux now working." 2014-04-23 20:39:05 +00:00
Kongqun Yang 50ed026751 Support key rotation when generating MP4 fragments
Change-Id: I472e03a2d41ee450c12c0fe3012904628d6893e7
2014-04-23 12:54:40 -07:00
Kongqun Yang 9076411044 Rename EncryptorSource to EncryptionKeySource
Change-Id: I0a3d0e205922bbb4015955e04d51b7a9a4fa86e1
2014-04-23 12:45:18 -07:00
Kongqun Yang f059d926d7 Update client of EncryptorSource due to refactoring
This CL also includes two related changes:
  1. Support serialization of raw PSSH box;
  2. Refactor segmenter interface a bit.

Change-Id: I668aa01a5a5ff524ad6fe74976339a3fd499120a
2014-04-23 12:35:52 -07:00
Kongqun Yang 107145c693 Refactor EncryptorSource to prepare for live support
Remove Initialize() and Add AddKey().

Also remove fixed_encryptor_source.* and move the functionality to
encryptor_source.*.

Change-Id: I4fb61013177874a8b81854f10b2deda83accc683
2014-04-23 12:34:13 -07:00
Thomas Inskip 71a425799d Added ADTS header parsing, removal, and conversion to AudioSpecificConfig.
Hooked up mp2t media parser, audio transmux now working.

Change-Id: Idc92a51d25fa6ed2f74627131d53919e52394119
2014-04-22 18:34:36 -07:00
Thomas Inskip cbf4978ffa Modified H.264 elementary stream parsing code to work with remux framework.
Change-Id: I81dfe0952073c4a5cd6f5fcaf14fe21050d26cb6
2014-04-22 12:49:41 -07:00
Kongqun Yang 8df0e1ad0a Fix flaky MultiThreadProducerConsumerQueueStopTest
The main thread may run ahead of the closure thread. In this case,
Stop() could have been called before the first Push() call.

Change-Id: Ib6d94d451a8215fff572ea13f9567ba786d77fa5
2014-04-21 13:59:32 -07:00
Thomas Inskip a7c91ca7dd Modified audio elementary stream parsing to work with packager remux.
Change-Id: Ice95102640e5cbb0382dc4c604c0af013103da99
2014-04-21 19:16:32 +00:00
Thomas Inskip 30b51506c4 Check-in of unmodified audio elementary stream parsing code.
Source of media/base/*:
    http://src.chromium.org/chrome/trunk/src/media/base@262934
Source of media/formats/mpeg/*:
    http://src.chromium.org/chrome/trunk/src/media/formats/mpeg@257932

Change-Id: Icd56b6f496befcd0c9f4eec2460fb2e998ae8bd2
2014-04-21 19:16:09 +00:00
Thomas Inskip 5f99651223 Moved mp4 code to new "formats" directory to match Chromium source tree.
(second attempt due to conflicts).

Change-Id: I2143921bcacdbaa6cfcaf59602713294b4b1f6ee
2014-04-21 12:05:32 -07:00
Kongqun Yang c51c6b2731 Fix ClosureThread unittest crash in release build
The crash happens if the thread is created but never started. An
improper Join triggered the crash. We should not call Join if the thread
is not started.

Change-Id: Icace740889089d3b2e15cf6c76c2b0887eb84535
2014-04-18 18:48:41 -07:00
Kongqun Yang 7fd94950d4 ProducerConsumerQueue unittest
Change-Id: I7cbd830e9bf93e1a5da75870f7a7a596708e5d5d
2014-04-18 18:35:41 -07:00
Kongqun Yang 7e9b8aa5a4 A thread safe producer consumer queue implementation
Change-Id: I827d8959d9c7c398178d083d01fafdb1779805da
2014-04-18 18:28:02 -07:00
Kongqun Yang 3f8b37a377 Implement ClosureThread
ClosureThread runs a Closure in a platform thread. Chromium Thread class
involves message loop, so we choose to implement our own based on the
lower level SimpleThread which wraps PlatformThread.

Change-Id: Ibb759f7debcc027c0764195ca93506f9a202110b
2014-04-19 01:03:29 +00:00
Kongqun Yang 833f27f687 Make Muxer::Initialize and Muxer::Finalize private
User should not need to care about how and when to call these APIs.
Internal code should call them automatically.

Change-Id: Ibc85a709d4e82ecc7b477986cabf09dcfc2e100c
2014-04-10 19:56:35 +00:00
Kongqun Yang b34b997bcb Some more clean ups in media/base
1. Use size_t for MediaSample size;
2. Get rid of stringstream in media_sample.cc and media_stream.cc.

Change-Id: I11fe650305a732ae6a18546ac68692e03ecedae4
2014-04-09 18:39:51 +00:00
Kongqun Yang f9ae38f717 Doxygen documentation for media/base
Change-Id: I6a63bd762e9f32655baf9b40db32ababb6aa3b54
2014-04-07 18:09:23 -07:00
Kongqun Yang 25b1038f5d Enable warnings and warnings-as-errors
The warnings and warnings-as-errors are enabled by set chromium_code to
1. Chromium build disables warnings and warnings-as-errors by default
on external contents.

And fix the errors with them enabled. Mostly defined but not used,
sign-unsign comparison, unsigned string formatting, and return value not
used etc.

Change-Id: I305b63924955a84172e98e0ebfe5aba0f11bdb37
2014-03-28 22:24:49 +00:00
Kongqun Yang 895a4daa4d Update happyhttp to latest revision
Latest rev of happyhttp fixes the bugs so patches are no longer needed.
Also removes http_fetcher_unittest from the build as it performs real
http requests to an external server.
2014-03-28 22:13:03 +00:00
Kongqun Yang 56c203c214 Remove TODOs
Some TODOs remain but are replaced with word NOTE instead. Some TODOs
are turned into bugs.

The patch are prepared using script:
find . -regex ".*/\(app\|media\|mpd\)/.*\.\(cc\|h\|gyp\)" \
  -exec sed -i "/TODO/d" {} \;
(remove the line containing TODO) with some post editing.

Change-Id: I6dd3539cce2bbeefee32d6307f78c13aacb94d1b
2014-03-28 14:30:27 -07:00
Kongqun Yang c1a7fd9c4a Change output messages to make it more human readable
Also remove formatting using stream which is not recommended per Google
C++ style guide.

Change-Id: I3930f0a453acc0258876c08c4266dcbb13757ac8
2014-03-19 18:42:27 -07:00
Kongqun Yang 5f3c0f7181 Remove the name after TODO
The change is made using command:
find . -regex ".*/\(app\|media\|mpd\)/.*\.\(cc\|h\|gyp\)" -exec sed -i
's,TODO(\w\+),TODO,g' {} \;

Then scan through the files and reformat them properly.

Change-Id: I13836cde38b9e30daf1fd8a847e203337f883e1b
2014-03-19 18:07:06 -07:00
Kongqun Yang e2b29552e9 Fix flaky packager_test due to timestamp diff
Change muxer interface to allow injection of testing clock. Also added
more packager_tests.

Change-Id: Ie580cbd7e79607a2c2b9df5d5d52ee4be108ff8f
2014-03-20 00:52:53 +00:00
Kongqun Yang d90ca489f9 Widevine encryptor source unittest
Change-Id: I1b56d0a019480472eb462d8a39f81c4eb3c81a0e
2014-03-12 10:56:31 -07:00
Kongqun Yang b9f1996b68 Fix compilation errors after manifest update
Manifest was updated in CL 7debbbe19b158ea7377e229a17ec1d3d9d19d1b8
to point to Chromium LGKR CL 253526.

There are some API refactoring in base, which result in some code
changes in our packager source.

Change-Id: I52bf5a8a4f8fe0ebc566677efcd572332db8f618
2014-03-03 13:26:14 -08:00