Write @startNumber for SegmentTemplate with $Time$ too

Change-Id: I8d55d81e7114e02b511656e73ecc0ad3bb1aa74f
This commit is contained in:
KongQun Yang 2018-03-16 18:47:25 -07:00
parent 901d37a2a7
commit 4e9aadcb15
2 changed files with 5 additions and 10 deletions

View File

@ -458,7 +458,8 @@ class SegmentTemplateTest : public RepresentationTest {
" codecs=\"avc1.010101\" mimeType=\"video/mp4\" sar=\"1:1\" " " codecs=\"avc1.010101\" mimeType=\"video/mp4\" sar=\"1:1\" "
" width=\"720\" height=\"480\" frameRate=\"10/5\">\n" " width=\"720\" height=\"480\" frameRate=\"10/5\">\n"
" <SegmentTemplate timescale=\"1000\" " " <SegmentTemplate timescale=\"1000\" "
" initialization=\"init.mp4\" media=\"$Time$.mp4\">\n" " initialization=\"init.mp4\" media=\"$Time$.mp4\" "
" startNumber=\"1\">\n"
" <SegmentTimeline>\n" " <SegmentTimeline>\n"
" %s\n" " %s\n"
" </SegmentTimeline>\n" " </SegmentTimeline>\n"
@ -486,7 +487,7 @@ TEST_F(SegmentTemplateTest, OneSegmentNormal) {
" codecs=\"avc1.010101\" mimeType=\"video/mp4\" sar=\"1:1\" " " codecs=\"avc1.010101\" mimeType=\"video/mp4\" sar=\"1:1\" "
" width=\"720\" height=\"480\" frameRate=\"10/5\">\n" " width=\"720\" height=\"480\" frameRate=\"10/5\">\n"
" <SegmentTemplate timescale=\"1000\" " " <SegmentTemplate timescale=\"1000\" "
" initialization=\"init.mp4\" media=\"$Time$.mp4\">\n" " initialization=\"init.mp4\" media=\"$Time$.mp4\" startNumber=\"1\">\n"
" <SegmentTimeline>\n" " <SegmentTimeline>\n"
" <S t=\"0\" d=\"10\"/>\n" " <S t=\"0\" d=\"10\"/>\n"
" </SegmentTimeline>\n" " </SegmentTimeline>\n"
@ -539,7 +540,7 @@ TEST_F(SegmentTemplateTest, PresentationTimeOffset) {
" width=\"720\" height=\"480\" frameRate=\"10/5\">\n" " width=\"720\" height=\"480\" frameRate=\"10/5\">\n"
// pto = kPresentationTimeOffsetSeconds * timescale + FLAGS_pto_adjustment // pto = kPresentationTimeOffsetSeconds * timescale + FLAGS_pto_adjustment
" <SegmentTemplate timescale=\"1000\" presentationTimeOffset=\"2299\"" " <SegmentTemplate timescale=\"1000\" presentationTimeOffset=\"2299\""
" initialization=\"init.mp4\" media=\"$Time$.mp4\">\n" " initialization=\"init.mp4\" media=\"$Time$.mp4\" startNumber=\"1\">\n"
" <SegmentTimeline>\n" " <SegmentTimeline>\n"
" <S t=\"0\" d=\"10\"/>\n" " <S t=\"0\" d=\"10\"/>\n"
" </SegmentTimeline>\n" " </SegmentTimeline>\n"

View File

@ -354,14 +354,8 @@ bool RepresentationXmlNode::AddLiveOnlyInfo(
if (media_info.has_segment_template()) { if (media_info.has_segment_template()) {
segment_template.SetStringAttribute("media", media_info.segment_template()); segment_template.SetStringAttribute("media", media_info.segment_template());
// TODO(rkuroiwa): Need a better check. $$Number is legitimate but not a
// template.
if (media_info.segment_template().find("$Number") != std::string::npos) {
DCHECK_GE(start_number, 1u);
segment_template.SetIntegerAttribute("startNumber", start_number); segment_template.SetIntegerAttribute("startNumber", start_number);
} }
}
// TODO(rkuroiwa): Find out when a live MPD doesn't require SegmentTimeline. // TODO(rkuroiwa): Find out when a live MPD doesn't require SegmentTimeline.
XmlNode segment_timeline("SegmentTimeline"); XmlNode segment_timeline("SegmentTimeline");