// IS_STOPPED). Any attempt to invoke Restart() when the source is not in this
// state results in no action and |callback| invoked with INVALID_STATE.
void Restart(const media::VideoCaptureFormat& new_format,
- RestartCallback callback);
+ RestartCallback callback,
+ bool enable_face_detection = false);
// Called by |track| to notify the source whether it has any paths to a
// consuming endpoint.
// must return a value.
virtual absl::optional<media::VideoCaptureFormat> GetCurrentFormat() const;
+ virtual absl::optional<media::VideoCaptureParams> GetCurrentParams() const;
+
// Returns true if encoded output can be enabled in the source.
virtual bool SupportsEncodedOutput() const;
// Note that if this method is overridden, StopSourceForRestartImpl() must
// also be overridden following the respective contract. Otherwise, behavior
// is undefined.
- virtual void RestartSourceImpl(const media::VideoCaptureFormat& new_format);
+ virtual void RestartSourceImpl(const media::VideoCaptureFormat& new_format,
+ bool enable_face_detection);
// This method should be called by implementations once an attempt to restart
// the source completes. |did_restart| must be true if the source is running
return;
}
- if (video_source_->GetCurrentFormat() == settings.Format()) {
+#if BUILDFLAG(IS_TIZEN_TV)
+ const auto current_params = video_source_->GetCurrentParams();
+ const bool restart_for_face_detection =
+ current_params && current_params->enable_face_detection !=
+ settings.capture_params().enable_face_detection;
+#else
+ const bool restart_for_face_detection = false;
+#endif // BUILDFLAG(IS_TIZEN_TV)
+
+ if (video_source_->GetCurrentFormat() == settings.Format() &&
+ !restart_for_face_detection) {
video_source_->ReconfigureTrack(GetCurrentVideoTrack(),
settings.track_adapter_settings(),
settings.capture_params().ai_zoom_settings);
settings.HasValue() ? settings.Format()
: *video_source_->GetCurrentFormat(),
WTF::BindOnce(&ApplyConstraintsProcessor::MaybeSourceRestarted,
- WrapWeakPersistent(this)));
+ WrapWeakPersistent(this)),
+ settings.HasValue() ? settings.capture_params().enable_face_detection
+ : false);
}
void ApplyConstraintsProcessor::MaybeSourceRestarted(
}
void MediaStreamVideoCapturerSource::RestartSourceImpl(
- const media::VideoCaptureFormat& new_format) {
+ const media::VideoCaptureFormat& new_format,
+ bool enable_face_detection) {
DCHECK(new_format.IsValid());
media::VideoCaptureParams new_capture_params = capture_params_;
new_capture_params.requested_format = new_format;
+ new_capture_params.enable_face_detection = enable_face_detection;
#if defined(TIZEN_MULTIMEDIA)
new_capture_params.lazy_start = false;
#endif
return capture_params_.requested_format;
}
+absl::optional<media::VideoCaptureParams>
+MediaStreamVideoCapturerSource::GetCurrentParams() const {
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
+ return capture_params_;
+}
+
void MediaStreamVideoCapturerSource::ChangeSourceImpl(
const MediaStreamDevice& new_device) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
media::VideoCaptureFeedbackCB GetFeedbackCallback() const override;
void StopSourceImpl() override;
void StopSourceForRestartImpl() override;
- void RestartSourceImpl(const media::VideoCaptureFormat& new_format) override;
+ void RestartSourceImpl(const media::VideoCaptureFormat& new_format,
+ bool enable_face_detection) override;
absl::optional<media::VideoCaptureFormat> GetCurrentFormat() const override;
+ absl::optional<media::VideoCaptureParams> GetCurrentParams() const override;
void ChangeSourceImpl(const MediaStreamDevice& new_device) override;
#if !BUILDFLAG(IS_ANDROID)
void Crop(const base::Token& crop_id,
void MediaStreamVideoSource::Restart(
const media::VideoCaptureFormat& new_format,
- RestartCallback callback) {
+ RestartCallback callback,
+ bool enable_face_detection) {
DCHECK(GetTaskRunner()->BelongsToCurrentThread());
if (state_ != STOPPED_FOR_RESTART) {
GetTaskRunner()->PostTask(
DCHECK(!restart_callback_);
state_ = RESTARTING;
restart_callback_ = std::move(callback);
- RestartSourceImpl(new_format);
+ RestartSourceImpl(new_format, enable_face_detection);
}
void MediaStreamVideoSource::RestartSourceImpl(
- const media::VideoCaptureFormat& new_format) {
+ const media::VideoCaptureFormat& new_format,
+ bool /* enable_face_detection */) {
NOTREACHED();
}
return absl::optional<media::VideoCaptureFormat>();
}
+absl::optional<media::VideoCaptureParams>
+MediaStreamVideoSource::GetCurrentParams() const {
+ DCHECK(GetTaskRunner()->BelongsToCurrentThread());
+ return absl::nullopt;
+}
+
size_t MediaStreamVideoSource::CountEncodedSinks() const {
return std::accumulate(tracks_.begin(), tracks_.end(), size_t(0),
[](size_t accum, MediaStreamVideoTrack* track) {
}
void MockMediaStreamVideoSource::RestartSourceImpl(
- const media::VideoCaptureFormat& new_format) {
+ const media::VideoCaptureFormat& new_format,
+ bool /* enable_face_detection */) {
DCHECK(is_stopped_for_restart_);
if (!can_restart_) {
OnRestartDone(false);
void StopSourceImpl() override;
absl::optional<media::VideoCaptureFormat> GetCurrentFormat() const override;
void StopSourceForRestartImpl() override;
- void RestartSourceImpl(const media::VideoCaptureFormat& new_format) override;
+ void RestartSourceImpl(const media::VideoCaptureFormat& new_format,
+ bool enable_face_detection) override;
private:
media::VideoCaptureFormat format_;