base::BindOnce(std::move(decode_cb), DecoderStatus::Codes::kFailed));
return;
case DecoderState::kLazyInitializing:
+ if (needs_keyframe_ && !buffer->is_key_frame()) {
+ RequestKeyframe(std::move(decode_cb));
+ return;
+ }
+
TIZEN_MEDIA_LOG(VERBOSE) << "Continue lazy inititalization";
UpdateConfig(&config_, *buffer.get());
HandleDecodingRequest(buffer, std::move(decode_cb));
if (needs_keyframe_) {
if (!buffer->is_key_frame()) {
- if (config_.is_rtc()) {
- if (!keyframe_requested_) {
- TIZEN_MEDIA_LOG(INFO) << "Non keyframe after switching, request one: "
- << buffer->timestamp();
- std::move(decode_cb).Run(DecoderStatus::Codes::kKeyFrameRequired);
- keyframe_requested_ = true;
- } else {
- std::move(decode_cb).Run(DecoderStatus::Codes::kOk);
- }
- return;
- }
-
- TIZEN_MEDIA_LOG(ERROR) << "Non keyframe received when it's required: "
- << buffer->timestamp();
- std::move(decode_cb).Run(DecoderStatus::Codes::kOk);
+ RequestKeyframe(std::move(decode_cb));
return;
}
needs_keyframe_ = false;
needs_keyframe_ = !SkipDecodingUptoKeyframe();
keyframe_requested_ = false;
- decoder_state_ = DecoderState::kLazyInitializeProcess;
+ decoder_state_ = DecoderState::kLazyInitializing;
// Notify this collection is renderable, because it could be blocked by
// resource conflict before suspending this process.
output_surface_manager_->NotifyCollectionCreate(collection_token_);
- InitializeInternal();
}
void TTvdVideoDecoderImpl::ReleaseResources() {
std::move(eos_cb_).Run(DecoderStatus::Codes::kOk);
}
+void TTvdVideoDecoderImpl::RequestKeyframe(VideoDecoder::DecodeCB decode_cb) {
+ if (!config_.is_rtc()) {
+ // Non-RTC pipeline doesn't have any method allowing to request keyframe.
+ // Is such case just wait until we'll reach one.
+ TIZEN_MEDIA_LOG(ERROR) << "Non keyframe received when it's required";
+ std::move(decode_cb).Run(DecoderStatus::Codes::kOk);
+ return;
+ }
+
+ if (!keyframe_requested_) {
+ TIZEN_MEDIA_LOG(INFO) << "Non keyframe after switching, request one";
+ std::move(decode_cb).Run(DecoderStatus::Codes::kKeyFrameRequired);
+ keyframe_requested_ = true;
+ } else {
+ // Keyframe might not be immediate after requesting (or other side might not
+ // support it). Similarly to standard pipeline just wait until there is one.
+ std::move(decode_cb).Run(DecoderStatus::Codes::kOk);
+ }
+}
+
std::ostream& operator<<(std::ostream& o,
TTvdVideoDecoderImpl::DecoderState state) {
switch (state) {