|
5 | 5 | "testing" |
6 | 6 | "time" |
7 | 7 |
|
| 8 | + "github.com/zencoder/go-dash/helpers/ptrs" |
8 | 9 | "github.com/zencoder/go-dash/helpers/require" |
9 | 10 | "github.com/zencoder/go-dash/helpers/testfixtures" |
10 | 11 | ) |
@@ -89,6 +90,26 @@ func TestNewDynamicMPDLiveWithPeriodStartWriteToString(t *testing.T) { |
89 | 90 | require.EqualString(t, expectedXML, xmlStr) |
90 | 91 | } |
91 | 92 |
|
| 93 | +func TestNewDynamicMPDLiveWithSuggestedPresentationDelayToString(t *testing.T) { |
| 94 | + m := NewDynamicMPD(DASH_PROFILE_LIVE, VALID_AVAILABILITY_START_TIME, VALID_MIN_BUFFER_TIME, |
| 95 | + AttrMediaPresentationDuration(VALID_MEDIA_PRESENTATION_DURATION), |
| 96 | + AttrMinimumUpdatePeriod(VALID_MINIMUM_UPDATE_PERIOD)) |
| 97 | + |
| 98 | + // Set first period start time to PT0S |
| 99 | + spd := Duration(time.Duration(18) * time.Second) |
| 100 | + m.SuggestedPresentationDelay = &spd |
| 101 | + |
| 102 | + xmlStr, err := m.WriteToString() |
| 103 | + require.NoError(t, err) |
| 104 | + expectedXML := `<?xml version="1.0" encoding="UTF-8"?> |
| 105 | +<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" suggestedPresentationDelay="PT18S"> |
| 106 | + <Period></Period> |
| 107 | + <UTCTiming></UTCTiming> |
| 108 | +</MPD> |
| 109 | +` |
| 110 | + require.EqualString(t, expectedXML, xmlStr) |
| 111 | +} |
| 112 | + |
92 | 113 | func TestNewMPDOnDemandWriteToString(t *testing.T) { |
93 | 114 | m := NewMPD(DASH_PROFILE_ONDEMAND, VALID_MEDIA_PRESENTATION_DURATION, VALID_MIN_BUFFER_TIME) |
94 | 115 |
|
@@ -122,14 +143,20 @@ func TestAddNewAdaptationSetAudioWriteToString(t *testing.T) { |
122 | 143 | func TestAddNewAdaptationSetVideoWriteToString(t *testing.T) { |
123 | 144 | m := NewMPD(DASH_PROFILE_LIVE, VALID_MEDIA_PRESENTATION_DURATION, VALID_MIN_BUFFER_TIME) |
124 | 145 |
|
125 | | - _, _ = m.AddNewAdaptationSetVideoWithID("7357", DASH_MIME_TYPE_VIDEO_MP4, VALID_SCAN_TYPE, VALID_SEGMENT_ALIGNMENT, VALID_START_WITH_SAP) |
| 146 | + as, err := m.AddNewAdaptationSetVideoWithID("7357", DASH_MIME_TYPE_VIDEO_MP4, VALID_SCAN_TYPE, VALID_SEGMENT_ALIGNMENT, VALID_START_WITH_SAP) |
| 147 | + require.NoError(t, err) |
| 148 | + |
| 149 | + as.MinWidth = ptrs.Strptr("720") |
| 150 | + as.MaxWidth = ptrs.Strptr("720") |
| 151 | + as.MinHeight = ptrs.Strptr("480") |
| 152 | + as.MaxHeight = ptrs.Strptr("480") |
126 | 153 |
|
127 | 154 | xmlStr, err := m.WriteToString() |
128 | 155 | require.NoError(t, err) |
129 | 156 | expectedXML := `<?xml version="1.0" encoding="UTF-8"?> |
130 | 157 | <MPD xmlns="urn:mpeg:dash:schema:mpd:2011" profiles="urn:mpeg:dash:profile:isoff-live:2011" type="static" mediaPresentationDuration="PT6M16S" minBufferTime="PT1.97S"> |
131 | 158 | <Period> |
132 | | - <AdaptationSet mimeType="video/mp4" startWithSAP="1" scanType="progressive" id="7357" segmentAlignment="true"></AdaptationSet> |
| 159 | + <AdaptationSet mimeType="video/mp4" startWithSAP="1" scanType="progressive" id="7357" segmentAlignment="true" minWidth="720" maxWidth="720" minHeight="480" maxHeight="480"></AdaptationSet> |
133 | 160 | </Period> |
134 | 161 | </MPD> |
135 | 162 | ` |
|
0 commit comments