mirror of
https://github.com/samsonjs/media.git
synced 2026-03-31 10:25:48 +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.Format;
|
||||
import androidx.media3.common.MimeTypes;
|
||||
import androidx.media3.common.util.Log;
|
||||
import androidx.media3.common.util.UnstableApi;
|
||||
import androidx.media3.common.util.Util;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
|
@ -463,8 +462,7 @@ public final class DefaultEncoderFactory implements Codec.EncoderFactory {
|
|||
return abs(
|
||||
requestedWidth * requestedHeight
|
||||
- closestSupportedResolution.getWidth() * closestSupportedResolution.getHeight());
|
||||
},
|
||||
/* filterName= */ "resolution");
|
||||
});
|
||||
}
|
||||
|
||||
/** 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 =
|
||||
EncoderUtil.getSupportedBitrateRange(encoderInfo, mimeType).clamp(requestedBitrate);
|
||||
return abs(achievableBitrate - requestedBitrate);
|
||||
},
|
||||
/* filterName= */ "bitrate");
|
||||
});
|
||||
}
|
||||
|
||||
/** Returns a list of encoders that support the requested bitrate mode. */
|
||||
|
|
@ -488,8 +485,7 @@ public final class DefaultEncoderFactory implements Codec.EncoderFactory {
|
|||
/* cost= */ (encoderInfo) ->
|
||||
EncoderUtil.isBitrateModeSupported(encoderInfo, mimeType, requestedBitrateMode)
|
||||
? 0
|
||||
: Integer.MAX_VALUE, // Drops encoder.
|
||||
/* filterName= */ "bitrate mode");
|
||||
: Integer.MAX_VALUE); // Drops encoder.
|
||||
}
|
||||
|
||||
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}.
|
||||
*/
|
||||
private static ImmutableList<MediaCodecInfo> filterEncoders(
|
||||
List<MediaCodecInfo> encoders, EncoderFallbackCost cost, String filterName) {
|
||||
List<MediaCodecInfo> encoders, EncoderFallbackCost cost) {
|
||||
List<MediaCodecInfo> filteredEncoders = new ArrayList<>(encoders.size());
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
@ -666,17 +658,4 @@ public final class DefaultEncoderFactory implements Codec.EncoderFactory {
|
|||
/* isDecoder= */ false,
|
||||
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