diff --git a/hdf/camera/cameraMg/v1_1/include/hdi_common_v1_1.h b/hdf/camera/cameraMg/v1_1/include/hdi_common_v1_1.h index f6cbcba7..1e59a4ed 100644 --- a/hdf/camera/cameraMg/v1_1/include/hdi_common_v1_1.h +++ b/hdf/camera/cameraMg/v1_1/include/hdi_common_v1_1.h @@ -151,7 +151,7 @@ public: class StreamConsumer { public: void CalculateFps(int64_t timestamp, int32_t streamId); - void ReturnTimeStamp(int64_t *g_timestamp, uint32_t lenght, int64_t timestamp, int32_t width); + void ReturnTimeStamp(int64_t *g_timestamp, int64_t timestamp, enum StreamIntent streamIntent_); OHOS::sptr CreateProducer(std::function callback); OHOS::sptr CreateProducerSeq(std::function callback); void TakeSnapshoe() @@ -186,6 +186,7 @@ public: int64_t intervalTimestamp_ = 0; const int64_t ONESECOND_OF_MICROSECOND_UNIT = 1000000000; int64_t interval_ = ONESECOND_OF_MICROSECOND_UNIT; + enum StreamIntent streamIntent_ = StreamIntent::PREVIEW; }; class DemoCameraDeviceCallback : public ICameraDeviceCallback { diff --git a/hdf/camera/cameraMg/v1_1/src/camera_hdi_uttest_v1_1.cpp b/hdf/camera/cameraMg/v1_1/src/camera_hdi_uttest_v1_1.cpp index 4d3e59b9..ef83189d 100644 --- a/hdf/camera/cameraMg/v1_1/src/camera_hdi_uttest_v1_1.cpp +++ b/hdf/camera/cameraMg/v1_1/src/camera_hdi_uttest_v1_1.cpp @@ -291,6 +291,7 @@ HWTEST_F(CameraHdiTestV1_1, SUB_Driver_Camera_QuickThumbnail_0200, TestSize.Leve cameraTest->streamInfoCapture = std::make_shared(); cameraTest->streamInfoCapture->extendedStreamInfos = {extendedStreamInfo}; cameraTest->DefaultInfosCapture(cameraTest->streamInfoCapture); + consumer2->streamIntent_ = cameraTest->streamInfoCapture->v1_0.intent_; cameraTest->streamInfosV1_1.push_back(*cameraTest->streamInfoCapture); cameraTest->rc = cameraTest->streamOperator_V1_1->CreateStreams_V1_1(cameraTest->streamInfosV1_1); diff --git a/hdf/camera/cameraMg/v1_1/src/hdi_common_v1_1.cpp b/hdf/camera/cameraMg/v1_1/src/hdi_common_v1_1.cpp index fa86b54c..656fcfc5 100644 --- a/hdf/camera/cameraMg/v1_1/src/hdi_common_v1_1.cpp +++ b/hdf/camera/cameraMg/v1_1/src/hdi_common_v1_1.cpp @@ -175,6 +175,7 @@ void Test::DefaultInfosPreview( { DefaultPreview(infos); std::shared_ptr consumer_pre = std::make_shared(); + consumer_pre->streamIntent_ = infos->v1_0.intent_; infos->v1_0.bufferQueue_ = consumer_pre->CreateProducerSeq([this](void* addr, uint32_t size) { DumpImageFile(streamIdPreview, "yuv", addr, size); }); @@ -187,6 +188,7 @@ void Test::DefaultInfosCapture( { DefaultCapture(infos); std::shared_ptr consumer_capture = std::make_shared(); + consumer_capture->streamIntent_ = infos->v1_0.intent_; infos->v1_0.bufferQueue_ = consumer_capture->CreateProducerSeq([this](void* addr, uint32_t size) { DumpImageFile(streamIdCapture, "jpeg", addr, size); }); @@ -377,9 +379,9 @@ void Test::StreamConsumer::CalculateFps(int64_t timestamp, int32_t streamId) timestampCount_++; } -void Test::StreamConsumer::ReturnTimeStamp(int64_t *g_timestamp, uint32_t lenght, int64_t timestamp, int32_t width) +void Test::StreamConsumer::ReturnTimeStamp(int64_t *g_timestamp, int64_t timestamp, enum StreamIntent streamIntent_) { - if (width != 0) { + if (streamIntent_ == StreamIntent::STILL_CAPTURE) { if (g_timestamp[0] == 0) { g_timestamp[0] = timestamp; } else { @@ -426,7 +428,7 @@ OHOS::sptr Test::StreamConsumer::CreateProducer(std::func buffer->GetExtraData()->ExtraGet(OHOS::Camera::streamId, streamId); buffer->GetExtraData()->ExtraGet(OHOS::Camera::captureId, captureId); buffer->GetExtraData()->ExtraGet(OHOS::Camera::dataWidth, width); - ReturnTimeStamp(g_timestamp, sizeof(g_timestamp) / sizeof(g_timestamp[0]), timestamp, width); + ReturnTimeStamp(g_timestamp, timestamp, this->streamIntent_); if (gotSize) { CalculateFps(timestamp, streamId); callback_(addr, gotSize);