Merge "Fix race condition in MediaHTTPConnection" into pi-dev
am: d7c87b74d9
Change-Id: I65de507c2b98b81a25141994baba38831aea9142
This commit is contained in:
@@ -323,8 +323,10 @@ public class MediaHTTPConnection extends IMediaHTTPConnection.Stub {
|
||||
StrictMode.setThreadPolicy(policy);
|
||||
|
||||
try {
|
||||
if (offset != mCurrentOffset) {
|
||||
seekTo(offset);
|
||||
synchronized(this) {
|
||||
if (offset != mCurrentOffset) {
|
||||
seekTo(offset);
|
||||
}
|
||||
}
|
||||
|
||||
int n = mInputStream.read(data, 0, size);
|
||||
@@ -366,7 +368,7 @@ public class MediaHTTPConnection extends IMediaHTTPConnection.Stub {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSize() {
|
||||
public synchronized long getSize() {
|
||||
if (mConnection == null) {
|
||||
try {
|
||||
seekTo(0);
|
||||
@@ -379,7 +381,7 @@ public class MediaHTTPConnection extends IMediaHTTPConnection.Stub {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMIMEType() {
|
||||
public synchronized String getMIMEType() {
|
||||
if (mConnection == null) {
|
||||
try {
|
||||
seekTo(0);
|
||||
|
||||
Reference in New Issue
Block a user