Camera2: Correct EXIF GPS timestamp
GPS 'Location' expects timestamps in milliseconds however the camera metadata uses seconds for it. An additional conversion is needed to take care of this mismatch. BUG: 32593275 Change-Id: I636060aac2177ae9818af32d677292f1eb76d97e
This commit is contained in:
@@ -792,7 +792,8 @@ public class CameraMetadataNative implements Parcelable {
|
||||
private Location getGpsLocation() {
|
||||
String processingMethod = get(CaptureResult.JPEG_GPS_PROCESSING_METHOD);
|
||||
double[] coords = get(CaptureResult.JPEG_GPS_COORDINATES);
|
||||
Long timeStamp = get(CaptureResult.JPEG_GPS_TIMESTAMP);
|
||||
// Location expects timestamp in [ms.]
|
||||
Long timeStamp = get(CaptureResult.JPEG_GPS_TIMESTAMP) * 1000;
|
||||
|
||||
if (areValuesAllNull(processingMethod, coords, timeStamp)) {
|
||||
return null;
|
||||
@@ -823,7 +824,8 @@ public class CameraMetadataNative implements Parcelable {
|
||||
|
||||
double[] coords = { l.getLatitude(), l.getLongitude(), l.getAltitude() };
|
||||
String processMethod = translateLocationProviderToProcess(l.getProvider());
|
||||
long timestamp = l.getTime();
|
||||
//JPEG_GPS_TIMESTAMP expects sec. instead of msec.
|
||||
long timestamp = l.getTime() / 1000;
|
||||
|
||||
set(CaptureRequest.JPEG_GPS_TIMESTAMP, timestamp);
|
||||
set(CaptureRequest.JPEG_GPS_COORDINATES, coords);
|
||||
|
||||
Reference in New Issue
Block a user