virtual bool IsLowLatencyMode() const = 0;
virtual bool IsVideoTextureMode() const = 0;
virtual void OnLoadDeferredUntilSourceOpen() = 0;
+ virtual void SetIsAudioDecodedByPlatform(bool is_decoded_by_platform) = 0;
+ virtual void SetIsVideoDecodedByPlatform(bool is_decoded_by_platform) = 0;
absl::optional<content::elementary_media_stream_source::PipelineMode>
GetEmssPipelineMode() const;
#endif // defined(SAMSUNG_ELEMENTARY_MEDIA_STREAM_SOURCE)
media_source_attachment_->OnPlay(media_source_tracer_);
}
}
+
+void HTMLMediaElement::SetIsAudioDecodedByPlatform(
+ bool is_decoded_by_platform) {
+ if (!media_source_attachment_ ||
+ !media_source_attachment_->IsElementaryMediaStreamSource()) {
+ return;
+ }
+
+ media_source_attachment_->SetIsAudioDecodedByPlatform(media_source_tracer_,
+ is_decoded_by_platform);
+}
+
+void HTMLMediaElement::SetIsVideoDecodedByPlatform(
+ bool is_decoded_by_platform) {
+ if (!media_source_attachment_ ||
+ !media_source_attachment_->IsElementaryMediaStreamSource()) {
+ return;
+ }
+
+ media_source_attachment_->SetIsVideoDecodedByPlatform(media_source_tracer_,
+ is_decoded_by_platform);
+}
#endif
bool HTMLMediaElement::IsCanPlayControlledByEmss() const {
web_elementary_stream_source_dispatcher) final;
void OnLoadDeferredUntilSourceOpen() final;
void FireDeferredLoadAfterSourceOpen();
+ void SetIsAudioDecodedByPlatform(bool is_decoded_by_platform) final;
+ void SetIsVideoDecodedByPlatform(bool is_decoded_by_platform) final;
#endif
// Default implementation of upstream architecture in low latency mode fires
virtual void OnPlay(MediaSourceTracer* tracer) = 0;
virtual void OnResume(MediaSourceTracer* tracer) = 0;
virtual void OnSuspend(MediaSourceTracer* tracer) = 0;
+ virtual void SetIsAudioDecodedByPlatform(MediaSourceTracer* tracer,
+ bool is_decoded_by_platform) = 0;
+ virtual void SetIsVideoDecodedByPlatform(MediaSourceTracer* tracer,
+ bool is_decoded_by_platform) = 0;
// OnElementTimeUpdate() executes with media element's timeupdate timer and
// during some key operations (like seeking). As opposed to that,
// UpdatePlaybackPosition() notifies EMSS as soon as official playback
void MediaSourceAttachmentSupplement::OnSuspend(MediaSourceTracer*) {}
+void MediaSourceAttachmentSupplement::SetIsAudioDecodedByPlatform(
+ MediaSourceTracer*,
+ bool) {}
+
+void MediaSourceAttachmentSupplement::SetIsVideoDecodedByPlatform(
+ MediaSourceTracer*,
+ bool) {}
+
void MediaSourceAttachmentSupplement::UpdatePlaybackPosition(
MediaSourceTracer*,
double,
void OnPlay(MediaSourceTracer* tracer) override;
void OnResume(MediaSourceTracer* tracer) override;
void OnSuspend(MediaSourceTracer* tracer) override;
+ void SetIsAudioDecodedByPlatform(MediaSourceTracer* tracer,
+ bool is_decoded_by_platform) override;
+ void SetIsVideoDecodedByPlatform(MediaSourceTracer* tracer,
+ bool is_decoded_by_platform) override;
void UpdatePlaybackPosition(MediaSourceTracer* tracer,
double playback_position,
std::optional<uint32_t> session_id) override;
audio_decoder_type_ = info.decoder_type;
+#if defined(SAMSUNG_ELEMENTARY_MEDIA_STREAM_SOURCE)
+ if (client_) {
+ client_->SetIsVideoDecodedByPlatform(info.is_platform_decoder);
+ }
+#endif // defined(SAMSUNG_ELEMENTARY_MEDIA_STREAM_SOURCE)
+
// If there's no current reporter, there's nothing to be done.
if (!watch_time_reporter_)
return;
video_decoder_type_ = info.decoder_type;
+#if defined(SAMSUNG_ELEMENTARY_MEDIA_STREAM_SOURCE)
+ if (client_) {
+ client_->SetIsVideoDecodedByPlatform(info.is_platform_decoder);
+ }
+#endif // defined(SAMSUNG_ELEMENTARY_MEDIA_STREAM_SOURCE)
+
// If there's no current reporter, there's nothing to be done.
if (!watch_time_reporter_)
return;
virtual void OnTrackFinishedSeek(uint32_t session_id,
base::TimeDelta time_after_seek) = 0;
+ virtual void SetIsDecodedByPlatform(bool is_decoded_by_platform) = 0;
virtual void SetTrackClosing(uint32_t session_id,
base::OnceCallback<void(CallbackResult)> cb) = 0;
virtual void TrackEOSAppended(uint32_t session_id) = 0;
}
}
+void TrackImpl::SetIsDecodedByPlatform(bool is_decoded_by_platform) {
+ EMSS_DEBUG_TYPED() << is_decoded_by_platform;
+
+ if (!control_client_) {
+ return;
+ }
+
+ control_client_->SetIsDecodedByPlatform(is_decoded_by_platform);
+}
+
void TrackImpl::SetTrackClosing(uint32_t session_id,
base::OnceCallback<void(CallbackResult)> cb) {
EMSS_DEBUG_TYPED();
// TrackDispatcherClient
void OnTrackFinishedSeek(uint32_t session_id,
base::TimeDelta time_after_seek) override;
+ void SetIsDecodedByPlatform(bool is_decoded_by_platform) override;
void SetTrackClosing(uint32_t session_id,
base::OnceCallback<void(CallbackResult)> cb) override;
void TrackEOSAppended(uint32_t session_id) override;
virtual bool IsReadRequested() const = 0;
virtual void ReadMediaPacket() = 0;
+ virtual void SetIsDecodedByPlatform(bool is_decoded_by_platform) = 0;
protected:
AppendClient() = default;
#include "content/renderer/media/tizen/elementary_media_stream_source/common/common.h"
#include "content/renderer/media/tizen/elementary_media_stream_source/common/logger.h"
#include "content/renderer/media/tizen/elementary_media_stream_source/control_thread/demuxer_dispatcher_client.h"
+#include "content/renderer/media/tizen/elementary_media_stream_source/worker_thread/append_client.h"
#include "content/renderer/media/tizen/elementary_media_stream_source/worker_thread/demuxer_client.h"
#include "media/base/audio_buffer.h"
#include "media/base/audio_decoder.h"
if constexpr (StreamType == TrackType::kVideo) {
process_output_cb_ = parent_->GetBufferProcessorForDecoder(*decoder_);
}
+ parent_->SetIsDecodedByPlatform(StreamType, decoder_->IsPlatformDecoder());
+
TryProcessPendingDecodes();
}
}
}
-void MsDecodingStream::SetAppendClient(TrackType,
- std::shared_ptr<AppendClient>) {
+void MsDecodingStream::SetAppendClient(TrackType track_type,
+ std::shared_ptr<AppendClient> client) {
EMSS_DEBUG();
+
+ append_clients_[+track_type] = client;
}
//////////////////// DemuxerDispatcherClient: ////////////////////
std::move(control_task_runner)));
}
+void MsDecodingStream::SetIsDecodedByPlatform(TrackType track_type,
+ bool is_decoded_by_platform) {
+ EMSS_VERBOSE();
+
+ auto append_client = append_clients_[+track_type].lock();
+
+ if (!append_client) {
+ return;
+ }
+
+ append_client->SetIsDecodedByPlatform(is_decoded_by_platform);
+}
+
MsDecodingStream::ProcessVideoOutputCb
MsDecodingStream::GetBufferProcessorForDecoder(
const media::VideoDecoder& video_decoder) {
void OnNewCreateAudioDecodersPrerequisiteAvailable();
void OnNewCreateVideoDecodersPrerequisiteAvailable();
+ void SetIsDecodedByPlatform(TrackType, bool is_decoded_by_platform);
ProcessVideoOutputCb GetBufferProcessorForDecoder(const media::VideoDecoder&);
void ProcessSoftwareDecodedVideoFrame(
scoped_refptr<media::VideoFrame> frame,
media::GpuVideoAcceleratorFactories* gpu_factories_{nullptr};
std::unique_ptr<media::MediaLog> media_log_;
+ std::array<std::weak_ptr<AppendClient>, (+TrackType::kMaxValue + 1)>
+ append_clients_;
+
base::WeakPtrFactory<MsDecodingStream> weak_ptr_factory_{this};
};
}
}
+void TrackImpl::SetIsDecodedByPlatform(bool is_decoded_by_platform) {
+ EMSS_VERBOSE_TYPED() << is_decoded_by_platform;
+
+ if (auto dispatcher = dispatcher_.lock()) {
+ dispatcher->DispatchTask(
+ &control_thread::TrackDispatcherClient::SetIsDecodedByPlatform,
+ is_decoded_by_platform);
+ }
+}
+
//////////////////// SourceClient ////////////////////
std::shared_ptr<AppendClient> TrackImpl::GetAppendClient() {
// AppendClient
bool IsReadRequested() const override;
void ReadMediaPacket() override;
+ void SetIsDecodedByPlatform(bool is_decoded_by_platform) override;
// SourceClient
std::shared_ptr<AppendClient> GetAppendClient() override;
EMSS_LOG(WARNING) << "not supported in ElementaryMediaStreamSource";
}
+void ElementaryMediaStreamSource::SetIsAudioDecodedByPlatform(
+ bool is_decoded_by_platform) {
+ EMSS_VERBOSE();
+
+ for (const auto& audio_track : audio_tracks_) {
+ audio_track->SetIsDecodedByPlatform(is_decoded_by_platform);
+ }
+}
+
+void ElementaryMediaStreamSource::SetIsVideoDecodedByPlatform(
+ bool is_decoded_by_platform) {
+ EMSS_VERBOSE();
+
+ for (const auto& video_track : video_tracks_) {
+ video_track->SetIsDecodedByPlatform(is_decoded_by_platform);
+ }
+}
+
WebTimeRanges ElementaryMediaStreamSource::SeekableInternal() const {
EMSS_VERBOSE();
void OnResume();
void OnSuspend();
void OnTrackChanged(TrackBase*);
+ void SetIsAudioDecodedByPlatform(bool is_decoded_by_platform);
+ void SetIsVideoDecodedByPlatform(bool is_decoded_by_platform);
WebTimeRanges BufferedInternal() const;
WebTimeRanges SeekableInternal() const;
void UpdatePlaybackPosition(double playback_position,
const AtomicString& ElementaryMediaTrack::activeDecodingMode() const {
EMSS_DEBUG_TYPED();
- // FIXME(p.balut): provide the actually selected mode
return active_decoding_mode_;
}
return video_decoder_config;
}
+void ElementaryMediaTrack::SetIsDecodedByPlatform(bool is_decoded_by_platform) {
+ EMSS_DEBUG() << is_decoded_by_platform;
+
+ active_decoding_mode_ = is_decoded_by_platform
+ ? DecodingModeHardwareKeyword()
+ : DecodingModeSoftwareKeyword();
+}
+
double ElementaryMediaTrack::GetHighestBufferedPresentationTimestamp() const {
EMSS_DEBUG_TYPED();
void OnTrackClosed(
WebElementaryMediaTrackControl::ChangeReason reason) override;
void OnTrackOpen() override;
+ void SetIsDecodedByPlatform(bool is_decoded_by_platform) override;
void Stop() override;
// content::WebElementaryMediaTrackOperations::
DOMExceptionCode ValidateGetPicturePrecondition(WebGLTexture* texture) const;
- const AtomicString active_decoding_mode_;
+ AtomicString active_decoding_mode_;
std::atomic<bool> append_finished_;
std::deque<std::unique_ptr<BoundVideoTexture>> bound_video_frames_
GetSource(tracer)->OnSuspend();
}
+void SameThreadElementaryMediaStreamSourceAttachment::
+ SetIsAudioDecodedByPlatform(MediaSourceTracer* tracer,
+ bool is_decoded_by_platform) {
+ EMSS_DEBUG();
+
+ GetSource(tracer)->SetIsAudioDecodedByPlatform(is_decoded_by_platform);
+}
+
+void SameThreadElementaryMediaStreamSourceAttachment::
+ SetIsVideoDecodedByPlatform(MediaSourceTracer* tracer,
+ bool is_decoded_by_platform) {
+ EMSS_DEBUG();
+
+ GetSource(tracer)->SetIsVideoDecodedByPlatform(is_decoded_by_platform);
+}
+
void SameThreadElementaryMediaStreamSourceAttachment::UpdatePlaybackPosition(
MediaSourceTracer* tracer,
double playback_position,
void OnSuspend(MediaSourceTracer* tracer) override;
+ void SetIsAudioDecodedByPlatform(MediaSourceTracer* tracer,
+ bool is_decoded_by_platform) override;
+
+ void SetIsVideoDecodedByPlatform(MediaSourceTracer* tracer,
+ bool is_decoded_by_platform) override;
+
void UpdatePlaybackPosition(MediaSourceTracer* tracer,
double playback_position,
std::optional<uint32_t> session_id) override;
virtual void OnSessionIdChanged(uint32_t session_id) = 0;
virtual void OnTrackClosed(ChangeReason reason) = 0;
virtual void OnTrackOpen() = 0;
+ virtual void SetIsDecodedByPlatform(bool is_decoded_by_platform) = 0;
virtual void Stop() = 0;
protected: