.. | .. |
---|
57 | 57 | |
---|
58 | 58 | V4L2Camera* V4L2Camera::NewV4L2Camera( |
---|
59 | 59 | int id, |
---|
60 | | - std::shared_ptr<CCameraConfig> pCameraCfg) { |
---|
| 60 | + std::shared_ptr<CCameraConfig> pCameraCfg, |
---|
| 61 | + bool mergeStreamStatus) { |
---|
61 | 62 | HAL_LOG_ENTER(); |
---|
62 | 63 | // Select one stream for fill metadata. |
---|
63 | 64 | // The path has been pick the stream for query format. |
---|
.. | .. |
---|
80 | 81 | return new V4L2Camera(id, |
---|
81 | 82 | std::move(v4l2_wrapper), |
---|
82 | 83 | std::move(metadata), |
---|
83 | | - std::move(pCameraCfg)); |
---|
| 84 | + std::move(pCameraCfg), |
---|
| 85 | + mergeStreamStatus); |
---|
84 | 86 | } |
---|
85 | 87 | |
---|
86 | 88 | V4L2Camera::V4L2Camera(int id, |
---|
87 | 89 | std::shared_ptr<V4L2Wrapper> v4l2_wrapper, |
---|
88 | 90 | std::unique_ptr<Metadata> metadata, |
---|
89 | | - std::shared_ptr<CCameraConfig> pCameraCfg) |
---|
| 91 | + std::shared_ptr<CCameraConfig> pCameraCfg, |
---|
| 92 | + bool mergeStreamStatus) |
---|
90 | 93 | : default_camera_hal::Camera(id), |
---|
91 | 94 | mCameraConfig(std::move(pCameraCfg)), |
---|
92 | 95 | device_(std::move(v4l2_wrapper)), |
---|
.. | .. |
---|
101 | 104 | FlashStatusFlag(0), |
---|
102 | 105 | MarkFrameNum(0), |
---|
103 | 106 | curFlashStateE(CAM_FLASH_STATE_MAX), |
---|
104 | | - curFlashModeE(CAM_FLASH_MODE_MAX) { |
---|
| 107 | + curFlashModeE(CAM_FLASH_MODE_MAX), |
---|
| 108 | + merge_stream_status_(mergeStreamStatus), |
---|
| 109 | + is_merge_stream_flag(false){ |
---|
105 | 110 | |
---|
106 | 111 | HAL_LOG_ENTER(); |
---|
107 | 112 | instance = std::shared_ptr<V4L2Camera>(this); |
---|
.. | .. |
---|
1224 | 1229 | return true; |
---|
1225 | 1230 | } |
---|
1226 | 1231 | |
---|
1227 | | -int V4L2Camera::sResultCallback(uint32_t frameNumber, struct timeval /*ts*/) { |
---|
| 1232 | +int V4L2Camera::sResultCallback(uint32_t frameNumber, struct timeval ts) { |
---|
1228 | 1233 | std::unique_lock<std::mutex> lock(frameNumber_request_lock_); |
---|
1229 | 1234 | int res = 0; |
---|
1230 | 1235 | int ret = 0; |
---|
.. | .. |
---|
1272 | 1277 | HAL_LOGE("Failed to update metadata tag 0x%x", |
---|
1273 | 1278 | ANDROID_JPEG_THUMBNAIL_SIZE); |
---|
1274 | 1279 | } |
---|
| 1280 | + } |
---|
| 1281 | + |
---|
| 1282 | + if(!is_merge_stream_flag) |
---|
| 1283 | + { |
---|
| 1284 | + int64_t timestamp = 0; |
---|
| 1285 | + timestamp = ts.tv_sec * 1000000000ULL + ts.tv_usec*1000; |
---|
| 1286 | + ret = (&map_entry->second->settings)->update(ANDROID_SENSOR_TIMESTAMP, ×tamp, 1); |
---|
| 1287 | + if (ret) { |
---|
| 1288 | + HAL_LOGE("Failed to update metadata tag 0x%x", ANDROID_SENSOR_TIMESTAMP); |
---|
| 1289 | + } |
---|
| 1290 | + res = 404; |
---|
1275 | 1291 | } |
---|
1276 | 1292 | |
---|
1277 | 1293 | if (mCameraConfig->supportFlashMode()) { |
---|
.. | .. |
---|
1533 | 1549 | while (!wfequest_queue_stream_.empty()) { |
---|
1534 | 1550 | if (rfequest_queue_stream_.front()->frame_number == |
---|
1535 | 1551 | wfequest_queue_stream_.front()->frame_number) { |
---|
| 1552 | + |
---|
| 1553 | + if (!is_merge_stream_flag) { |
---|
| 1554 | + int64_t timestamp_w = 0; |
---|
| 1555 | + timestamp_w = ts.tv_sec * 1000000000ULL + ts.tv_usec*1000; |
---|
| 1556 | + ret = (&map_entry->second->settings)->update( |
---|
| 1557 | + ANDROID_SENSOR_TIMESTAMP, ×tamp_w, 1); |
---|
| 1558 | + if (ret) { |
---|
| 1559 | + HAL_LOGE("Failed to update metadata tag 0x%x", |
---|
| 1560 | + ANDROID_SENSOR_TIMESTAMP); |
---|
| 1561 | + } |
---|
| 1562 | + res = 404; |
---|
| 1563 | + } |
---|
| 1564 | + |
---|
1536 | 1565 | completeRequest(wfequest_queue_stream_.front(), res); |
---|
1537 | 1566 | wfequest_queue_stream_.pop(); |
---|
1538 | 1567 | rfequest_queue_stream_.pop(); |
---|
.. | .. |
---|
1638 | 1667 | stream_config->streams[retIndex]->height, |
---|
1639 | 1668 | stream_config->streams[retIndex]->format, |
---|
1640 | 1669 | stream_config->streams[retIndex]->usage, |
---|
1641 | | - isBlob)); |
---|
| 1670 | + isBlob, |
---|
| 1671 | + merge_stream_status_)); |
---|
1642 | 1672 | if (nullptr == stream_config->streams[retIndex]->priv) { |
---|
1643 | 1673 | HAL_LOGE("Failed create main stream!"); |
---|
1644 | 1674 | return -EINVAL; |
---|
.. | .. |
---|
1676 | 1706 | stream_config->streams[retIndex]->height, |
---|
1677 | 1707 | stream_config->streams[retIndex]->format, |
---|
1678 | 1708 | stream_config->streams[retIndex]->usage, |
---|
1679 | | - isBlob)); |
---|
| 1709 | + isBlob, |
---|
| 1710 | + merge_stream_status_)); |
---|
1680 | 1711 | if (nullptr == stream_config->streams[retIndex]->priv) { |
---|
1681 | 1712 | HAL_LOGE("Failed create sub stream!"); |
---|
1682 | 1713 | return -EINVAL; |
---|
.. | .. |
---|
1731 | 1762 | stream_config->streams[thirdIndex]->height, |
---|
1732 | 1763 | stream_config->streams[thirdIndex]->format, |
---|
1733 | 1764 | stream_config->streams[thirdIndex]->usage, |
---|
1734 | | - isBlob)); |
---|
| 1765 | + isBlob, |
---|
| 1766 | + merge_stream_status_)); |
---|
1735 | 1767 | |
---|
1736 | 1768 | if (nullptr == stream_config->streams[thirdIndex]->priv) { |
---|
1737 | 1769 | HAL_LOGE("Failed create third stream!"); |
---|
.. | .. |
---|
1772 | 1804 | stream_config->streams[thirdIndex]->height, |
---|
1773 | 1805 | stream_config->streams[thirdIndex]->format, |
---|
1774 | 1806 | stream_config->streams[thirdIndex]->usage, |
---|
1775 | | - isBlob)); |
---|
| 1807 | + isBlob, |
---|
| 1808 | + merge_stream_status_)); |
---|
1776 | 1809 | |
---|
1777 | 1810 | camera3_stream_t* subIndexStream = stream_config->streams[subIndex]; |
---|
1778 | 1811 | camera3_stream_t* thirdIndexStream = stream_config->streams[thirdIndex]; |
---|
.. | .. |
---|
1829 | 1862 | for (uint32_t i = 0; i < stream_config->num_streams; ++i) { |
---|
1830 | 1863 | fillStreamInfo(stream_config->streams[i]); |
---|
1831 | 1864 | } |
---|
| 1865 | + is_merge_stream_flag = false; |
---|
1832 | 1866 | for (uint32_t i = 0; i < stream_config->num_streams; ++i) { |
---|
1833 | 1867 | HAL_LOGD("stream %d is format %d(%s), width %d, height %d, " |
---|
1834 | 1868 | "usage %d(%s), stream_type %d, data_space %d, num_streams:%d.", |
---|
.. | .. |
---|
1842 | 1876 | stream_config->streams[i]->stream_type, |
---|
1843 | 1877 | stream_config->streams[i]->data_space, |
---|
1844 | 1878 | stream_config->num_streams); |
---|
| 1879 | + if(stream_config->streams[i]->width * stream_config->streams[i]->height > |
---|
| 1880 | + 4000*3000) { |
---|
| 1881 | + is_merge_stream_flag = true; |
---|
| 1882 | + } |
---|
1845 | 1883 | } |
---|
1846 | 1884 | |
---|
1847 | 1885 | HAL_LOGI("setupStreams finished"); |
---|