Add codec private data to WebM muxer.

Added packager tests for WebM audio.  Also now only outputs the
language if it's not empty.  Fixed the packager tests for that.

b/26540606

Change-Id: Ica804bd710055bcaa2113f948d723dedd78ef909
This commit is contained in:
Jacob Trimble 2016-01-13 11:58:48 -08:00
parent 27a6e31595
commit 61a8d4f09e
8 changed files with 39 additions and 8 deletions

View File

@ -122,6 +122,15 @@ class PackagerAppTest(unittest.TestCase):
self._DiffGold(self.output[0], 'bear-320x240-vp9-golden.webm')
self._DiffGold(self.mpd_output, 'bear-320x240-vp9-webm-golden.mpd')
def testPackageVorbisWebm(self):
self.packager.Package(
self._GetStreams(['audio'],
output_format='webm',
test_files=['bear-320x240-audio-only.webm']),
self._GetFlags())
self._DiffGold(self.output[0], 'bear-320x240-vorbis-golden.webm')
self._DiffGold(self.mpd_output, 'bear-320x240-vorbis-webm-golden.mpd')
def testPackageWithEncryption(self):
self.packager.Package(
self._GetStreams(['audio', 'video']),

Binary file not shown.

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--Generated with https://github.com/google/edash-packager version <tag>-<hash>-<test>-->
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd" xmlns:cenc="urn:mpeg:cenc:2013" minBufferTime="PT2S" type="static" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" mediaPresentationDuration="PT2.7679998874664307S">
<Period>
<AdaptationSet id="0" contentType="audio">
<Representation id="0" bandwidth="69313" codecs="vorbis" mimeType="audio/webm" audioSamplingRate="44100">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
<BaseURL>output_audio.webm</BaseURL>
<SegmentBase indexRange="23933-23982" timescale="1000000">
<Initialization range="0-4158"/>
</SegmentBase>
</Representation>
</AdaptationSet>
</Period>
</MPD>

View File

@ -3,10 +3,10 @@
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd" xmlns:cenc="urn:mpeg:cenc:2013" minBufferTime="PT2S" type="static" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" mediaPresentationDuration="PT2.7059998512268066S">
<Period>
<AdaptationSet id="0" contentType="video" width="320" height="240" frameRate="1000000/33000" par="16:9">
<Representation id="0" bandwidth="205399" codecs="vp9" mimeType="video/webm" sar="427:320">
<Representation id="0" bandwidth="205387" codecs="vp9" mimeType="video/webm" sar="427:320">
<BaseURL>output_video.webm</BaseURL>
<SegmentBase indexRange="69443-69476" timescale="1000000">
<Initialization range="0-290"/>
<SegmentBase indexRange="69439-69472" timescale="1000000">
<Initialization range="0-286"/>
</SegmentBase>
</Representation>
</AdaptationSet>

View File

@ -3,10 +3,10 @@
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd" xmlns:cenc="urn:mpeg:cenc:2013" minBufferTime="PT2S" type="static" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" mediaPresentationDuration="PT2.7059998512268066S">
<Period>
<AdaptationSet id="0" contentType="video" width="640" height="360" frameRate="1000000/33000" par="16:9">
<Representation id="0" bandwidth="339004" codecs="vp8" mimeType="video/webm" sar="1:1">
<Representation id="0" bandwidth="338992" codecs="vp8" mimeType="video/webm" sar="1:1">
<BaseURL>output_video.webm</BaseURL>
<SegmentBase indexRange="114634-114668" timescale="1000000">
<Initialization range="0-292"/>
<SegmentBase indexRange="114630-114664" timescale="1000000">
<Initialization range="0-288"/>
</SegmentBase>
</Representation>
</AdaptationSet>

View File

@ -249,13 +249,14 @@ Status Segmenter::CreateVideoTrack(VideoStreamInfo* info) {
}
track->set_uid(info->track_id());
if (!info->language().empty())
track->set_language(info->language().c_str());
track->set_type(mkvmuxer::Tracks::kVideo);
track->set_width(info->width());
track->set_height(info->height());
track->set_display_height(info->height());
track->set_display_width(info->width() * info->pixel_width() /
info->pixel_height());
track->set_language(info->language().c_str());
tracks_.AddTrack(track, info->track_id());
track_id_ = track->number();
@ -278,8 +279,14 @@ Status Segmenter::CreateAudioTrack(AudioStreamInfo* info) {
return Status(error::UNIMPLEMENTED,
"Only Vorbis and Opus audio codecs are supported.");
}
if (!track->SetCodecPrivate(info->extra_data().data(),
info->extra_data().size())) {
return Status(error::INTERNAL_ERROR,
"Private codec data required for audio streams");
}
track->set_uid(info->track_id());
if (!info->language().empty())
track->set_language(info->language().c_str());
track->set_type(mkvmuxer::Tracks::kAudio);
track->set_sample_rate(info->sampling_frequency());