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
588be2bd
authored
Jun 26, 2015
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fix intermittent decoder crash when playing MP3 inside MP4
parent
3bcd9ca6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
16 deletions
library/src/main/java/com/google/android/exoplayer/extractor/mp3/Mp3Extractor.java
library/src/main/java/com/google/android/exoplayer/extractor/mp4/AtomParsers.java
library/src/main/java/com/google/android/exoplayer/extractor/ts/MpegAudioReader.java
library/src/main/java/com/google/android/exoplayer/util/Ac3Util.java
library/src/main/java/com/google/android/exoplayer/extractor/mp3/Mp3Extractor.java
View file @
588be2bd
...
...
@@ -30,7 +30,6 @@ import com.google.android.exoplayer.util.Util;
import
java.io.EOFException
;
import
java.io.IOException
;
import
java.util.Collections
;
/**
* Extracts data from an MP3 file.
...
...
@@ -247,7 +246,7 @@ public final class Mp3Extractor implements Extractor {
extractorOutput
.
seekMap
(
seeker
);
trackOutput
.
format
(
MediaFormat
.
createAudioFormat
(
synchronizedHeader
.
mimeType
,
MpegAudioHeader
.
MAX_FRAME_SIZE_BYTES
,
seeker
.
getDurationUs
(),
synchronizedHeader
.
channels
,
synchronizedHeader
.
sampleRate
,
Collections
.<
byte
[]>
emptyList
()
));
synchronizedHeader
.
sampleRate
,
null
));
}
return
headerPosition
;
...
...
library/src/main/java/com/google/android/exoplayer/extractor/mp4/AtomParsers.java
View file @
588be2bd
...
...
@@ -471,8 +471,7 @@ import java.util.List;
}
}
List
<
byte
[]>
initializationData
=
csdLength
==
0
?
Collections
.<
byte
[]>
emptyList
()
:
Collections
.
singletonList
(
buffer
);
List
<
byte
[]>
initializationData
=
csdLength
==
0
?
null
:
Collections
.
singletonList
(
buffer
);
return
Pair
.
create
(
initializationData
,
lengthSizeMinusOne
+
1
);
}
...
...
@@ -628,6 +627,10 @@ import java.util.List;
int
objectTypeIndication
=
parent
.
readUnsignedByte
();
String
mimeType
;
switch
(
objectTypeIndication
)
{
case
0x6B
:
mimeType
=
MimeTypes
.
AUDIO_MPEG
;
// Don't extract codec-specific data for MPEG audio tracks, as it is not needed.
return
Pair
.
create
(
mimeType
,
null
);
case
0x20
:
mimeType
=
MimeTypes
.
VIDEO_MP4V
;
break
;
...
...
@@ -640,9 +643,6 @@ import java.util.List;
case
0x40
:
mimeType
=
MimeTypes
.
AUDIO_AAC
;
break
;
case
0x6B
:
mimeType
=
MimeTypes
.
AUDIO_MPEG
;
break
;
case
0xA5
:
mimeType
=
MimeTypes
.
AUDIO_AC3
;
break
;
...
...
library/src/main/java/com/google/android/exoplayer/extractor/ts/MpegAudioReader.java
View file @
588be2bd
...
...
@@ -21,8 +21,6 @@ import com.google.android.exoplayer.extractor.TrackOutput;
import
com.google.android.exoplayer.util.MpegAudioHeader
;
import
com.google.android.exoplayer.util.ParsableByteArray
;
import
java.util.Collections
;
/**
* Parses a continuous MPEG Audio byte stream and extracts individual frames.
*/
...
...
@@ -164,7 +162,7 @@ import java.util.Collections;
frameDurationUs
=
(
C
.
MICROS_PER_SECOND
*
header
.
samplesPerFrame
)
/
header
.
sampleRate
;
MediaFormat
mediaFormat
=
MediaFormat
.
createAudioFormat
(
header
.
mimeType
,
MpegAudioHeader
.
MAX_FRAME_SIZE_BYTES
,
C
.
UNKNOWN_TIME_US
,
header
.
channels
,
header
.
sampleRate
,
Collections
.<
byte
[]>
emptyList
()
);
header
.
sampleRate
,
null
);
output
.
format
(
mediaFormat
);
hasOutputFormat
=
true
;
}
...
...
library/src/main/java/com/google/android/exoplayer/util/Ac3Util.java
View file @
588be2bd
...
...
@@ -17,8 +17,6 @@ package com.google.android.exoplayer.util;
import
com.google.android.exoplayer.MediaFormat
;
import
java.util.Collections
;
/**
* Utility methods for parsing AC-3 headers.
*/
...
...
@@ -51,7 +49,7 @@ public final class Ac3Util {
channelCount
++;
}
return
MediaFormat
.
createAudioFormat
(
MimeTypes
.
AUDIO_AC3
,
MediaFormat
.
NO_VALUE
,
channelCount
,
sampleRate
,
Collections
.<
byte
[]>
emptyList
()
);
channelCount
,
sampleRate
,
null
);
}
/**
...
...
@@ -74,7 +72,7 @@ public final class Ac3Util {
channelCount
++;
}
return
MediaFormat
.
createAudioFormat
(
MimeTypes
.
AUDIO_EC3
,
MediaFormat
.
NO_VALUE
,
channelCount
,
sampleRate
,
Collections
.<
byte
[]>
emptyList
()
);
channelCount
,
sampleRate
,
null
);
}
/**
...
...
@@ -102,8 +100,7 @@ public final class Ac3Util {
}
boolean
lfeon
=
data
.
readBit
();
return
MediaFormat
.
createAudioFormat
(
MimeTypes
.
AUDIO_AC3
,
MediaFormat
.
NO_VALUE
,
CHANNEL_COUNTS
[
acmod
]
+
(
lfeon
?
1
:
0
),
SAMPLE_RATES
[
fscod
],
Collections
.<
byte
[]>
emptyList
());
CHANNEL_COUNTS
[
acmod
]
+
(
lfeon
?
1
:
0
),
SAMPLE_RATES
[
fscod
],
null
);
}
/**
...
...
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