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
555eb9d4
authored
Jun 23, 2017
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Mini cleanup
parent
8bb64397
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
7 deletions
library/core/src/androidTest/java/com/google/android/exoplayer2/upstream/ContentDataSourceTest.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/ContentDataSource.java
library/core/src/androidTest/java/com/google/android/exoplayer2/upstream/ContentDataSourceTest.java
View file @
555eb9d4
...
...
@@ -33,6 +33,7 @@ import java.io.IOException;
*/
public
final
class
ContentDataSourceTest
extends
InstrumentationTestCase
{
private
static
final
String
AUTHORITY
=
"com.google.android.exoplayer2.core.test"
;
private
static
final
String
DATA_PATH
=
"binary/1024_incrementing_bytes.mp3"
;
private
static
final
long
DATA_LENGTH
=
1024
;
...
...
@@ -40,7 +41,7 @@ public final class ContentDataSourceTest extends InstrumentationTestCase {
ContentDataSource
dataSource
=
new
ContentDataSource
(
getInstrumentation
().
getContext
());
Uri
contentUri
=
new
Uri
.
Builder
()
.
scheme
(
ContentResolver
.
SCHEME_CONTENT
)
.
authority
(
TestContentProvider
.
AUTHORITY
)
.
authority
(
AUTHORITY
)
.
path
(
DATA_PATH
).
build
();
DataSpec
dataSpec
=
new
DataSpec
(
contentUri
);
try
{
...
...
@@ -57,7 +58,7 @@ public final class ContentDataSourceTest extends InstrumentationTestCase {
ContentDataSource
dataSource
=
new
ContentDataSource
(
getInstrumentation
().
getContext
());
Uri
contentUri
=
new
Uri
.
Builder
()
.
scheme
(
ContentResolver
.
SCHEME_CONTENT
)
.
authority
(
TestContentProvider
.
AUTHORITY
)
.
authority
(
AUTHORITY
)
.
build
();
DataSpec
dataSpec
=
new
DataSpec
(
contentUri
);
try
{
...
...
@@ -70,10 +71,11 @@ public final class ContentDataSourceTest extends InstrumentationTestCase {
}
}
/**
* A {@link ContentProvider} for the test.
*/
public
static
final
class
TestContentProvider
extends
ContentProvider
{
private
static
final
String
AUTHORITY
=
"com.google.android.exoplayer2.core.test"
;
@Override
public
boolean
onCreate
()
{
return
true
;
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/ContentDataSource.java
View file @
555eb9d4
...
...
@@ -91,9 +91,9 @@ public final class ContentDataSource implements DataSource {
// The asset must extend to the end of the file.
bytesRemaining
=
inputStream
.
available
();
if
(
bytesRemaining
==
0
)
{
// FileInputStream.available() returns 0 if the remaining length cannot be determined,
or
//
if it's greater than Integer.MAX_VALUE. We don't know the true length in either case,
// so treat as unbounded.
// FileInputStream.available() returns 0 if the remaining length cannot be determined,
//
or if it's greater than Integer.MAX_VALUE. We don't know the true length in either
//
case,
so treat as unbounded.
bytesRemaining
=
C
.
LENGTH_UNSET
;
}
}
...
...
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