#include "third_party/blink/renderer/modules/mediasource/cross_thread_media_source_attachment.h"
#include "base/feature_list.h"
#include "base/memory/scoped_refptr.h"
#include "base/types/pass_key.h"
#include "third_party/blink/public/common/messaging/message_port_channel.h"
#include "third_party/blink/renderer/core/html/media/html_media_element.h"
#include "third_party/blink/renderer/modules/mediasource/attachment_creation_pass_key_provider.h"
#include "third_party/blink/renderer/modules/mediasource/media_source.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_copier_base.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_copier_public.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_copier_std.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"
namespace blink {
namespace {
std::ostream& operator<<(
std::ostream& stream,
CrossThreadMediaSourceAttachment::TrackAddRemovalType track_type) { … }
}
CrossThreadMediaSourceAttachment::CrossThreadMediaSourceAttachment(
MediaSource* media_source,
AttachmentCreationPassKeyProvider::PassKey )
: … { … }
CrossThreadMediaSourceAttachment::~CrossThreadMediaSourceAttachment() { … }
void CrossThreadMediaSourceAttachment::NotifyDurationChanged(
MediaSourceTracer* ,
double new_duration) { … }
base::TimeDelta CrossThreadMediaSourceAttachment::GetRecentMediaTime(
MediaSourceTracer* ) { … }
bool CrossThreadMediaSourceAttachment::GetElementError(
MediaSourceTracer* ) { … }
AudioTrackList* CrossThreadMediaSourceAttachment::CreateAudioTrackList(
MediaSourceTracer* ) { … }
VideoTrackList* CrossThreadMediaSourceAttachment::CreateVideoTrackList(
MediaSourceTracer* ) { … }
void CrossThreadMediaSourceAttachment::AddAudioTrackToMediaElement(
MediaSourceTracer* ,
AudioTrack* ) { … }
void CrossThreadMediaSourceAttachment::AddVideoTrackToMediaElement(
MediaSourceTracer* ,
VideoTrack* ) { … }
void CrossThreadMediaSourceAttachment::RemoveAudioTracksFromMediaElement(
MediaSourceTracer* ,
Vector<String> audio_ids,
bool enqueue_change_event) { … }
void CrossThreadMediaSourceAttachment::RemoveVideoTracksFromMediaElement(
MediaSourceTracer* ,
Vector<String> video_ids,
bool enqueue_change_event) { … }
void CrossThreadMediaSourceAttachment::RemoveTracksFromMediaElementInternal(
TrackAddRemovalType track_type,
Vector<String> track_ids,
bool enqueue_change_event) { … }
void CrossThreadMediaSourceAttachment::RemoveTracksFromMediaElementOnMainThread(
TrackAddRemovalType track_type,
Vector<String> track_ids,
bool enqueue_change_event) { … }
void CrossThreadMediaSourceAttachment::AddMainThreadAudioTrackToMediaElement(
String id,
String kind,
String label,
String language,
bool enabled) { … }
void CrossThreadMediaSourceAttachment::AddMainThreadVideoTrackToMediaElement(
String id,
String kind,
String label,
String language,
bool selected) { … }
void CrossThreadMediaSourceAttachment::AddTrackToMediaElementInternal(
TrackAddRemovalType track_type,
String id,
String kind,
String label,
String language,
bool enable_or_select) { … }
void CrossThreadMediaSourceAttachment::AddTrackToMediaElementOnMainThread(
TrackAddRemovalType track_type,
String id,
String kind,
String label,
String language,
bool enable_or_select) { … }
void CrossThreadMediaSourceAttachment::OnMediaSourceContextDestroyed() { … }
bool CrossThreadMediaSourceAttachment::FullyAttachedOrSameThread(
SourceBufferPassKey) const { … }
bool CrossThreadMediaSourceAttachment::RunExclusively(
bool abort_if_not_fully_attached,
RunExclusivelyCB cb) { … }
void CrossThreadMediaSourceAttachment::Unregister() { … }
MediaSourceTracer*
CrossThreadMediaSourceAttachment::StartAttachingToMediaElement(
HTMLMediaElement* element,
bool* success) { … }
void CrossThreadMediaSourceAttachment::CompleteAttachingToMediaElement(
MediaSourceTracer* ,
std::unique_ptr<WebMediaSource> web_media_source) { … }
void CrossThreadMediaSourceAttachment::
CompleteAttachingToMediaElementOnWorkerThread(
std::unique_ptr<WebMediaSource> web_media_source) { … }
void CrossThreadMediaSourceAttachment::Close(MediaSourceTracer* ) { … }
void CrossThreadMediaSourceAttachment::CloseOnWorkerThread() { … }
WebTimeRanges CrossThreadMediaSourceAttachment::BufferedInternal(
MediaSourceTracer* ) const { … }
WebTimeRanges CrossThreadMediaSourceAttachment::SeekableInternal(
MediaSourceTracer* ) const { … }
void CrossThreadMediaSourceAttachment::OnTrackChanged(
MediaSourceTracer* ,
TrackBase* track) { … }
void CrossThreadMediaSourceAttachment::OnElementTimeUpdate(double time) { … }
void CrossThreadMediaSourceAttachment::UpdateWorkerThreadTimeCache(
base::TimeDelta time) { … }
void CrossThreadMediaSourceAttachment::OnElementError() { … }
void CrossThreadMediaSourceAttachment::HandleElementErrorOnWorkerThread() { … }
void CrossThreadMediaSourceAttachment::OnElementContextDestroyed() { … }
void CrossThreadMediaSourceAttachment::
AssertCrossThreadMutexIsAcquiredForDebugging() { … }
void CrossThreadMediaSourceAttachment::SendUpdatedInfoToMainThreadCache() { … }
void CrossThreadMediaSourceAttachment::SendUpdatedInfoToMainThreadCacheInternal(
bool has_new_duration,
double new_duration) { … }
void CrossThreadMediaSourceAttachment::UpdateMainThreadInfoCache(
WebTimeRanges new_buffered,
WebTimeRanges new_seekable,
bool has_new_duration,
double new_duration) { … }
void CrossThreadMediaSourceAttachment::
VerifyCalledWhileContextsAliveForDebugging() const { … }
}