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
1d36edc2
authored
Jun 27, 2019
by
olly
Committed by
Oliver Woodman
Jul 02, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Remove unnecessary FileDescriptor sync
PiperOrigin-RevId: 255380796
parent
2a366e76
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 additions
and
31 deletions
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CacheDataSink.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CacheDataSinkFactory.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CacheDataSink.java
View file @
1d36edc2
...
...
@@ -49,7 +49,6 @@ public final class CacheDataSink implements DataSink {
private
final
long
fragmentSize
;
private
final
int
bufferSize
;
private
boolean
syncFileDescriptor
;
private
DataSpec
dataSpec
;
private
long
dataSpecFragmentSize
;
private
File
file
;
...
...
@@ -108,18 +107,6 @@ public final class CacheDataSink implements DataSink {
this
.
cache
=
Assertions
.
checkNotNull
(
cache
);
this
.
fragmentSize
=
fragmentSize
==
C
.
LENGTH_UNSET
?
Long
.
MAX_VALUE
:
fragmentSize
;
this
.
bufferSize
=
bufferSize
;
syncFileDescriptor
=
true
;
}
/**
* Sets whether file descriptors are synced when closing output streams.
*
* <p>This method is experimental, and will be renamed or removed in a future release.
*
* @param syncFileDescriptor Whether file descriptors are synced when closing output streams.
*/
public
void
experimental_setSyncFileDescriptor
(
boolean
syncFileDescriptor
)
{
this
.
syncFileDescriptor
=
syncFileDescriptor
;
}
@Override
...
...
@@ -207,9 +194,6 @@ public final class CacheDataSink implements DataSink {
boolean
success
=
false
;
try
{
outputStream
.
flush
();
if
(
syncFileDescriptor
)
{
underlyingFileOutputStream
.
getFD
().
sync
();
}
success
=
true
;
}
finally
{
Util
.
closeQuietly
(
outputStream
);
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CacheDataSinkFactory.java
View file @
1d36edc2
...
...
@@ -26,8 +26,6 @@ public final class CacheDataSinkFactory implements DataSink.Factory {
private
final
long
fragmentSize
;
private
final
int
bufferSize
;
private
boolean
syncFileDescriptor
;
/** @see CacheDataSink#CacheDataSink(Cache, long) */
public
CacheDataSinkFactory
(
Cache
cache
,
long
fragmentSize
)
{
this
(
cache
,
fragmentSize
,
CacheDataSink
.
DEFAULT_BUFFER_SIZE
);
...
...
@@ -40,20 +38,8 @@ public final class CacheDataSinkFactory implements DataSink.Factory {
this
.
bufferSize
=
bufferSize
;
}
/**
* See {@link CacheDataSink#experimental_setSyncFileDescriptor(boolean)}.
*
* <p>This method is experimental, and will be renamed or removed in a future release.
*/
public
CacheDataSinkFactory
experimental_setSyncFileDescriptor
(
boolean
syncFileDescriptor
)
{
this
.
syncFileDescriptor
=
syncFileDescriptor
;
return
this
;
}
@Override
public
DataSink
createDataSink
()
{
CacheDataSink
dataSink
=
new
CacheDataSink
(
cache
,
fragmentSize
,
bufferSize
);
dataSink
.
experimental_setSyncFileDescriptor
(
syncFileDescriptor
);
return
dataSink
;
return
new
CacheDataSink
(
cache
,
fragmentSize
,
bufferSize
);
}
}
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