Skip to content

Commit bde8899

Browse files
committed
add unit test for period start 0 value
1 parent 04251cb commit bde8899

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

mpd/mpd_read_write_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,27 @@ func TestNewDynamicMPDLiveWriteToString(t *testing.T) {
6868
require.EqualString(t, expectedXML, xmlStr)
6969
}
7070

71+
func TestNewDynamicMPDLiveWithPeriodStartWriteToString(t *testing.T) {
72+
m := NewDynamicMPD(DASH_PROFILE_LIVE, VALID_AVAILABILITY_START_TIME, VALID_MIN_BUFFER_TIME,
73+
AttrMediaPresentationDuration(VALID_MEDIA_PRESENTATION_DURATION),
74+
AttrMinimumUpdatePeriod(VALID_MINIMUM_UPDATE_PERIOD))
75+
76+
// Set first period start time to PT0S
77+
p := m.GetCurrentPeriod()
78+
start := Duration(time.Duration(0))
79+
p.Start = &start
80+
81+
xmlStr, err := m.WriteToString()
82+
require.NoError(t, err)
83+
expectedXML := `<?xml version="1.0" encoding="UTF-8"?>
84+
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" profiles="urn:mpeg:dash:profile:isoff-live:2011" type="dynamic" mediaPresentationDuration="PT6M16S" minBufferTime="PT1.97S" availabilityStartTime="1970-01-01T00:00:00Z" minimumUpdatePeriod="PT5S">
85+
<Period start="PT0S"></Period>
86+
<UTCTiming></UTCTiming>
87+
</MPD>
88+
`
89+
require.EqualString(t, expectedXML, xmlStr)
90+
}
91+
7192
func TestNewMPDOnDemandWriteToString(t *testing.T) {
7293
m := NewMPD(DASH_PROFILE_ONDEMAND, VALID_MEDIA_PRESENTATION_DURATION, VALID_MIN_BUFFER_TIME)
7394

0 commit comments

Comments
 (0)