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
6bf52dd6
authored
Apr 10, 2015
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Report decoder initialization information out of track renderer.
parent
a17123c4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
0 deletions
demo/src/main/java/com/google/android/exoplayer/demo/EventLogger.java
demo/src/main/java/com/google/android/exoplayer/demo/player/DemoPlayer.java
library/src/main/java/com/google/android/exoplayer/MediaCodecTrackRenderer.java
demo/src/main/java/com/google/android/exoplayer/demo/EventLogger.java
View file @
6bf52dd6
...
...
@@ -163,6 +163,12 @@ public class EventLogger implements DemoPlayer.Listener, DemoPlayer.InfoListener
printInternalError
(
"cryptoError"
,
e
);
}
@Override
public
void
onDecoderInitialized
(
String
decoderName
,
long
elapsedRealtimeMs
,
long
initializationDurationMs
)
{
Log
.
d
(
TAG
,
"decoderInitialized ["
+
getSessionTimeString
()
+
"]"
);
}
private
void
printInternalError
(
String
type
,
Exception
e
)
{
Log
.
e
(
TAG
,
"internalError ["
+
getSessionTimeString
()
+
", "
+
type
+
"]"
,
e
);
}
...
...
demo/src/main/java/com/google/android/exoplayer/demo/player/DemoPlayer.java
View file @
6bf52dd6
...
...
@@ -129,6 +129,8 @@ public class DemoPlayer implements ExoPlayer.Listener, ChunkSampleSource.EventLi
void
onLoadStarted
(
int
sourceId
,
String
formatId
,
int
trigger
,
boolean
isInitialization
,
int
mediaStartTimeMs
,
int
mediaEndTimeMs
,
long
length
);
void
onLoadCompleted
(
int
sourceId
,
long
bytesLoaded
);
void
onDecoderInitialized
(
String
decoderName
,
long
elapsedRealtimeMs
,
long
initializationDurationMs
);
}
/**
...
...
@@ -478,6 +480,16 @@ public class DemoPlayer implements ExoPlayer.Listener, ChunkSampleSource.EventLi
}
@Override
public
void
onDecoderInitialized
(
String
decoderName
,
long
elapsedRealtimeMs
,
long
initializationDurationMs
)
{
if
(
infoListener
!=
null
)
{
infoListener
.
onDecoderInitialized
(
decoderName
,
elapsedRealtimeMs
,
initializationDurationMs
);
}
}
@Override
public
void
onUpstreamError
(
int
sourceId
,
IOException
e
)
{
if
(
internalErrorListener
!=
null
)
{
internalErrorListener
.
onUpstreamError
(
sourceId
,
e
);
...
...
library/src/main/java/com/google/android/exoplayer/MediaCodecTrackRenderer.java
View file @
6bf52dd6
...
...
@@ -59,6 +59,17 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer {
*/
void
onCryptoError
(
CryptoException
e
);
/**
* Invoked when a decoder is successfully created.
*
* @param decoderName The decoder that was configured and created.
* @param elapsedRealtimeMs {@code elapsedRealtime} timestamp of when the initialization
* finished.
* @param initializationDurationMs Amount of time taken to initialize the decoder.
*/
void
onDecoderInitialized
(
String
decoderName
,
long
elapsedRealtimeMs
,
long
initializationDurationMs
);
}
/**
...
...
@@ -332,9 +343,13 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer {
String
decoderName
=
decoderInfo
.
name
;
codecIsAdaptive
=
decoderInfo
.
adaptive
;
try
{
long
codecInitializingTimestamp
=
SystemClock
.
elapsedRealtime
();
codec
=
MediaCodec
.
createByCodecName
(
decoderName
);
configureCodec
(
codec
,
format
.
getFrameworkMediaFormatV16
(),
mediaCrypto
);
codec
.
start
();
long
codecInitializedTimestamp
=
SystemClock
.
elapsedRealtime
();
notifyDecoderInitialized
(
decoderName
,
codecInitializedTimestamp
,
codecInitializedTimestamp
-
codecInitializingTimestamp
);
inputBuffers
=
codec
.
getInputBuffers
();
outputBuffers
=
codec
.
getOutputBuffers
();
}
catch
(
Exception
e
)
{
...
...
@@ -846,6 +861,19 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer {
}
}
private
void
notifyDecoderInitialized
(
final
String
decoderName
,
final
long
initializedTimestamp
,
final
long
initializationDuration
)
{
if
(
eventHandler
!=
null
&&
eventListener
!=
null
)
{
eventHandler
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
eventListener
.
onDecoderInitialized
(
decoderName
,
initializedTimestamp
,
initializationDuration
);
}
});
}
}
private
int
getDecodeOnlyIndex
(
long
presentationTimeUs
)
{
final
int
size
=
decodeOnlyPresentationTimestamps
.
size
();
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
...
...
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