There were several enum types that all were used for key systems. This
combines them into one to make it more clear and only needing to update
one. This also uses a bit field to specify multiple key systems instead
of using a std::vector.
Change-Id: Ia88039835492a5bd47f449ba4b76187046deeec0
The resolution values are uninitialized when parsing AVC decoder
configuration record if it does not contain parameter sets (SPS/PPS),
thus they could contain undefined values.
Fixes#750.
Change-Id: I6d54ec9f8740acd45a67b4b7d69031e097fbacc1
Opening a named pipe can block until both ends are open, and we cannot
control when the other end will be open. Ideally, we would always
open files in a thread so that Packager can be used with piped inputs
from naive applications without a potential deadlock.
This change will defer opening WebVTT files until the parser Run()
method is called from a thread. This way, WebVTT files being sent in
from a pipe will never be able to block the main thread.
Previously, files were opened on the main thread before calling the
parser constructor, passing the open file to the constructor as an
argument. I also tried doing it in the parser's InitializeInternal()
method, but that is also called from the main thread.
Change-Id: I54cc68ed9d48a8dc697829119be84d4065b1ae1c
Under command line flag --mvex_before_trak.
This is needed to workaround Android MediaExtractor bug which
requires |mvex| to appear before |trak|.
Closes#711.
Change-Id: Id41d71af5c0016f59023dda6408bbf502e12ac55
Added --crypt_byte_block, --skip_byte_block to allow users to specify
protection pattern other than 1:9 for pattern based encryption scheme,
e.g. cbcs and cens.
Closes#710.
b/147307451
Change-Id: I9f64a7639170c737f138572689b28d17286325c7
Per https://dashif.org/docs/DASH-IF-IOP-v4.3.pdf 4.4.3.6 Signalling the last segment number in Period, there are three ways to signal the last segment number:
a. Use the lmsg signalling as defined in clause 4.4.3.5.
b. Use the Segment Timeline with @r value greater or equal to 0.
c. Add a Supplemental Descriptor with @schemeIdUri set to http://dashif.org/guidelines/last-segment-number with the @value set to the last segment number.
We do not support (a). This change adds support for (c) when Segment Timeline (b) is not used, i.e. when Representation has constant duration (could be approximate).
Under flag --dash_add_last_segment_number_when_needed (disabled by default).
AV1-ISOBMFF spec is updated recently to use start alignment instead of
end alignment for cbcs:
for the protected scheme cbcs:
- BytesOfProtectedData SHALL start on the first byte and end on the
last byte of the decode_tile structure (including any trailing bits).
- A subsample SHALL be created for each tile, even if its size is less
than 16 bytes.
- ...
cenc protection scheme is not affected.
Closes#698.
Change-Id: Ic83a478fb2602d830c30daf3206a1c2d2c238a08
Remove custom constructors, which is no longer needed with C++11. Use
C++ struct zero initialization instead.
Fixes#686.
Change-Id: I512da9f23a250e8b9ebf8bb8e0a39ad0f822d0d3
Added Dolby Vision backward compatible signalling, i.e. for Dolby Vision
profile 8, both base codec without Dolby Vision and HDR codec with Dolby
Vision are signalled.
This is achieved by using a new MuxerListener implementation
MultiCodecMuxerListener, which wraps multiple child MuxerListeners and
is able to delegate to the child MuxerListeners based on the codecs in
the stream.
Closes#341.
Change-Id: I1967bb1ed503087cdd011c364e5fb5647d516ca4
HLS uses the EXT-X-MEDIA-SEQUENCE tag at the start of a live playlist in
order to specify the first segment sequence number. This is because any
live playlist have a limited number of segments, and they also keep
updating with new segments while removing old ones. When a player refreshes
the playlist, this information is important for keeping track of segments
positions.
When the packager starts, it naturally starts this count from zero. However,
there are many situations where the packager may be restarted, without this
meaning starting this value from zero (but continuing a previous sequence).
The most common situations are problems in the encoder feeding the packager.
With those cases in mind, this parameter allows to set the initial
EXT-X-MEDIA-SEQUENCE value. This way, it's possible to continue the sequence
number from previous packager run.
Closes#691.
Call CRYPTO_library_init to properly initialize crypto engine, which
enables AES-NI (Hardware AES) if it is supported by CPU.
Also added a performance benchmark test.
Closes#198.
Change-Id: I962a2da588d2f4f6cbe00c83ecc9a832db0e6042
Also roll_boringssl.py script is also adjusted to work with latest
boringssl.
Disable ASM compilation on Windows x64 which fails to compile. It also
means there are no HW AES on Windows x64.
Issue #198.
Change-Id: Ib7e8ff506f014c8c733f1882eeeddbe34fa28511
For MP4 files, mp4 parser tries to open and read the same file again
to handle trailing MOOV box.
Open FIFO again may result in packager hang.
Update the code to only attempt to load MOOV for local regular files,
as FIFO and remote files are unseekable anyway.
Fixes#664.
Change-Id: Ib286d2876d202cd5a248ffe70b13589b3cc74bc9
Although FRAME-RATE is optional per HLS specification, but per HLS
Authoring Specification for Apple Devices (https://apple.co/30n90DC):
Each EXT-X-STREAM-INF tag MUST have a FRAME-RATE attribute.
Also, iOS and TVos refuse to play the content if VIDEO-RANGE is
present but FRAME-RATE is missing.
Issue #632, #634.
Change-Id: Ica282f023a7e8538f7b506094e2286840cf5c193
Calculate FRAME-RATE from sample duration as in the DASH solution.
Right now calculated frame-rate may not be accurate in some scenarios,
so we avoid setting the attribute in HLS unless it is more than 30
fps. We will set it unconditionally once it is fixed.
Fixes#634.
Change-Id: I87b6e9a047d959ae88dd4dcb2b4786527ba5c9fc
- Parse and extract transfer_characteristics from H264/H265 VUI
parameters.
- Set VIDEO-RANGE attribute in HLS according to HLS specification:
https://tools.ietf.org/html/draft-pantos-hls-rfc8216bis-02#section-4.4.4.2
- Also added an end to end test.
Fixes#632.
Change-Id: Iadf557d967b42ade321fb0b152e8e7b64fe9ff3e
- Add relevant FOURCCs for Dolby Vision.
- Parse DOVIDecoderConfigurationRecord (dvcC, dvvC) to generate
Dolby Vision codec string.
- Propagate Dolby Vision configs (dvcC, dvvC, hvcE) from Demuxer
to Muxer.
- Add a Dolby Vision end to end test.
Support for backward compatibility signaling in DASH and HLS will be
added in a later CL.
Issue #341
Change-Id: If1385df5f48e04b59cb7661130bea48e26b453bf
Latest version of FFmpeg encodes non standard channel layout, e.g. 5.1(side), in AAC using PCE.
This is now supported with the below changes:
- Allow channel_configuration in ADTS header to be 0, as the cctual channel layout is specified
in PCE.
- Add GetFrameSizeWithoutParsing to determine the frame size before actually parsing the frame.
- Skip and resume later if not the whole frame is available.
- Also ensure that the next frame starts with a proper sync word.
Fixes#598.
Store and use the segment start time in the original time scale to
delete old segments, instead of storing it in seconds, as the segment
file name is generated using the time with the time scale.
Fixes#625.
Change-Id: I7524d597b1ffc081dd1399d6fb3ea47c13502881
- Parses parameter set NAL units in the samples.
- Calculate pixel width and height from track width and height.
Fixes#621, #627.
Change-Id: Ic1e120dccbd220b01168f7bf4effeaa43f95b055
We used to use the target segment duration provided by the user.
Unfortunately that does not work for iframe only playlist which
the target duration is effectively equal to the GOP duration.
In the new approach, we estimate the target duration from the initial
few blocks (10 blocks right now).
Fixes#610.
Change-Id: Ie8bf943e157149ca7ed3b9382fe0a1088d0774e2
Add dash_accessibilities stream descriptor, which is a semi-colon
separated list of accessibility_scheme_id_uri=value. It is optional.
Add dash_roles stream descriptor, which is a semi-colon separated
list of strings. It is optional.
Closes#565.
Change-Id: Idb1c20bb410fdd016db07e11fe507c102a3dd8ea
And also dvhe with dvh1.
Apple's specification does not recommend video formats with the
parameter sets stored in the samples.
It also fails mediastreamvalidator checks and some Apple devices /
platforms refused to play.
See https://apple.co/30n90DC 1.10.
Replaced with the corresponding formats with the parameter sets stored
in the sample descriptions instead.
Fixes#587.
Change-Id: Ic5d3f6fde115b1d09d1dcac32cef5fe0ad246aa0
We have logics in bandwidth calculation to ignore segments that is
smaller than half of target duration. The logic does not have any
effect right now as the target duration in mpd/hls params is always
zero.
This change will set target duration in mpd/hls params, thus it can fix
part of issue #581 as the last segment which is less than half of
target duration.
Issue #581.
Fixes#498.
Change-Id: Ieb2dbf4da9fc72a7b9de802cda4294f1954d29b4
Segment start,end time was used previously, which could result in
problems if there are discontinuity in the streams. E.g. if the
stream has timestamp, 10000, 10001, 10002 and then next segment
comes in with timestamp 1. With the previous logic, all the segments
would remain in the time shift buffer until after 10000 segments
even with a small time shift buffer depth of 10.
This could also happen when timestamp wraps around, which could
happen during long time of live streaming.
This change will also be useful to support multi-period live DASH.
Fixes#563.
Change-Id: Ie078d76c6e4af13ade9ad46191c8e3529069ed4d
This is needed for Dolby Vision as Dolby Vision uses NAL unit type 62
to carry private information.
Issue #341.
Change-Id: Ib3f06d8f36ef3d89c33162dd74c012a0c3a805e5
- Define BaseDescriptor and generic read / write operations.
- Define descriptors: ESDescriptor, DecoderConfigDescriptor,
DecoderSpecificInfoDescriptor, SLConfigDescriptor.
DecoderSpecificInfoDescriptor and all other descriptors can now
handle arbitrary length size, not limiting to 64 byte for
DecoderSpecificInfoDescriptor, which was placed to limit
ESDescriptor length size to one byte.
- Now DecoderConfigDescriptor is able to handle reading and writing
of all fields including buffer_size_db, which was not handled
earlier.
Fixes#536.
Change-Id: Ia8a775f8bf6e90e3343a85f0e643bc44cd017c7a
Addresses binary/str conversion problems like
'can't use a string pattern on a bytes-like object'.
With this change, packager_test.py will work with any version of python
after python2.5.
Fixes#553.
Change-Id: I02066942e4bcdddc1db1daf761abab4cc46169a9
With the update, the script needs to be launched from
out/{Debug,Release} directory.
Also updated docs to make it clear how to use the tool.
Fixes#538.
Change-Id: I37b71afc33e3b73ff5232e43d79c52ffa5859d57
Add crypto_period_seconds to Widevine key request
When using key rotation with Widevine DRM, a key server has to know
the duration of crypto period to relate generated keys to the media
playback time. This helps the server to provide relevant keys to
a client during license request.
Closes#544.
The file deletion could fail if it is still held by the web server.
This CL adds retry logic to retry the deletion.
Closes#533.
Change-Id: Ib42ed8db11f32897a29e3b58c1be89d05f5dd034
VLC seems to generate access units with extra AUDs. In #526, the below
sequence is seen:
AUD | SPS | PPS | SPS | PPS | AUD | SEI | SEI | SEI | IDR_SLICE
Previously we exit early when seeing AUD, which results in delayed
processing of the access unit.
The behavior is changed to continue processing the following NAL units
to workaround the content issue.
Closes#526.
Change-Id: I80f571c0711c6db1337eb393fce36fae5432b6c5
Generate an audio only master playlist if there are no videos and
subtitles.
We do not support mixing audio only EXT-X-STREAM-INF with video
EXT-X-STREAM-INF right now.
Fixes#461.
Change-Id: I999b335ad7abbe183ffcb0f5d471948977c2772f
The new directory permission is set to the permission of the last
existing directory in the file path. If none of the directory exists,
it is default to 0755.
Previously we use base::CreateDirectoryAndGetError(), which always sets
the new directory permission to 0700, which is not what we want.
Fixes#499.
Change-Id: Iee9429d5e63ada9588f74ff20d3cce28a1a6437b
It allows users to override the default language for text tracks.
If not specified, --default_language applies to both audio and text
tracks.
Issue #430.
Change-Id: I86a9baba2072be27b6661fa7b65a8bc8b6adb3cc
Add hls_characteristics stream descriptor, which is a colon or semi-colon
separated list of strings. It is optional.
Fixes#430.
Change-Id: Ifcf79316e68768ff065891933de565cd0ff32ec4
https://tools.ietf.org/html/rfc8216#section-4.1
The peak segment bit rate of a Media Playlist is the largest bit rate
of any contiguous set of segments whose total duration is between 0.5
and 1.5 times the target duration.
Fixes#498.
Change-Id: I1f28972b9cc5977735e47906bdcd88ba3942db5a
kFrameSizeCodeTable rows are ordered by 32kHz, 44.1kHz and 48kHz,
which is the reverse of fscod (48kHz, 44.1kHz and 32kHz).
Also updated unittests.
Fixes#487.
Change-Id: Icb0afb8bb895afde0028eee05b403bc85bf7b538
Dump the first 512 bytes of the buffer if container is unknown. This
can help us find out what the actual container is; and fix the
container detection bug if there is.
Closes#505.
Change-Id: I4a8fe5954d0419ef2ccbb9067ec2e9ffe1da417e
Created SubsampleGenerator to generate subsamples.
This is part of the EncryptionHandler clean up to make it more modular
and testable.
Change-Id: I6f4076b057027c72335beb3cbf1965341eb18031
Created EncryptorFactory to set up the encryptors.
This is part of the EncryptionHandler clean up to make it more modular
and testable.
Change-Id: I839bcd8a84fa873396360d67afb540fef1345673
Only Marlin Adaptive Streaming Specification – Simple Profile is
supported.
Two additional updates:
- Remove FairPlay ContentProtection element from DASH mpd as FairPlay
does not define a signaling in DASH.
- Updated end to end test to include all DRMs we support.
Closes#381.
Change-Id: Id12269b471ea34983b782cbd92f687332292ef59
Implemented according to bitstream spec at
https://aomediacodec.github.io/av1-spec/.
It will be used to do AV1 subsample encryption later.
Issue #453.
Change-Id: I84d8a2a780d95f2c9f430ee598838b97474cc0af
This was introduced earlier to indicate FairPlay protection system. But
in fact, it is sufficient to just use the system id for the indication.
- Also updated various parts of the pipeline to support empty PSSH.
- Added an additional FairPlay end to end test using fMP4.
Change-Id: Ica48b7b5235e9a2b5a7f722bcd0fc1ef2073ac13
Note that TTML in ISO-BMFF is not supported yet.
Also updated packager_test.py:
- Added a test using TTML passthrough.
- Computed output extension from input extension unless output_format
is specified.
Fixes#478.
Change-Id: Ia917fc4ed3c326782791ed67601fba02ea28b11d
The time for the previous segment was used when generating the segment
name. This resulted in the first segment being overwritten and
mismatching manifest and media files. It led to playback problems.
Issue #472.
Change-Id: Ia8130ce261585e1a2ede83b26de3e32508de087f
The VP9 level is computed when the container is missing a codec config
or if the level is missing from the codec config.
This fixes VP9 in ISO-BMFF files generated by FFmpeg v4.0.2 or earlier
which does not have level set in the codec config.
Fixes#469.
Change-Id: I685bfd48be16ee6b2209da1c3173f7d6bb02b36a
Implemented per AV1 Codec ISO Media File Format Binding at
https://aomediacodec.github.io/av1-isobmff/
And AOM AV1 codec mapping in Matroska/WebM at
https://github.com/Matroska-Org/matroska-specification/blob/av1-mappin/codec/av1.md
Note that AV1 specific boxes are not supported in this CL, i.e.
AV1 Forward Key Frame sample group entry 'av1f', AV1 Multi-Frame
sample group entry 'av1m' etc are not supported. These boxes are optional.
We will add support later if they are useful to the clients / players.
Encryption is not supported yet.
Issue #453.
Change-Id: I630432d0a9bf82d263ffaf40e57f67fc65eee902
We used to skip all the remaining bytes if the size is less than
|crypt_byte_block| blocks.
This interpretation is incorrect. We should only leave the last partial
16-byte block un-encrypted.
Change-Id: I4f09600efa52e2fdf4d0b661dfc418dcb675f9f6