mirror of
https://github.com/androidx/media.git
synced 2025-05-14 11:09:53 +08:00
Remove TODOs that we have little urge to actually do.
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=123410274
This commit is contained in:
parent
ccfb6beb30
commit
800006d08d
@ -24,6 +24,10 @@ import android.media.MediaDrm.ProvisionRequest;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -66,7 +70,7 @@ import java.util.UUID;
|
|||||||
@Override
|
@Override
|
||||||
public byte[] executeProvisionRequest(UUID uuid, ProvisionRequest request) throws IOException {
|
public byte[] executeProvisionRequest(UUID uuid, ProvisionRequest request) throws IOException {
|
||||||
String url = request.getDefaultUrl() + "&signedRequest=" + new String(request.getData());
|
String url = request.getDefaultUrl() + "&signedRequest=" + new String(request.getData());
|
||||||
return Util.executePost(url, null, null);
|
return executePost(url, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -75,7 +79,43 @@ import java.util.UUID;
|
|||||||
if (TextUtils.isEmpty(url)) {
|
if (TextUtils.isEmpty(url)) {
|
||||||
url = defaultUrl;
|
url = defaultUrl;
|
||||||
}
|
}
|
||||||
return Util.executePost(url, request.getData(), keyRequestProperties);
|
return executePost(url, request.getData(), keyRequestProperties);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static byte[] executePost(String url, byte[] data, Map<String, String> requestProperties)
|
||||||
|
throws IOException {
|
||||||
|
HttpURLConnection urlConnection = null;
|
||||||
|
try {
|
||||||
|
urlConnection = (HttpURLConnection) new URL(url).openConnection();
|
||||||
|
urlConnection.setRequestMethod("POST");
|
||||||
|
urlConnection.setDoOutput(data != null);
|
||||||
|
urlConnection.setDoInput(true);
|
||||||
|
if (requestProperties != null) {
|
||||||
|
for (Map.Entry<String, String> requestProperty : requestProperties.entrySet()) {
|
||||||
|
urlConnection.setRequestProperty(requestProperty.getKey(), requestProperty.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Write the request body, if there is one.
|
||||||
|
if (data != null) {
|
||||||
|
OutputStream out = urlConnection.getOutputStream();
|
||||||
|
try {
|
||||||
|
out.write(data);
|
||||||
|
} finally {
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Read and return the response body.
|
||||||
|
InputStream inputStream = urlConnection.getInputStream();
|
||||||
|
try {
|
||||||
|
return Util.toByteArray(inputStream);
|
||||||
|
} finally {
|
||||||
|
inputStream.close();
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
if (urlConnection != null) {
|
||||||
|
urlConnection.disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -127,8 +127,6 @@ public final class MediaCodecUtil {
|
|||||||
if (secure && decoderInfos.isEmpty() && 21 <= Util.SDK_INT && Util.SDK_INT <= 23) {
|
if (secure && decoderInfos.isEmpty() && 21 <= Util.SDK_INT && Util.SDK_INT <= 23) {
|
||||||
// Some devices don't list secure decoders on API level 21 [Internal: b/18678462]. Try the
|
// Some devices don't list secure decoders on API level 21 [Internal: b/18678462]. Try the
|
||||||
// legacy path. We also try this path on API levels 22 and 23 as a defensive measure.
|
// legacy path. We also try this path on API levels 22 and 23 as a defensive measure.
|
||||||
// TODO: Verify that the issue cannot occur on API levels 22 and 23, and tighten this block
|
|
||||||
// to execute on API level 21 only if confirmed.
|
|
||||||
mediaCodecList = new MediaCodecListCompatV16();
|
mediaCodecList = new MediaCodecListCompatV16();
|
||||||
decoderInfos = getDecoderInfosInternal(key, mediaCodecList);
|
decoderInfos = getDecoderInfosInternal(key, mediaCodecList);
|
||||||
if (!decoderInfos.isEmpty()) {
|
if (!decoderInfos.isEmpty()) {
|
||||||
|
@ -194,8 +194,6 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
|
|||||||
decoderCapable = decoderInfo.isVideoSizeSupportedV21(format.width, format.height);
|
decoderCapable = decoderInfo.isVideoSizeSupportedV21(format.width, format.height);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO[REFACTOR]: We should probably assume that we can decode at least the resolution of
|
|
||||||
// the display, or the camera, as a sanity check?
|
|
||||||
decoderCapable = format.width * format.height <= MediaCodecUtil.maxH264DecodableFrameSize();
|
decoderCapable = format.width * format.height <= MediaCodecUtil.maxH264DecodableFrameSize();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -21,11 +21,6 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* A provider of {@link Chunk}s for a {@link ChunkTrackStream} to load.
|
* A provider of {@link Chunk}s for a {@link ChunkTrackStream} to load.
|
||||||
*/
|
*/
|
||||||
/*
|
|
||||||
* TODO: Share more state between this interface and {@link ChunkSampleSource}. In particular
|
|
||||||
* implementations of this class needs to know about errors, and should be more tightly integrated
|
|
||||||
* into the process of resuming loading of a chunk after an error occurs.
|
|
||||||
*/
|
|
||||||
public interface ChunkSource {
|
public interface ChunkSource {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,8 +20,6 @@ import com.google.android.exoplayer.dash.mpd.RangedUri;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Indexes the segments within a media stream.
|
* Indexes the segments within a media stream.
|
||||||
*
|
|
||||||
* TODO: Generalize to cover all chunk streaming modes (e.g. SmoothStreaming) if possible.
|
|
||||||
*/
|
*/
|
||||||
public interface DashSegmentIndex {
|
public interface DashSegmentIndex {
|
||||||
|
|
||||||
|
@ -75,8 +75,6 @@ public class MediaPresentationDescriptionParser extends DefaultHandler
|
|||||||
/**
|
/**
|
||||||
* @param contentId An optional content identifier to include in the parsed manifest.
|
* @param contentId An optional content identifier to include in the parsed manifest.
|
||||||
*/
|
*/
|
||||||
// TODO: Remove the need to inject a content identifier here, by not including it in the parsed
|
|
||||||
// manifest. Instead, it should be injected directly where needed (i.e. DashChunkSource).
|
|
||||||
public MediaPresentationDescriptionParser(String contentId) {
|
public MediaPresentationDescriptionParser(String contentId) {
|
||||||
this.contentId = contentId;
|
this.contentId = contentId;
|
||||||
try {
|
try {
|
||||||
|
@ -355,7 +355,6 @@ public final class DefaultTrackOutput implements TrackOutput {
|
|||||||
* @param target The array into which data should be written.
|
* @param target The array into which data should be written.
|
||||||
* @param length The number of bytes to read.
|
* @param length The number of bytes to read.
|
||||||
*/
|
*/
|
||||||
// TODO: Consider reducing duplication of this method and the one above.
|
|
||||||
private void readData(long absolutePosition, byte[] target, int length) {
|
private void readData(long absolutePosition, byte[] target, int length) {
|
||||||
int bytesRead = 0;
|
int bytesRead = 0;
|
||||||
while (bytesRead < length) {
|
while (bytesRead < length) {
|
||||||
@ -713,8 +712,9 @@ public final class DefaultTrackOutput implements TrackOutput {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This can be optimized further using binary search, although the fact that the array
|
// This could be optimized to use a binary search, however in practice callers to this method
|
||||||
// is cyclic means we'd need to implement the binary search ourselves.
|
// often pass times near to the start of the buffer. Hence it's unclear whether switching to
|
||||||
|
// a binary search would yield any real benefit.
|
||||||
int sampleCount = 0;
|
int sampleCount = 0;
|
||||||
int sampleCountToKeyframe = -1;
|
int sampleCountToKeyframe = -1;
|
||||||
int searchIndex = relativeReadIndex;
|
int searchIndex = relativeReadIndex;
|
||||||
|
@ -25,8 +25,6 @@ import com.google.android.exoplayer.util.ParsableByteArray;
|
|||||||
/**
|
/**
|
||||||
* Consumes SEI buffers, outputting contained EIA608 messages to a {@link TrackOutput}.
|
* Consumes SEI buffers, outputting contained EIA608 messages to a {@link TrackOutput}.
|
||||||
*/
|
*/
|
||||||
// TODO: Technically, we shouldn't allow a sample to be read from the queue until we're sure that
|
|
||||||
// a sample with an earlier timestamp won't be added to it.
|
|
||||||
/* package */ final class SeiReader {
|
/* package */ final class SeiReader {
|
||||||
|
|
||||||
private final TrackOutput output;
|
private final TrackOutput output;
|
||||||
|
@ -36,7 +36,6 @@ import java.io.OutputStream;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
@ -44,7 +43,6 @@ import java.util.Collections;
|
|||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
@ -731,52 +729,6 @@ public final class Util {
|
|||||||
+ ") " + "ExoPlayerLib/" + ExoPlayerLibraryInfo.VERSION;
|
+ ") " + "ExoPlayerLib/" + ExoPlayerLibraryInfo.VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Executes a post request using {@link HttpURLConnection}.
|
|
||||||
*
|
|
||||||
* @param url The request URL.
|
|
||||||
* @param data The request body, or null.
|
|
||||||
* @param requestProperties Request properties, or null.
|
|
||||||
* @return The response body.
|
|
||||||
* @throws IOException If an error occurred making the request.
|
|
||||||
*/
|
|
||||||
// TODO: Remove this and use HttpDataSource once DataSpec supports inclusion of a POST body.
|
|
||||||
public static byte[] executePost(String url, byte[] data, Map<String, String> requestProperties)
|
|
||||||
throws IOException {
|
|
||||||
HttpURLConnection urlConnection = null;
|
|
||||||
try {
|
|
||||||
urlConnection = (HttpURLConnection) new URL(url).openConnection();
|
|
||||||
urlConnection.setRequestMethod("POST");
|
|
||||||
urlConnection.setDoOutput(data != null);
|
|
||||||
urlConnection.setDoInput(true);
|
|
||||||
if (requestProperties != null) {
|
|
||||||
for (Map.Entry<String, String> requestProperty : requestProperties.entrySet()) {
|
|
||||||
urlConnection.setRequestProperty(requestProperty.getKey(), requestProperty.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Write the request body, if there is one.
|
|
||||||
if (data != null) {
|
|
||||||
OutputStream out = urlConnection.getOutputStream();
|
|
||||||
try {
|
|
||||||
out.write(data);
|
|
||||||
} finally {
|
|
||||||
out.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Read and return the response body.
|
|
||||||
InputStream inputStream = urlConnection.getInputStream();
|
|
||||||
try {
|
|
||||||
return toByteArray(inputStream);
|
|
||||||
} finally {
|
|
||||||
inputStream.close();
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
if (urlConnection != null) {
|
|
||||||
urlConnection.disconnect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a sample bit depth to a corresponding PCM encoding constant.
|
* Converts a sample bit depth to a corresponding PCM encoding constant.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user