Commit 2f8bd42b by olly Committed by Oliver Woodman

Remove Utils.equals() check for object equality that is fragile.

PiperOrigin-RevId: 254046126
parent ba5e2a4a
...@@ -32,7 +32,6 @@ import com.google.android.exoplayer2.util.Clock; ...@@ -32,7 +32,6 @@ import com.google.android.exoplayer2.util.Clock;
import com.google.android.exoplayer2.util.ConditionVariable; import com.google.android.exoplayer2.util.ConditionVariable;
import com.google.android.exoplayer2.util.Log; import com.google.android.exoplayer2.util.Log;
import com.google.android.exoplayer2.util.Predicate; import com.google.android.exoplayer2.util.Predicate;
import com.google.android.exoplayer2.util.Util;
import java.io.IOException; import java.io.IOException;
import java.net.SocketTimeoutException; import java.net.SocketTimeoutException;
import java.net.UnknownHostException; import java.net.UnknownHostException;
...@@ -750,6 +749,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource { ...@@ -750,6 +749,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource {
* @param buffer The ByteBuffer into which the read data is stored. Must be a direct ByteBuffer. * @param buffer The ByteBuffer into which the read data is stored. Must be a direct ByteBuffer.
* @throws HttpDataSourceException If an error occurs reading from the source. * @throws HttpDataSourceException If an error occurs reading from the source.
*/ */
@SuppressWarnings("ReferenceEquality")
private void readInternal(ByteBuffer buffer) throws HttpDataSourceException { private void readInternal(ByteBuffer buffer) throws HttpDataSourceException {
castNonNull(currentUrlRequest).read(buffer); castNonNull(currentUrlRequest).read(buffer);
try { try {
...@@ -759,7 +759,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource { ...@@ -759,7 +759,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource {
} catch (InterruptedException e) { } catch (InterruptedException e) {
// The operation is ongoing so replace buffer to avoid it being written to by this // The operation is ongoing so replace buffer to avoid it being written to by this
// operation during a subsequent request. // operation during a subsequent request.
if (Util.areEqual(buffer, readBuffer)) { if (buffer == readBuffer) {
readBuffer = null; readBuffer = null;
} }
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
...@@ -770,7 +770,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource { ...@@ -770,7 +770,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource {
} catch (SocketTimeoutException e) { } catch (SocketTimeoutException e) {
// The operation is ongoing so replace buffer to avoid it being written to by this // The operation is ongoing so replace buffer to avoid it being written to by this
// operation during a subsequent request. // operation during a subsequent request.
if (Util.areEqual(buffer, readBuffer)) { if (buffer == readBuffer) {
readBuffer = null; readBuffer = null;
} }
throw new HttpDataSourceException( throw new HttpDataSourceException(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment