Skip to content

Commit

Permalink
Restore equivalence
Browse files Browse the repository at this point in the history
  • Loading branch information
ojw28 committed Feb 27, 2018
1 parent 51405c9 commit aa57062
Show file tree
Hide file tree
Showing 5 changed files with 166 additions and 104 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ repositories {
}
```

Next add a gradle compile dependency to the `build.gradle` file of your app
module. The following will add a dependency to the full library:
Next add a dependency in the `build.gradle` file of your app module. The
following will add a dependency to the full library:

```gradle
implementation 'com.google.android.exoplayer:exoplayer:2.X.X'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1929,12 +1929,12 @@ private byte[] getHdrStaticInfo() {

/**
* Builds initialization data for a {@link Format} from FourCC codec private data.
* <p>
* VC1 and H263 are the only supported compression types.
*
* @return A pair object with the first object being the codec mime type
* and the second object the initialization data for the {@link Format},
* or null if the compression type is not a currently supported type (VC1 or H263).
* <p>VC1 and H263 are the only supported compression types.
*
* @return The codec mime type and initialization data. If the compression type is not supported
* then the mime type is set to {@link MimeTypes#VIDEO_UNKNOWN} and the initialization data
* is {@code null}.
* @throws ParserException If the initialization data could not be built.
*/
private static Pair<String, List<byte[]>> parseFourCcPrivate(ParsableByteArray buffer)
Expand All @@ -1944,14 +1944,16 @@ private static Pair<String, List<byte[]>> parseFourCcPrivate(ParsableByteArray b
long compression = buffer.readLittleEndianUnsignedInt();
if (compression == FOURCC_COMPRESSION_DIVX) {
return new Pair<>(MimeTypes.VIDEO_H263, null);
} else if (compression == FOURCC_COMPRESSION_VC1) {
} else if (compression == FOURCC_COMPRESSION_VC1) {
// Search for the initialization data from the end of the BITMAPINFOHEADER. The last 20
// bytes of which are: sizeImage(4), xPel/m (4), yPel/m (4), clrUsed(4), clrImportant(4).
int startOffset = buffer.getPosition() + 20;
byte[] bufferData = buffer.data;
for (int offset = startOffset; offset < bufferData.length - 4; offset++) {
if (bufferData[offset] == 0x00 && bufferData[offset + 1] == 0x00
&& bufferData[offset + 2] == 0x01 && bufferData[offset + 3] == 0x0F) {
if (bufferData[offset] == 0x00
&& bufferData[offset + 1] == 0x00
&& bufferData[offset + 2] == 0x01
&& bufferData[offset + 3] == 0x0F) {
// We've found the initialization data.
byte[] initializationData = Arrays.copyOfRange(bufferData, offset, bufferData.length);
return new Pair<>(MimeTypes.VIDEO_VC1, Collections.singletonList(initializationData));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ public void onStateChange(DownloadManager downloadManager, DownloadState downloa
@Override
public void onIdle(DownloadManager downloadManager) {
// Make sure startForeground is called before stopping.
// Workaround for https://buganizer.corp.google.com/issues/69424260
if (Util.SDK_INT >= 26) {
Builder notificationBuilder = new Builder(this, getNotificationChannelId());
Notification foregroundNotification = notificationBuilder.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -614,8 +614,8 @@ private static void maybeTerminateInputStream(HttpURLConnection connection, long
}
String className = inputStream.getClass().getName();
if ("com.android.okhttp.internal.http.HttpTransport$ChunkedInputStream".equals(className)
|| "com.android.okhttp.internal.http.HttpTransport$FixedLengthInputStream".equals(
className)) {
|| "com.android.okhttp.internal.http.HttpTransport$FixedLengthInputStream"
.equals(className)) {
Class<?> superclass = inputStream.getClass().getSuperclass();
Method unexpectedEndOfInput = superclass.getDeclaredMethod("unexpectedEndOfInput");
unexpectedEndOfInput.setAccessible(true);
Expand Down
Loading

0 comments on commit aa57062

Please sign in to comment.