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
5cf781ab
authored
Dec 19, 2014
by
ojw28
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge pull request #211 from google/dev
dev -> dev-hls
parents
83e80f98
7f91a6d4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
8 deletions
library/src/main/java/com/google/android/exoplayer/audio/AudioTrack.java
library/src/main/java/com/google/android/exoplayer/upstream/HttpDataSource.java
library/src/main/java/com/google/android/exoplayer/audio/AudioTrack.java
View file @
5cf781ab
...
...
@@ -361,9 +361,12 @@ public final class AudioTrack {
* written data.
*/
public
int
handleBuffer
(
ByteBuffer
buffer
,
int
offset
,
int
size
,
long
presentationTimeUs
)
{
int
result
=
0
;
if
(
size
==
0
)
{
return
RESULT_BUFFER_CONSUMED
;
}
if
(
temporaryBufferSize
==
0
&&
size
!=
0
)
{
int
result
=
0
;
if
(
temporaryBufferSize
==
0
)
{
if
(
isAc3
&&
ac3Bitrate
==
UNKNOWN_AC3_BITRATE
)
{
// Each AC-3 buffer contains 1536 frames of audio, so the AudioTrack playback position
// advances by 1536 per buffer (32 ms at 48 kHz). Calculate the bitrate in kbit/s.
...
...
@@ -393,15 +396,11 @@ public final class AudioTrack {
// number of bytes submitted.
startMediaTimeUs
+=
(
bufferStartTime
-
expectedBufferStartTime
);
startMediaTimeState
=
START_IN_SYNC
;
result
=
RESULT_POSITION_DISCONTINUITY
;
result
|
=
RESULT_POSITION_DISCONTINUITY
;
}
}
}
if
(
size
==
0
)
{
return
result
;
}
if
(
temporaryBufferSize
==
0
)
{
temporaryBufferSize
=
size
;
buffer
.
position
(
offset
);
...
...
library/src/main/java/com/google/android/exoplayer/upstream/HttpDataSource.java
View file @
5cf781ab
...
...
@@ -226,6 +226,19 @@ public class HttpDataSource implements DataSource {
}
}
/*
* TODO: If the server uses gzip compression when serving the response, this may end up returning
* the size of the compressed response, where-as it should be returning the decompressed size or
* -1. See: developer.android.com/reference/java/net/HttpURLConnection.html
*
* To fix this we should:
*
* 1. Explicitly require no compression for media requests (since media should be compressed
* already) by setting the Accept-Encoding header to "identity"
* 2. In other cases, for example when requesting manifests, we don't want to disable compression.
* For these cases we should ensure that we return -1 here (and avoid performing any sanity
* checks on the content length).
*/
@Override
public
long
open
(
DataSpec
dataSpec
)
throws
HttpDataSourceException
{
this
.
dataSpec
=
dataSpec
;
...
...
@@ -380,7 +393,6 @@ public class HttpDataSource implements DataSource {
connection
.
setRequestProperty
(
property
.
getKey
(),
property
.
getValue
());
}
}
connection
.
setRequestProperty
(
"Accept-Encoding"
,
"deflate"
);
connection
.
setRequestProperty
(
"User-Agent"
,
userAgent
);
connection
.
setRequestProperty
(
"Range"
,
buildRangeHeader
(
dataSpec
));
connection
.
connect
();
...
...
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