.. | .. |
---|
371 | 371 | return; |
---|
372 | 372 | } |
---|
373 | 373 | int64_t timestamp = 0; |
---|
374 | | - struct timespec ts; |
---|
375 | | - int res = 0; |
---|
376 | | - res = clock_gettime(CLOCK_MONOTONIC, &ts); |
---|
377 | | - if (res) { |
---|
378 | | - HAL_LOGE("Failed to get BOOTTIME for state delegate: %d (%s)", |
---|
379 | | - errno, |
---|
380 | | - strerror(errno)); |
---|
381 | | - completeRequestWithError(request); |
---|
382 | | - return; |
---|
383 | | - } |
---|
384 | | - timestamp = ts.tv_sec * 1000000000ULL + ts.tv_nsec; |
---|
385 | | - res = request->settings.update(ANDROID_SENSOR_TIMESTAMP, ×tamp, 1); |
---|
386 | | - if (res) { |
---|
387 | | - HAL_LOGE("Failed to update metadata tag 0x%x", ANDROID_SENSOR_TIMESTAMP); |
---|
388 | | - } |
---|
| 374 | +// struct timespec ts; |
---|
| 375 | +// int res = 0; |
---|
| 376 | +// res = clock_gettime(CLOCK_MONOTONIC, &ts); |
---|
| 377 | +// if (res) { |
---|
| 378 | +// HAL_LOGE("Failed to get BOOTTIME for state delegate: %d (%s)", |
---|
| 379 | +// errno, |
---|
| 380 | +// strerror(errno)); |
---|
| 381 | +// completeRequestWithError(request); |
---|
| 382 | +// return; |
---|
| 383 | +// } |
---|
| 384 | + //timestamp = ts.tv_sec * 1000000000ULL + ts.tv_nsec; |
---|
| 385 | + //res = request->settings.update(ANDROID_SENSOR_TIMESTAMP, ×tamp, 1); |
---|
| 386 | + //if (res) { |
---|
| 387 | + // HAL_LOGE("Failed to update metadata tag 0x%x", ANDROID_SENSOR_TIMESTAMP); |
---|
| 388 | + //} |
---|
389 | 389 | |
---|
390 | 390 | // Since |request| has been removed from the tracking, this method |
---|
391 | 391 | // MUST call sendResult (can still return a result in an error state, e.g. |
---|
392 | 392 | // through completeRequestWithError) so the frame doesn't get lost. |
---|
393 | 393 | if (err) { |
---|
394 | | - HAL_LOGE("mId:%d: Error completing request for frame %d.", |
---|
395 | | - mId, request->frame_number); |
---|
396 | | - completeRequestWithError(request); |
---|
397 | | - return; |
---|
| 394 | + switch (err) { |
---|
| 395 | + case 404: |
---|
| 396 | + HAL_LOGI("This is a record complete request!"); |
---|
| 397 | + break; |
---|
| 398 | + default: |
---|
| 399 | + HAL_LOGE("mId:%d: Error completing request for frame %d.", |
---|
| 400 | + mId, request->frame_number); |
---|
| 401 | + completeRequestWithError(request); |
---|
| 402 | + return; |
---|
| 403 | + } |
---|
398 | 404 | } |
---|
399 | 405 | |
---|
400 | | - // Notify the framework with the shutter time (extracted from the result). |
---|
401 | | - // TODO(b/31360070): The general metadata methods should be part of the |
---|
402 | | - // default_camera_hal namespace, not the v4l2_camera_hal namespace. |
---|
403 | | - res = v4l2_camera_hal::SingleTagValue( |
---|
404 | | - request->settings, ANDROID_SENSOR_TIMESTAMP, ×tamp); |
---|
| 406 | + if (!err) { |
---|
| 407 | + HAL_LOGI("It's a merge picture!"); |
---|
| 408 | + struct timespec ts; |
---|
| 409 | + int res; |
---|
| 410 | + res = clock_gettime(CLOCK_BOOTTIME, &ts); |
---|
| 411 | + if (res) { |
---|
| 412 | + HAL_LOGE("Failed to get BOOTTIME for state delegate: %d (%s)", |
---|
| 413 | + errno, |
---|
| 414 | + strerror(errno)); |
---|
| 415 | + } |
---|
| 416 | + timestamp = ts.tv_sec * 1000000000ULL + ts.tv_nsec; |
---|
| 417 | + res = request->settings.update(ANDROID_SENSOR_TIMESTAMP, ×tamp, 1); |
---|
| 418 | + if (res) { |
---|
| 419 | + HAL_LOGE("Failed to UpdateMetadata timestamp."); |
---|
| 420 | + } |
---|
| 421 | + } else { |
---|
| 422 | + HAL_LOGI("It's a record!"); |
---|
| 423 | + int res; |
---|
| 424 | + // Notify the framework with the shutter time (extracted from the result). |
---|
| 425 | + // TODO(b/31360070): The general metadata methods should be part of the |
---|
| 426 | + // default_camera_hal namespace, not the v4l2_camera_hal namespace. |
---|
| 427 | + res = v4l2_camera_hal::SingleTagValue( |
---|
| 428 | + request->settings, ANDROID_SENSOR_TIMESTAMP, ×tamp); |
---|
405 | 429 | |
---|
406 | | - if (res) { |
---|
407 | | - HAL_LOGE("mId:%d: Request for frame %d is missing required metadata.", |
---|
408 | | - mId, request->frame_number); |
---|
409 | | - // TODO(b/31653322): Send RESULT error. |
---|
410 | | - // For now sending REQUEST error instead. |
---|
411 | | - // TODO(calvin) fix this one, SingleTagValue error. |
---|
412 | | - // completeRequestWithError(request); |
---|
413 | | - // return; |
---|
| 430 | + if (res) { |
---|
| 431 | + HAL_LOGE("%s:%d: Request for frame %d is missing required metadata.", |
---|
| 432 | + __func__, mId, request->frame_number); |
---|
| 433 | + // TODO(b/31653322): Send RESULT error. |
---|
| 434 | + // For now sending REQUEST error instead. |
---|
| 435 | + // TODO:calvin, fix this one, SingleTagValue error. |
---|
| 436 | + // completeRequestWithError(request); |
---|
| 437 | + // return; |
---|
| 438 | + } |
---|
414 | 439 | } |
---|
415 | 440 | |
---|
| 441 | + |
---|
| 442 | + //// Notify the framework with the shutter time (extracted from the result). |
---|
| 443 | + //// TODO(b/31360070): The general metadata methods should be part of the |
---|
| 444 | + //// default_camera_hal namespace, not the v4l2_camera_hal namespace. |
---|
| 445 | + //res = v4l2_camera_hal::SingleTagValue( |
---|
| 446 | + // request->settings, ANDROID_SENSOR_TIMESTAMP, ×tamp); |
---|
| 447 | + |
---|
| 448 | + //if (res) { |
---|
| 449 | + // HAL_LOGE("mId:%d: Request for frame %d is missing required metadata.", |
---|
| 450 | + // mId, request->frame_number); |
---|
| 451 | + // // TODO(b/31653322): Send RESULT error. |
---|
| 452 | + // // For now sending REQUEST error instead. |
---|
| 453 | + // // TODO(calvin) fix this one, SingleTagValue error. |
---|
| 454 | + // // completeRequestWithError(request); |
---|
| 455 | + // // return; |
---|
| 456 | + //} |
---|
| 457 | + |
---|
416 | 458 | #if DBG_PERFORMANCE |
---|
417 | 459 | if (btimeRequest == 0) { |
---|
418 | 460 | btimeRequest = request->timeRequest; |
---|