mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Don't log removed encoders
We shouldn't have this logging unless we really need it to debug a specific problem, as it can be noisy (even at debug level). PiperOrigin-RevId: 512904412
This commit is contained in:
parent
581eda5906
commit
cccc582595
1 changed files with 4 additions and 25 deletions
|
|
@ -34,7 +34,6 @@ import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.ColorInfo;
|
import androidx.media3.common.ColorInfo;
|
||||||
import androidx.media3.common.Format;
|
import androidx.media3.common.Format;
|
||||||
import androidx.media3.common.MimeTypes;
|
import androidx.media3.common.MimeTypes;
|
||||||
import androidx.media3.common.util.Log;
|
|
||||||
import androidx.media3.common.util.UnstableApi;
|
import androidx.media3.common.util.UnstableApi;
|
||||||
import androidx.media3.common.util.Util;
|
import androidx.media3.common.util.Util;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
@ -463,8 +462,7 @@ public final class DefaultEncoderFactory implements Codec.EncoderFactory {
|
||||||
return abs(
|
return abs(
|
||||||
requestedWidth * requestedHeight
|
requestedWidth * requestedHeight
|
||||||
- closestSupportedResolution.getWidth() * closestSupportedResolution.getHeight());
|
- closestSupportedResolution.getWidth() * closestSupportedResolution.getHeight());
|
||||||
},
|
});
|
||||||
/* filterName= */ "resolution");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns a list of encoders that support the requested bitrate most closely. */
|
/** Returns a list of encoders that support the requested bitrate most closely. */
|
||||||
|
|
@ -476,8 +474,7 @@ public final class DefaultEncoderFactory implements Codec.EncoderFactory {
|
||||||
int achievableBitrate =
|
int achievableBitrate =
|
||||||
EncoderUtil.getSupportedBitrateRange(encoderInfo, mimeType).clamp(requestedBitrate);
|
EncoderUtil.getSupportedBitrateRange(encoderInfo, mimeType).clamp(requestedBitrate);
|
||||||
return abs(achievableBitrate - requestedBitrate);
|
return abs(achievableBitrate - requestedBitrate);
|
||||||
},
|
});
|
||||||
/* filterName= */ "bitrate");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns a list of encoders that support the requested bitrate mode. */
|
/** Returns a list of encoders that support the requested bitrate mode. */
|
||||||
|
|
@ -488,8 +485,7 @@ public final class DefaultEncoderFactory implements Codec.EncoderFactory {
|
||||||
/* cost= */ (encoderInfo) ->
|
/* cost= */ (encoderInfo) ->
|
||||||
EncoderUtil.isBitrateModeSupported(encoderInfo, mimeType, requestedBitrateMode)
|
EncoderUtil.isBitrateModeSupported(encoderInfo, mimeType, requestedBitrateMode)
|
||||||
? 0
|
? 0
|
||||||
: Integer.MAX_VALUE, // Drops encoder.
|
: Integer.MAX_VALUE); // Drops encoder.
|
||||||
/* filterName= */ "bitrate mode");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class VideoEncoderQueryResult {
|
private static final class VideoEncoderQueryResult {
|
||||||
|
|
@ -610,7 +606,7 @@ public final class DefaultEncoderFactory implements Codec.EncoderFactory {
|
||||||
* costs of all encoders are {@link Integer#MAX_VALUE}.
|
* costs of all encoders are {@link Integer#MAX_VALUE}.
|
||||||
*/
|
*/
|
||||||
private static ImmutableList<MediaCodecInfo> filterEncoders(
|
private static ImmutableList<MediaCodecInfo> filterEncoders(
|
||||||
List<MediaCodecInfo> encoders, EncoderFallbackCost cost, String filterName) {
|
List<MediaCodecInfo> encoders, EncoderFallbackCost cost) {
|
||||||
List<MediaCodecInfo> filteredEncoders = new ArrayList<>(encoders.size());
|
List<MediaCodecInfo> filteredEncoders = new ArrayList<>(encoders.size());
|
||||||
|
|
||||||
int minGap = Integer.MAX_VALUE;
|
int minGap = Integer.MAX_VALUE;
|
||||||
|
|
@ -630,10 +626,6 @@ public final class DefaultEncoderFactory implements Codec.EncoderFactory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filteredEncoders.size() != encoders.size()) {
|
|
||||||
logRemovedEncoders(encoders, filteredEncoders, filterName);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ImmutableList.copyOf(filteredEncoders);
|
return ImmutableList.copyOf(filteredEncoders);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -666,17 +658,4 @@ public final class DefaultEncoderFactory implements Codec.EncoderFactory {
|
||||||
/* isDecoder= */ false,
|
/* isDecoder= */ false,
|
||||||
format);
|
format);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void logRemovedEncoders(
|
|
||||||
List<MediaCodecInfo> encoders, List<MediaCodecInfo> filteredEncoders, String filterName) {
|
|
||||||
List<MediaCodecInfo> removedEncoders = new ArrayList<>(encoders);
|
|
||||||
removedEncoders.removeAll(filteredEncoders);
|
|
||||||
StringBuilder stringBuilder =
|
|
||||||
new StringBuilder("Encoders removed for ").append(filterName).append(":\n");
|
|
||||||
for (int i = 0; i < removedEncoders.size(); i++) {
|
|
||||||
MediaCodecInfo encoderInfo = removedEncoders.get(i);
|
|
||||||
stringBuilder.append(Util.formatInvariant(" %s\n", encoderInfo.getName()));
|
|
||||||
}
|
|
||||||
Log.d(TAG, stringBuilder.toString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue