client_ = std::move(client);
CAMERA_CHECK_AND_RETURN(ConfigureCamera());
- CAMERA_CHECK_AND_RETURN(StartCameraPreview());
- TIZEN_MEDIA_LOG(INFO) << "Camera started";
-
- if (IsEncodedCameraFormat(camera_format_) && !PrepareVideoDecoder()) {
+ if (!IsEncodedCameraFormat(camera_format_)) {
+ // For non-encoded formats, start camera preview immediately.
+ // For encoded formats, start camera preview after decoder completes
+ // initialization.
+ CAMERA_CHECK_AND_RETURN(StartCameraPreview());
+ } else if (!PrepareVideoDecoder()) {
client_->OnError(VideoCaptureError::kV4L2VidiocStreamonFailed, FROM_HERE,
"Wrong video codec, cannot initialize decoder");
return;
"Cannot set preview cb"};
}
+ TIZEN_MEDIA_LOG(INFO) << "Camera configured";
+
return {VideoCaptureError::kNone, ""};
}
"Cannot start preview"};
}
+ TIZEN_MEDIA_LOG(INFO) << "Camera started";
+
return {VideoCaptureError::kNone, ""};
}
if (success) {
TIZEN_MEDIA_LOG(INFO) << "Decoder initialized successfully";
decoder_state_ = DecoderState::kInitialized;
+ CAMERA_CHECK_AND_RETURN(StartCameraPreview());
} else {
TIZEN_MEDIA_LOG(ERROR) << "Decoder error during initialization";
decoder_state_ = DecoderState::kError;
decoder_ = nullptr;
+ client_->OnError(VideoCaptureError::kV4L2VidiocStreamonFailed, FROM_HERE,
+ "Decoder initialization failed");
}
}
const bool was_suspended = last_state_ == suspend_resume::State::SUSPENDED;
const bool is_suspended = new_state == suspend_resume::State::SUSPENDED;
- if (was_suspended && !is_suspended) {
- CAMERA_CHECK_AND_RETURN(StartCameraPreview());
- } else if (!was_suspended && is_suspended) {
+ if (!was_suspended && is_suspended) {
CAMERA_CHECK_AND_RETURN(StopCameraPreview());
decoder_state_ = DecoderState::kIdle;
decoder_.reset();
last_state_ = new_state;
if (!IsEncodedCameraFormat(camera_format_)) {
+ if (was_suspended && !is_suspended) {
+ // For non-encoded formats, start camera preview immediately.
+ // For encoded formats, start camera preview after decoder completes
+ // initialization.
+ CAMERA_CHECK_AND_RETURN(StartCameraPreview());
+ }
return;
}