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
cde1c27e
authored
Aug 19, 2015
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Make Opus codec-specific data match the platform.
Issue: #690
parent
02f1efd1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
8 deletions
extensions/opus/src/main/java/com/google/android/exoplayer/ext/opus/LibopusAudioTrackRenderer.java
library/src/androidTest/java/com/google/android/exoplayer/extractor/webm/WebmExtractorTest.java
library/src/main/java/com/google/android/exoplayer/extractor/webm/WebmExtractor.java
extensions/opus/src/main/java/com/google/android/exoplayer/ext/opus/LibopusAudioTrackRenderer.java
View file @
cde1c27e
...
...
@@ -31,6 +31,7 @@ import com.google.android.exoplayer.util.MimeTypes;
import
android.os.Handler
;
import
java.nio.ByteBuffer
;
import
java.nio.ByteOrder
;
import
java.util.List
;
/**
...
...
@@ -165,12 +166,13 @@ public final class LibopusAudioTrackRenderer extends SampleSourceTrackRenderer
long
codecDelayNs
=
-
1
;
long
seekPreRollNs
=
-
1
;
if
(
initializationData
.
size
()
==
3
)
{
if
(
initializationData
.
get
(
1
).
length
!=
Long
.
SIZE
||
initializationData
.
get
(
2
).
length
!=
Long
.
SIZE
)
{
if
(
initializationData
.
get
(
1
).
length
!=
8
||
initializationData
.
get
(
2
).
length
!=
8
)
{
throw
new
ExoPlaybackException
(
"Invalid Codec Delay or Seek Preroll"
);
}
codecDelayNs
=
ByteBuffer
.
wrap
(
initializationData
.
get
(
1
)).
getLong
();
seekPreRollNs
=
ByteBuffer
.
wrap
(
initializationData
.
get
(
2
)).
getLong
();
codecDelayNs
=
ByteBuffer
.
wrap
(
initializationData
.
get
(
1
)).
order
(
ByteOrder
.
LITTLE_ENDIAN
).
getLong
();
seekPreRollNs
=
ByteBuffer
.
wrap
(
initializationData
.
get
(
2
)).
order
(
ByteOrder
.
LITTLE_ENDIAN
).
getLong
();
}
try
{
decoder
=
new
OpusDecoderWrapper
(
initializationData
.
get
(
0
),
codecDelayNs
,
seekPreRollNs
);
...
...
library/src/androidTest/java/com/google/android/exoplayer/extractor/webm/WebmExtractorTest.java
View file @
cde1c27e
...
...
@@ -34,6 +34,7 @@ import android.test.InstrumentationTestCase;
import
java.io.IOException
;
import
java.nio.ByteBuffer
;
import
java.nio.ByteOrder
;
import
java.util.Arrays
;
import
java.util.UUID
;
...
...
@@ -731,8 +732,10 @@ public final class WebmExtractorTest extends InstrumentationTestCase {
assertEquals
(
3
,
format
.
initializationData
.
size
());
android
.
test
.
MoreAsserts
.
assertEquals
(
TEST_OPUS_CODEC_PRIVATE
,
format
.
initializationData
.
get
(
0
));
assertEquals
(
TEST_CODEC_DELAY
,
ByteBuffer
.
wrap
(
format
.
initializationData
.
get
(
1
)).
getLong
());
assertEquals
(
TEST_SEEK_PRE_ROLL
,
ByteBuffer
.
wrap
(
format
.
initializationData
.
get
(
2
)).
getLong
());
assertEquals
(
TEST_CODEC_DELAY
,
ByteBuffer
.
wrap
(
format
.
initializationData
.
get
(
1
))
.
order
(
ByteOrder
.
LITTLE_ENDIAN
).
getLong
());
assertEquals
(
TEST_SEEK_PRE_ROLL
,
ByteBuffer
.
wrap
(
format
.
initializationData
.
get
(
2
))
.
order
(
ByteOrder
.
LITTLE_ENDIAN
).
getLong
());
}
else
if
(
MimeTypes
.
AUDIO_VORBIS
.
equals
(
expectedMimeType
))
{
assertEquals
(
2
,
format
.
initializationData
.
size
());
assertEquals
(
TEST_VORBIS_INFO_SIZE
,
format
.
initializationData
.
get
(
0
).
length
);
...
...
library/src/main/java/com/google/android/exoplayer/extractor/webm/WebmExtractor.java
View file @
cde1c27e
...
...
@@ -37,6 +37,7 @@ import android.util.Pair;
import
java.io.IOException
;
import
java.nio.ByteBuffer
;
import
java.nio.ByteOrder
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collections
;
...
...
@@ -1104,8 +1105,10 @@ public final class WebmExtractor implements Extractor {
maxInputSize
=
OPUS_MAX_INPUT_SIZE
;
initializationData
=
new
ArrayList
<>(
3
);
initializationData
.
add
(
codecPrivate
);
initializationData
.
add
(
ByteBuffer
.
allocate
(
Long
.
SIZE
).
putLong
(
codecDelayNs
).
array
());
initializationData
.
add
(
ByteBuffer
.
allocate
(
Long
.
SIZE
).
putLong
(
seekPreRollNs
).
array
());
initializationData
.
add
(
ByteBuffer
.
allocate
(
8
).
order
(
ByteOrder
.
LITTLE_ENDIAN
).
putLong
(
codecDelayNs
).
array
());
initializationData
.
add
(
ByteBuffer
.
allocate
(
8
).
order
(
ByteOrder
.
LITTLE_ENDIAN
).
putLong
(
seekPreRollNs
).
array
());
break
;
case
CODEC_ID_AAC:
mimeType
=
MimeTypes
.
AUDIO_AAC
;
...
...
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