Skip to content

Commit

Permalink
Merge branch 'main' into cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyparrish committed Jul 18, 2023
2 parents 86a183a + d6f28d4 commit 4515a98
Show file tree
Hide file tree
Showing 16 changed files with 39 additions and 22 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion packager/app/test/testdata/segmented-ttml-mp4/output.mpd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Period id="0" start="PT0S">
<AdaptationSet id="0" contentType="text" segmentAlignment="true">
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="subtitle"/>
<Representation id="0" bandwidth="4112" codecs="stpp" mimeType="application/mp4">
<Representation id="0" bandwidth="4120" codecs="stpp" mimeType="application/mp4">
<SegmentTemplate timescale="1000" initialization="bear-english-text-init.mp4" media="bear-english-text-$Number$.m4s" startNumber="1">
<SegmentTimeline>
<S t="0" d="1000" r="4"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head/>
<body>
<div>
<p xml:space="preserve" begin="00:00:00.00" end="00:00:00.800" tts:textAlign="center">Yup, that's a bear, eh.</p>
<p xml:space="preserve" begin="00:00:00.000" end="00:00:00.800" tts:textAlign="center">Yup, that's a bear, eh.</p>
</div>
</body>
</tt>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head/>
<body>
<div>
<p xml:space="preserve" begin="00:00:01.00" end="00:00:04.700" tts:textAlign="center">He 's... um... doing bear-like stuff.</p>
<p xml:space="preserve" begin="00:00:01.000" end="00:00:04.700" tts:textAlign="center">He 's... um... doing bear-like stuff.</p>
</div>
</body>
</tt>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head/>
<body>
<div>
<p xml:space="preserve" begin="00:00:01.00" end="00:00:04.700" tts:textAlign="center">He 's... um... doing bear-like stuff.</p>
<p xml:space="preserve" begin="00:00:01.000" end="00:00:04.700" tts:textAlign="center">He 's... um... doing bear-like stuff.</p>
</div>
</body>
</tt>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head/>
<body>
<div>
<p xml:space="preserve" begin="00:00:01.00" end="00:00:04.700" tts:textAlign="center">He 's... um... doing bear-like stuff.</p>
<p xml:space="preserve" begin="00:00:01.000" end="00:00:04.700" tts:textAlign="center">He 's... um... doing bear-like stuff.</p>
</div>
</body>
</tt>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head/>
<body>
<div>
<p xml:space="preserve" begin="00:00:01.00" end="00:00:04.700" tts:textAlign="center">He 's... um... doing bear-like stuff.</p>
<p xml:space="preserve" begin="00:00:01.000" end="00:00:04.700" tts:textAlign="center">He 's... um... doing bear-like stuff.</p>
</div>
</body>
</tt>
2 changes: 1 addition & 1 deletion packager/app/test/testdata/segmented-ttml-text/output.mpd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Period id="0" start="PT0S">
<AdaptationSet id="0" contentType="text" segmentAlignment="true">
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="subtitle"/>
<Representation id="0" bandwidth="2608" mimeType="application/ttml+xml">
<Representation id="0" bandwidth="2616" mimeType="application/ttml+xml">
<SegmentTemplate timescale="1000" media="bear-english-text-$Number$.ttml" startNumber="1">
<SegmentTimeline>
<S t="0" d="1000" r="4"/>
Expand Down
23 changes: 12 additions & 11 deletions packager/hls/base/master_playlist_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ TEST_F(MasterPlaylistTest, WriteMasterPlaylistVideoAndAudio) {
"DEFAULT=YES,AUTOSELECT=YES,CHANNELS=\"2\"\n"
"#EXT-X-MEDIA:TYPE=AUDIO,URI=\"http://playlists.org/spa.m3u8\","
"GROUP-ID=\"audiogroup\",LANGUAGE=\"es\",NAME=\"espanol\","
"AUTOSELECT=YES,CHANNELS=\"5\"\n"
"DEFAULT=NO,AUTOSELECT=YES,CHANNELS=\"5\"\n"
"\n"
"#EXT-X-STREAM-INF:BANDWIDTH=360000,AVERAGE-BANDWIDTH=240000,"
"CODECS=\"sdvideocodec,audiocodec\","
Expand Down Expand Up @@ -430,7 +430,8 @@ TEST_F(MasterPlaylistTest, WriteMasterPlaylistSameAudioGroupSameLanguage) {
"GROUP-ID=\"audio\",LANGUAGE=\"en\",NAME=\"english\","
"DEFAULT=YES,AUTOSELECT=YES,CHANNELS=\"1\"\n"
"#EXT-X-MEDIA:TYPE=AUDIO,URI=\"http://anydomain.com/eng_hi.m3u8\","
"GROUP-ID=\"audio\",LANGUAGE=\"en\",NAME=\"english\",CHANNELS=\"8\"\n"
"GROUP-ID=\"audio\",LANGUAGE=\"en\",NAME=\"english\",DEFAULT=NO,"
"CHANNELS=\"8\"\n"
"\n"
"#EXT-X-STREAM-INF:BANDWIDTH=400000,AVERAGE-BANDWIDTH=280000,"
"CODECS=\"videocodec,audiocodec\",RESOLUTION=800x600,AUDIO=\"audio\","
Expand Down Expand Up @@ -472,7 +473,7 @@ TEST_F(MasterPlaylistTest, WriteMasterPlaylistVideosAndTexts) {
"\n"
"#EXT-X-MEDIA:TYPE=SUBTITLES,URI=\"http://playlists.org/eng.m3u8\","
"GROUP-ID=\"textgroup\",LANGUAGE=\"en\",NAME=\"english\","
"AUTOSELECT=YES\n"
"DEFAULT=NO,AUTOSELECT=YES\n"
"#EXT-X-MEDIA:TYPE=SUBTITLES,URI=\"http://playlists.org/fr.m3u8\","
"GROUP-ID=\"textgroup\",LANGUAGE=\"fr\",NAME=\"french\",DEFAULT=YES,"
"AUTOSELECT=YES\n"
Expand Down Expand Up @@ -513,8 +514,8 @@ TEST_F(MasterPlaylistTest, WriteMasterPlaylistVideoAndTextWithCharacteritics) {
"version test\n"
"\n"
"#EXT-X-MEDIA:TYPE=SUBTITLES,URI=\"http://playlists.org/eng.m3u8\","
"GROUP-ID=\"textgroup\",LANGUAGE=\"en\",NAME=\"english\",AUTOSELECT=YES,"
"CHARACTERISTICS=\""
"GROUP-ID=\"textgroup\",LANGUAGE=\"en\",NAME=\"english\",DEFAULT=NO,"
"AUTOSELECT=YES,CHARACTERISTICS=\""
"public.accessibility.transcribes-spoken-dialog,public.easy-to-read\"\n"
"\n"
"#EXT-X-STREAM-INF:BANDWIDTH=300000,AVERAGE-BANDWIDTH=200000,"
Expand Down Expand Up @@ -555,7 +556,7 @@ TEST_F(MasterPlaylistTest, WriteMasterPlaylistVideoAndDvsAudio) {
"version test\n"
"\n"
"#EXT-X-MEDIA:TYPE=AUDIO,URI=\"http://playlists.org/dvs_eng.m3u8\","
"GROUP-ID=\"audiogroup\",LANGUAGE=\"en\",NAME=\"DVS english\","
"GROUP-ID=\"audiogroup\",LANGUAGE=\"en\",NAME=\"DVS english\",DEFAULT=NO,"
"AUTOSELECT=YES,CHARACTERISTICS=\"public.accessibility.describes-video\","
"CHANNELS=\"2\"\n"
"#EXT-X-MEDIA:TYPE=AUDIO,URI=\"http://playlists.org/eng.m3u8\","
Expand Down Expand Up @@ -598,7 +599,7 @@ TEST_F(MasterPlaylistTest, WriteMasterPlaylistVideoAndTextGroups) {
"\n"
"#EXT-X-MEDIA:TYPE=SUBTITLES,URI=\"http://playlists.org/eng.m3u8\","
"GROUP-ID=\"en-text-group\",LANGUAGE=\"en\",NAME=\"english\","
"AUTOSELECT=YES\n"
"DEFAULT=NO,AUTOSELECT=YES\n"
"#EXT-X-MEDIA:TYPE=SUBTITLES,URI=\"http://playlists.org/fr.m3u8\","
"GROUP-ID=\"fr-text-group\",LANGUAGE=\"fr\",NAME=\"french\","
"DEFAULT=YES,AUTOSELECT=YES\n"
Expand Down Expand Up @@ -648,7 +649,7 @@ TEST_F(MasterPlaylistTest, WriteMasterPlaylistVideoAndAudioAndText) {
"\n"
"#EXT-X-MEDIA:TYPE=SUBTITLES,URI=\"http://playlists.org/eng.m3u8\","
"GROUP-ID=\"textgroup\",LANGUAGE=\"en\",NAME=\"english\","
"AUTOSELECT=YES\n"
"DEFAULT=NO,AUTOSELECT=YES\n"
"\n"
"#EXT-X-STREAM-INF:BANDWIDTH=350000,AVERAGE-BANDWIDTH=230000,"
"CODECS=\"sdvideocodec,audiocodec,textcodec\",RESOLUTION=800x600,"
Expand Down Expand Up @@ -720,11 +721,11 @@ TEST_F(MasterPlaylistTest, WriteMasterPlaylistMixedPlaylistsDifferentGroups) {
"DEFAULT=YES,AUTOSELECT=YES,CHANNELS=\"2\"\n"
"#EXT-X-MEDIA:TYPE=AUDIO,URI=\"http://playlists.org/audio-2.m3u8\","
"GROUP-ID=\"audio-group-2\",LANGUAGE=\"fr\",NAME=\"audio 2\","
"AUTOSELECT=YES,CHANNELS=\"2\"\n"
"DEFAULT=NO,AUTOSELECT=YES,CHANNELS=\"2\"\n"
"\n"
"#EXT-X-MEDIA:TYPE=SUBTITLES,URI=\"http://playlists.org/text-1.m3u8\","
"GROUP-ID=\"text-group-1\",LANGUAGE=\"en\",NAME=\"text 1\","
"AUTOSELECT=YES\n"
"DEFAULT=NO,AUTOSELECT=YES\n"
"#EXT-X-MEDIA:TYPE=SUBTITLES,URI=\"http://playlists.org/text-2.m3u8\","
"GROUP-ID=\"text-group-2\",LANGUAGE=\"fr\",NAME=\"text 2\","
"DEFAULT=YES,AUTOSELECT=YES\n"
Expand Down Expand Up @@ -823,7 +824,7 @@ TEST_F(MasterPlaylistTest, WriteMasterPlaylistAudioOnly) {
"DEFAULT=YES,AUTOSELECT=YES,CHANNELS=\"2\"\n"
"#EXT-X-MEDIA:TYPE=AUDIO,URI=\"http://playlists.org/audio-2.m3u8\","
"GROUP-ID=\"audio-group-2\",LANGUAGE=\"fr\",NAME=\"audio 2\","
"AUTOSELECT=YES,CHANNELS=\"2\"\n"
"DEFAULT=NO,AUTOSELECT=YES,CHANNELS=\"2\"\n"
"\n"
"#EXT-X-STREAM-INF:BANDWIDTH=50000,AVERAGE-BANDWIDTH=30000,"
"CODECS=\"audiocodec\",AUDIO=\"audio-group-1\",CLOSED-CAPTIONS=NONE\n"
Expand Down
7 changes: 5 additions & 2 deletions packager/media/demuxer/demuxer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,16 @@ Status Demuxer::InitializeParser() {

// Read enough bytes before detecting the container.
int64_t bytes_read = 0;
bool eof = false;
while (static_cast<size_t>(bytes_read) < kInitBufSize) {
int64_t read_result =
media_file_->Read(buffer_.get() + bytes_read, kInitBufSize);
if (read_result < 0)
return Status(error::FILE_FAILURE, "Cannot read file " + file_name_);
if (read_result == 0)
if (read_result == 0) {
eof = true;
break;
}
bytes_read += read_result;
}
container_name_ = DetermineContainer(buffer_.get(), bytes_read);
Expand Down Expand Up @@ -224,7 +227,7 @@ Status Demuxer::InitializeParser() {
// descriptor |media_file_| instead of opening the same file again.
static_cast<mp4::MP4MediaParser*>(parser_.get())->LoadMoov(file_name_);
}
if (!parser_->Parse(buffer_.get(), bytes_read)) {
if (!parser_->Parse(buffer_.get(), bytes_read) || (eof && !parser_->Flush())) {
return Status(error::PARSER_FAILURE,
"Cannot parse media file " + file_name_);
}
Expand Down
2 changes: 2 additions & 0 deletions packager/mpd/base/mpd_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ float MpdBuilder::GetStaticMpdDuration() {
bool MpdBuilder::GetEarliestTimestamp(double* timestamp_seconds) {
DCHECK(timestamp_seconds);
DCHECK(!periods_.empty());
if (periods_.empty())
return false;
double timestamp = 0;
double earliest_timestamp = -1;
// TODO(kqyang): This is used to set availabilityStartTime. We may consider
Expand Down
15 changes: 13 additions & 2 deletions packager/tools/pssh/pssh-box.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@
import struct
import sys


def to_code_point(value):
"""
Return the unicode code point with `int` passthrough
"""
if isinstance(value, int):
return value

return ord(value)


_script_dir = os.path.dirname(os.path.realpath(__file__))
_proto_path = os.path.join(_script_dir, 'pyproto')
_widevine_proto_path = os.path.join(_proto_path, 'packager/media/base')
Expand Down Expand Up @@ -64,9 +75,9 @@ def read_int(self, size):
ret = 0
for i in range(0, size):
if self.little_endian:
ret |= (ord(data[i]) << (8 * i))
ret |= (to_code_point(data[i]) << (8 * i))
else:
ret |= (ord(data[i]) << (8 * (size - i - 1)))
ret |= (to_code_point(data[i]) << (8 * (size - i - 1)))
return ret


Expand Down

0 comments on commit 4515a98

Please sign in to comment.