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
81b8396b
authored
Oct 29, 2019
by
aquilescanta
Committed by
Oliver Woodman
Oct 30, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Move peek result constants into SampleMetadataQueue
PiperOrigin-RevId: 277253308
parent
817772fc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
35 deletions
library/core/src/main/java/com/google/android/exoplayer2/source/SampleMetadataQueue.java
library/core/src/main/java/com/google/android/exoplayer2/source/SampleQueue.java
library/core/src/main/java/com/google/android/exoplayer2/source/SampleMetadataQueue.java
View file @
81b8396b
...
...
@@ -15,14 +15,17 @@
*/
package
com
.
google
.
android
.
exoplayer2
.
source
;
import
androidx.annotation.IntDef
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.Format
;
import
com.google.android.exoplayer2.FormatHolder
;
import
com.google.android.exoplayer2.decoder.DecoderInputBuffer
;
import
com.google.android.exoplayer2.extractor.TrackOutput.CryptoData
;
import
com.google.android.exoplayer2.source.SampleQueue.PeekResult
;
import
com.google.android.exoplayer2.util.Assertions
;
import
com.google.android.exoplayer2.util.Util
;
import
java.lang.annotation.Documented
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
/**
* A queue of metadata describing the contents of a media buffer.
...
...
@@ -40,6 +43,27 @@ import com.google.android.exoplayer2.util.Util;
}
/** Values returned by {@link #peekNext} ()}. */
@Documented
@Retention
(
RetentionPolicy
.
SOURCE
)
@IntDef
(
value
=
{
PEEK_RESULT_NOTHING
,
PEEK_RESULT_FORMAT
,
PEEK_RESULT_BUFFER_CLEAR
,
PEEK_RESULT_BUFFER_ENCRYPTED
})
public
@interface
PeekResult
{}
/** Nothing is available for reading. */
public
static
final
int
PEEK_RESULT_NOTHING
=
0
;
/** A format change is available for reading */
public
static
final
int
PEEK_RESULT_FORMAT
=
1
;
/** A clear buffer is available for reading. */
public
static
final
int
PEEK_RESULT_BUFFER_CLEAR
=
2
;
/** An encrypted buffer is available for reading. */
public
static
final
int
PEEK_RESULT_BUFFER_ENCRYPTED
=
3
;
private
static
final
int
SAMPLE_CAPACITY_INCREMENT
=
1000
;
private
int
capacity
;
...
...
@@ -226,15 +250,15 @@ import com.google.android.exoplayer2.util.Util;
@PeekResult
public
synchronized
int
peekNext
(
Format
downstreamFormat
)
{
if
(
readPosition
==
length
)
{
return
SampleQueue
.
PEEK_RESULT_NOTHING
;
return
PEEK_RESULT_NOTHING
;
}
int
relativeReadIndex
=
getRelativeIndex
(
readPosition
);
if
(
formats
[
relativeReadIndex
]
!=
downstreamFormat
)
{
return
SampleQueue
.
PEEK_RESULT_FORMAT
;
return
PEEK_RESULT_FORMAT
;
}
else
{
return
(
flags
[
relativeReadIndex
]
&
C
.
BUFFER_FLAG_ENCRYPTED
)
!=
0
?
SampleQueue
.
PEEK_RESULT_BUFFER_ENCRYPTED
:
SampleQueue
.
PEEK_RESULT_BUFFER_CLEAR
;
?
PEEK_RESULT_BUFFER_ENCRYPTED
:
PEEK_RESULT_BUFFER_CLEAR
;
}
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/SampleQueue.java
View file @
81b8396b
...
...
@@ -16,7 +16,6 @@
package
com
.
google
.
android
.
exoplayer2
.
source
;
import
android.os.Looper
;
import
androidx.annotation.IntDef
;
import
androidx.annotation.Nullable
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.Format
;
...
...
@@ -35,9 +34,6 @@ import com.google.android.exoplayer2.util.ParsableByteArray;
import
com.google.android.exoplayer2.util.Util
;
import
java.io.EOFException
;
import
java.io.IOException
;
import
java.lang.annotation.Documented
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.nio.ByteBuffer
;
/** A queue of media samples. */
...
...
@@ -57,27 +53,6 @@ public class SampleQueue implements TrackOutput {
}
/** Values returned by {@link #peekNext()}. */
@Documented
@Retention
(
RetentionPolicy
.
SOURCE
)
@IntDef
(
value
=
{
PEEK_RESULT_NOTHING
,
PEEK_RESULT_FORMAT
,
PEEK_RESULT_BUFFER_CLEAR
,
PEEK_RESULT_BUFFER_ENCRYPTED
})
/* package */
@interface
PeekResult
{}
/** Nothing is available for reading. */
/* package */
static
final
int
PEEK_RESULT_NOTHING
=
0
;
/** A format change is available for reading */
/* package */
static
final
int
PEEK_RESULT_FORMAT
=
1
;
/** A clear buffer is available for reading. */
/* package */
static
final
int
PEEK_RESULT_BUFFER_CLEAR
=
2
;
/** An encrypted buffer is available for reading. */
/* package */
static
final
int
PEEK_RESULT_BUFFER_ENCRYPTED
=
3
;
public
static
final
int
ADVANCE_FAILED
=
-
1
;
private
static
final
int
INITIAL_SCRATCH_SIZE
=
32
;
...
...
@@ -480,15 +455,15 @@ public class SampleQueue implements TrackOutput {
* queue is empty.
*/
public
boolean
isReady
(
boolean
loadingFinished
)
{
@SampleQueue
.
PeekResult
int
nextInQueue
=
metadataQueue
.
peekNext
(
downstreamFormat
);
@Sample
Metadata
Queue
.
PeekResult
int
nextInQueue
=
metadataQueue
.
peekNext
(
downstreamFormat
);
switch
(
nextInQueue
)
{
case
SampleQueue
.
PEEK_RESULT_NOTHING
:
case
Sample
Metadata
Queue
.
PEEK_RESULT_NOTHING
:
return
loadingFinished
;
case
SampleQueue
.
PEEK_RESULT_FORMAT
:
case
Sample
Metadata
Queue
.
PEEK_RESULT_FORMAT
:
return
true
;
case
SampleQueue
.
PEEK_RESULT_BUFFER_CLEAR
:
case
Sample
Metadata
Queue
.
PEEK_RESULT_BUFFER_CLEAR
:
return
currentSession
==
null
||
playClearSamplesWithoutKeys
;
case
SampleQueue
.
PEEK_RESULT_BUFFER_ENCRYPTED
:
case
Sample
Metadata
Queue
.
PEEK_RESULT_BUFFER_ENCRYPTED
:
return
drmSessionManager
==
DrmSessionManager
.
DUMMY
||
Assertions
.
checkNotNull
(
currentSession
).
getState
()
==
DrmSession
.
STATE_OPENED_WITH_KEYS
;
...
...
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