Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
164d8b42
authored
Jun 15, 2015
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Rework application of Mpd.Location + fix test.
parent
04d6672e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
16 deletions
library/src/main/java/com/google/android/exoplayer/dash/DashChunkSource.java
library/src/main/java/com/google/android/exoplayer/dash/mpd/MediaPresentationDescription.java
library/src/main/java/com/google/android/exoplayer/dash/mpd/MediaPresentationDescriptionParser.java
library/src/main/java/com/google/android/exoplayer/util/ManifestFetcher.java
library/src/test/java/com/google/android/exoplayer/dash/DashChunkSourceTest.java
library/src/main/java/com/google/android/exoplayer/dash/DashChunkSource.java
View file @
164d8b42
...
...
@@ -298,10 +298,6 @@ public class DashChunkSource implements ChunkSource {
if
(
finishedCurrentManifest
&&
(
android
.
os
.
SystemClock
.
elapsedRealtime
()
>
manifestFetcher
.
getManifestLoadTimestamp
()
+
minUpdatePeriod
))
{
String
newManifestURL
=
currentManifest
.
location
;
if
(
newManifestURL
!=
null
)
{
manifestFetcher
.
updateManifestUrl
(
newManifestURL
);
}
manifestFetcher
.
requestRefresh
();
}
}
...
...
@@ -592,8 +588,8 @@ public class DashChunkSource implements ChunkSource {
Period
period
=
new
Period
(
null
,
firstRepresentation
.
periodStartMs
,
firstRepresentation
.
periodDurationMs
,
Collections
.
singletonList
(
adaptationSet
));
long
duration
=
firstRepresentation
.
periodDurationMs
-
firstRepresentation
.
periodStartMs
;
return
new
MediaPresentationDescription
(-
1
,
duration
,
-
1
,
false
,
-
1
,
-
1
,
null
,
Collections
.
singletonList
(
period
)
,
null
);
return
new
MediaPresentationDescription
(-
1
,
duration
,
-
1
,
false
,
-
1
,
-
1
,
null
,
null
,
Collections
.
singletonList
(
period
));
}
private
static
class
RepresentationHolder
{
...
...
library/src/main/java/com/google/android/exoplayer/dash/mpd/MediaPresentationDescription.java
View file @
164d8b42
...
...
@@ -15,13 +15,15 @@
*/
package
com
.
google
.
android
.
exoplayer
.
dash
.
mpd
;
import
com.google.android.exoplayer.util.ManifestFetcher.RedirectingManifest
;
import
java.util.Collections
;
import
java.util.List
;
/**
* Represents a DASH media presentation description (mpd).
*/
public
class
MediaPresentationDescription
{
public
class
MediaPresentationDescription
implements
RedirectingManifest
{
public
final
long
availabilityStartTime
;
...
...
@@ -35,15 +37,15 @@ public class MediaPresentationDescription {
public
final
long
timeShiftBufferDepth
;
public
final
List
<
Period
>
periods
;
public
final
UtcTimingElement
utcTiming
;
public
final
String
location
;
public
final
List
<
Period
>
periods
;
public
MediaPresentationDescription
(
long
availabilityStartTime
,
long
duration
,
long
minBufferTime
,
boolean
dynamic
,
long
minUpdatePeriod
,
long
timeShiftBufferDepth
,
UtcTimingElement
utcTiming
,
List
<
Period
>
periods
,
String
location
)
{
String
location
,
List
<
Period
>
periods
)
{
this
.
availabilityStartTime
=
availabilityStartTime
;
this
.
duration
=
duration
;
this
.
minBufferTime
=
minBufferTime
;
...
...
@@ -51,8 +53,13 @@ public class MediaPresentationDescription {
this
.
minUpdatePeriod
=
minUpdatePeriod
;
this
.
timeShiftBufferDepth
=
timeShiftBufferDepth
;
this
.
utcTiming
=
utcTiming
;
this
.
periods
=
Collections
.
unmodifiableList
(
periods
);
this
.
location
=
location
;
this
.
periods
=
Collections
.
unmodifiableList
(
periods
);
}
@Override
public
String
getNextManifestUrl
()
{
return
location
;
}
}
library/src/main/java/com/google/android/exoplayer/dash/mpd/MediaPresentationDescriptionParser.java
View file @
164d8b42
...
...
@@ -123,20 +123,20 @@ public class MediaPresentationDescriptionParser extends DefaultHandler
}
else
if
(
isStartTag
(
xpp
,
"Period"
))
{
periods
.
add
(
parsePeriod
(
xpp
,
baseUrl
,
durationMs
));
}
else
if
(
isStartTag
(
xpp
,
"Location"
))
{
location
=
xpp
.
nextText
();
location
=
xpp
.
nextText
();
}
}
while
(!
isEndTag
(
xpp
,
"MPD"
));
return
buildMediaPresentationDescription
(
availabilityStartTime
,
durationMs
,
minBufferTimeMs
,
dynamic
,
minUpdateTimeMs
,
timeShiftBufferDepthMs
,
utcTiming
,
periods
,
location
);
dynamic
,
minUpdateTimeMs
,
timeShiftBufferDepthMs
,
utcTiming
,
location
,
periods
);
}
protected
MediaPresentationDescription
buildMediaPresentationDescription
(
long
availabilityStartTime
,
long
durationMs
,
long
minBufferTimeMs
,
boolean
dynamic
,
long
minUpdateTimeMs
,
long
timeShiftBufferDepthMs
,
UtcTimingElement
utcTiming
,
List
<
Period
>
periods
,
String
location
)
{
String
location
,
List
<
Period
>
periods
)
{
return
new
MediaPresentationDescription
(
availabilityStartTime
,
durationMs
,
minBufferTimeMs
,
dynamic
,
minUpdateTimeMs
,
timeShiftBufferDepthMs
,
utcTiming
,
periods
,
location
);
dynamic
,
minUpdateTimeMs
,
timeShiftBufferDepthMs
,
utcTiming
,
location
,
periods
);
}
protected
UtcTimingElement
parseUtcTiming
(
XmlPullParser
xpp
)
{
...
...
library/src/main/java/com/google/android/exoplayer/util/ManifestFetcher.java
View file @
164d8b42
...
...
@@ -23,6 +23,7 @@ import com.google.android.exoplayer.upstream.UriLoadable;
import
android.os.Handler
;
import
android.os.Looper
;
import
android.os.SystemClock
;
import
android.text.TextUtils
;
import
android.util.Pair
;
import
java.io.IOException
;
...
...
@@ -83,6 +84,20 @@ public class ManifestFetcher<T> implements Loader.Callback {
}
/**
* Interface for manifests that are able to specify that subsequent loads should use a different
* URL.
*/
public
interface
RedirectingManifest
{
/**
* Returns the URL from which subsequent manifests should be requested, or null to continue
* using the current URL.
*/
public
String
getNextManifestUrl
();
}
private
final
UriLoadable
.
Parser
<
T
>
parser
;
private
final
UriDataSource
uriDataSource
;
private
final
Handler
eventHandler
;
...
...
@@ -237,6 +252,14 @@ public class ManifestFetcher<T> implements Loader.Callback {
loadExceptionCount
=
0
;
loadException
=
null
;
if
(
manifest
instanceof
RedirectingManifest
)
{
RedirectingManifest
redirectingManifest
=
(
RedirectingManifest
)
manifest
;
String
nextLocation
=
redirectingManifest
.
getNextManifestUrl
();
if
(!
TextUtils
.
isEmpty
(
nextLocation
))
{
manifestUrl
=
nextLocation
;
}
}
notifyManifestRefreshed
();
}
...
...
library/src/test/java/com/google/android/exoplayer/dash/DashChunkSourceTest.java
View file @
164d8b42
...
...
@@ -248,7 +248,7 @@ public class DashChunkSourceTest extends InstrumentationTestCase {
long
duration
=
(
live
)
?
TrackRenderer
.
UNKNOWN_TIME_US
:
firstRepresentation
.
periodDurationMs
-
firstRepresentation
.
periodStartMs
;
return
new
MediaPresentationDescription
(
AVAILABILITY_START_TIME
,
duration
,
-
1
,
live
,
-
1
,
-
1
,
null
,
Collections
.
singletonList
(
period
));
null
,
null
,
Collections
.
singletonList
(
period
));
}
private
static
MediaPresentationDescription
generateVodMpd
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment