Previously it is possible that the same file path is generated when
the function is called consecutively in the same thread.
The problem can be re-produced in Windows. Does not seem to be
re-producible in Linux and Mac.
Fixes#448, #449.
Change-Id: Ia0163492e3494eba00f56f4d356aa1010b9660cc
- Also make it explicit that MemoryFile does not support opening an
already open file. An error will be returned when trying to open an
already open file. Previously the code may crash with memory problems.
- Also updated packager_test to use different test directories for
different tests.
Fixes Appveyor crash due to memory corruption: #449.
Appveyor may still fail but will contain a meaningful error logging.
Change-Id: Ibc9346ef7f301e416a4a09f120bca56504c939d8
This also ensures that it does not violate std::sort() requirement on
strict ordering, which is enforced in gcc/g++ though not in clang.
std::sort() strict ordering requirement:
std::sort() need a comparator that return true iff the first argument is
strictly lower than the second one. That is: must return false when they
are equal.
Change-Id: I781cf4ed4125fcad212eba5430a264f3a3d71c16
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
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
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
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
- 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
DASH live profile with static MPD was incorrectly handled in the same
way as live profile with dynamic MPD, i.e. by assuming the synchronized
Representations, which is incorrect.
It can be easily re-produced in multiple period outputs, i.e. with Ad
cues. It may happen with regular contents as well, due to race
condition, though with a much lower chance of occurring.
Fixes#435.
Bug: 111359775.
Change-Id: I7de087f5dd8602b4c4e35cb697d589fa3699e8a5
They will result in empty DASH representations, which is not spec
compliant.
For text, if the cue is before the max end time, it will still be
dispatched as the text samples intercepted by the cue can be split into
two at the cue point.
Bug: 111359775.
Change-Id: I55c2025c4e9d64c88e6a685c0cf3024a0cc4a6d8
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
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
WebVTT cues without payload may not carry meaningful information, but it
is allowed by WebVTT specification [1]. It could also be useful
sometimes, e.g. to signal the time progression in live case.
Fixes#433.
[1] https://www.w3.org/TR/webvtt1/#types-of-webvtt-cue-payload
Change-Id: I9e31f4a3789cbdafb7667b64f4019834190ecfc0
- Support decryption verification in _CheckTestResults
- Allow diff_files in _CheckTestResults
- Update all functional tests to use _CheckTestResults
Change-Id: I3f9c02f35808eba787becf9b1e5c1ce9238f943e
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
There are non-ASCII characters in comment section of some source
code, which is causing compilation problems on some systems with
a codepage that cannot represent these characters.
Fixes#419.
Change-Id: I20d68a201263d515290ee440b52c5354b739099a
Before we had an assert that would catch if a sample had an
invalid times, however input may have bad times.
We did have a message if we saw a sample with a duration equal to
zero. This expands that check to check if the time is valid in
general and will ignore any sample that is not valid.
Fixes#425
Change-Id: I9774bfbdbd401f3016d2c345665b9973d1889db7
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
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
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
We always assumed that text stream started at zero in the text chunker.
This meant that if the text stream started later than zero (like in a
live stream) we would generate a lot of empty segments.
Instead the text chunker will assume that segments should be adjusted
to align with multiple of segment duration. The text chunker will assume
that an earlier component in the pipeline (i.e. text padder) will ensure
that the first sample has the time that we want to start segments at
(even it needs to add an empty sample).
Issue #416
Change-Id: Ie45844354d6e9448787cae896841b5ab31721ed6
Previously, the text padder media handler would assume that text always
started at time zero. This would work for VOD but would result with a
large pad at the start of LIVE content.
To avoid this, the text padder will use a bias to test whether or not it
thinks the content starts at zero. Right now the bias is set to be 10
minutes, but will later be configurable with a command line flag.
10 minutes was used as LIVE content will have much larger values and VOD
content should have much lower values.
Issue: #416
Change-Id: I07af15a577392fb030e36f052085cd4e667700e8
This is a more faithful implementation of more_rbsp_data().
There could be trailing null bytes in NAL units. This isn't valid per
H264 specification, but the referenced bug includes a sample where the
PPS in the avcC record includes a trailing null byte.
Workaround the problem so packager does not fail.
A similar problem is workarounded in Chrome:
https://codereview.chromium.org/1107593004Closes#418
Change-Id: I28cb8a9371945dc094f766c3e559d7a66859b451
This allows UDP receive buffer size to be increased to avoid potential
packet loss result from receive buffer overrun.
Another related flag is --io_cache_size. buffer_size in UDP options
defines the UDP buffer size of the underlying system while
io_cache_size defines the size of the internal circular buffer managed
by Shaka Packager.
Closes#411
Change-Id: I57c843a88f13da546417dadc2a78df2bee0a00f3
Under VLOG(1).
IO Cache circular buffer full could result in UDP packet loss with UDP
inputs.
Related to #390 and #411.
Change-Id: Ia5636a70827978b5c2f71f6495256d758766632f
When we built the cue alignment media handler, we did not remove
the old solution.
This change removes all the code for the old solution.
Change-Id: I851b284c449c7d25aaabc2f55df5579ba7b5aad1
Originally the create and dispatch of stream data in the cue
alignment tests were separate to improve readability. The idea was
to separate building each stream and dispatching the streams muxed
together would make it easier to understand the streams.
However, coming back to the code, this did not hold up as it took just as
long to understand the code. So merging the two together allows for the
code to be more concise.
Change-Id: I77f6bb67e7fb0ca7af0553c3baf07082770da74c
In the media handler there is an example of what a one-to-many media
handler would be. It used the trick play handler as an example, but that
handler is now a one-to-one media handler. Changed the example to use the
replicator media handler.
Change-Id: I26908c6e27ea4a697a19c0fa0179c60842a449d2
Made ChainHandlers to MediaHandler::Chain so that it can be used in our
test code as well. After all it is a pretty helpful function.
Change-Id: I8d83ee184052cd9fa9b37f2741c96f3223d5ab48
Ran clang-format over media_handler.cc and media_handler.h so that
later changes won't update the formatting as much.
Change-Id: I2db4f9f4e8a66fca1e1418ab99b283a0e4a70e4c
The copy and assign in MediaHandlerGraphTestBase referred to the wrong
types. This changes them to refer to the correct types.
Change-Id: I165c9a1da39b49adf41e7c35ae3e4a0b9ecfa838
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
Reduce which variables we check in the cue alignment tests by replacing
the less important variables with "_".
Change-Id: Id8770b5f2045ad5c8ac6eee54d6a291d933a4b6f
We have adopted some new standards for how we are writing the media
unit tests. This change goes through the trick play tests and
updates them to be more inline with how we are doing new media
tests.
This include using "_" for parameters that are not the focus of the
tests (used in the EXPECT calls).
This includes wrapping Dispatch calls so that the test bodies can
be more readable.
Change-Id: Iab4b1ce67666b6c8a4a821db1a8f4369cd366dc3
Added a matcher for Video Streams. This will allow us to use a general
matcher in tests for video specific fields.
Change-Id: I91b9aebd66be37ec6d5f09b762263fafaef854c2
Added a StreamTypeToString function in StreamInfo (where stream type is
defined) so that we can print the type in a more readable way.
Change-Id: Icb1d10f5a72dca314d9bdf07e9cd0c0a185bd791