修改方法如下:
vendor/mediatek/proprietary/packages/apps/Camera2/common/src/com/mediatek/camera/common/utils/BitmapCreator.java
- bitmap = retriever.getframeAtTime(-1); + bitmap = retriever.getframeAtTime(0);
getframeAtTime 这个方法的参数代表啥意思?
public @Nullable Bitmap getframeAtTime(long timeUs, @Option int option) {
if (option < OPTION_PREVIOUS_SYNC ||
option > OPTION_CLOSEST) {
throw new IllegalArgumentException("Unsupported option: " + option);
}
return _getframeAtTime(timeUs, option, -1 , -1 , null);
}
@param timeUs The time position where the frame will be retrieved. When retrieving the frame at the given time position, there is no guarantee that the data source has a frame located at the position. When this happens, a frame nearby will be returned. If timeUs is negative, time position and option will ignored, and any frame that the implementation considers as representative may be returned.
从上面这段注释中可以看出,如果 timeUs 参数是负数,time position 和 option 参数会被忽略,可能返回可以代表这个视频的任何帧
如果 timeUs 是非负数,就优先返回 timeUs 所在帧,如果找不到就找附近的帧。



