#include "third_party/blink/renderer/modules/breakout_box/frame_queue_underlying_source.h"
#include "base/feature_list.h"
#include "base/task/bind_post_task.h"
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_throw_dom_exception.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/streams/readable_stream_default_controller_with_script_scope.h"
#include "third_party/blink/renderer/modules/webcodecs/audio_data.h"
#include "third_party/blink/renderer/modules/webcodecs/video_frame.h"
#include "third_party/blink/renderer/modules/webcodecs/video_frame_monitor.h"
#include "third_party/blink/renderer/platform/bindings/exception_code.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"
#include "third_party/webrtc/api/frame_transformer_interface.h"
namespace blink {
BASE_FEATURE(…);
BASE_FEATURE(…);
BASE_FEATURE(…);
namespace {
media::VideoFrame::ID GetFrameId(
const scoped_refptr<media::VideoFrame>& video_frame) { … }
media::VideoFrame::ID GetFrameId(const scoped_refptr<media::AudioBuffer>&) { … }
}
template <typename NativeFrameType>
FrameQueueUnderlyingSource<NativeFrameType>::FrameQueueUnderlyingSource(
ScriptState* script_state,
wtf_size_t max_queue_size,
std::string device_id,
wtf_size_t frame_pool_size)
: … { … }
template <typename NativeFrameType>
FrameQueueUnderlyingSource<NativeFrameType>::FrameQueueUnderlyingSource(
ScriptState* script_state,
wtf_size_t max_queue_size)
: … { … }
template <typename NativeFrameType>
FrameQueueUnderlyingSource<NativeFrameType>::FrameQueueUnderlyingSource(
ScriptState* script_state,
FrameQueueUnderlyingSource<NativeFrameType>* other_source)
: … { … }
template <typename NativeFrameType>
ScriptPromiseUntyped FrameQueueUnderlyingSource<NativeFrameType>::Pull(
ScriptState* script_state,
ExceptionState&) { … }
template <typename NativeFrameType>
ScriptPromiseUntyped FrameQueueUnderlyingSource<NativeFrameType>::Start(
ScriptState* script_state,
ExceptionState& exception_state) { … }
template <typename NativeFrameType>
ScriptPromiseUntyped FrameQueueUnderlyingSource<NativeFrameType>::Cancel(
ScriptState* script_state,
ScriptValue reason,
ExceptionState&) { … }
template <typename NativeFrameType>
void FrameQueueUnderlyingSource<NativeFrameType>::ContextDestroyed() { … }
template <typename NativeFrameType>
wtf_size_t FrameQueueUnderlyingSource<NativeFrameType>::MaxQueueSize() const { … }
template <typename NativeFrameType>
void FrameQueueUnderlyingSource<NativeFrameType>::Close() { … }
template <typename NativeFrameType>
void FrameQueueUnderlyingSource<NativeFrameType>::QueueFrame(
NativeFrameType media_frame) { … }
template <typename NativeFrameType>
void FrameQueueUnderlyingSource<NativeFrameType>::Trace(
Visitor* visitor) const { … }
template <typename NativeFrameType>
int FrameQueueUnderlyingSource<NativeFrameType>::NumPendingPullsForTesting()
const { … }
template <typename NativeFrameType>
double FrameQueueUnderlyingSource<NativeFrameType>::DesiredSizeForTesting()
const { … }
template <typename NativeFrameType>
void FrameQueueUnderlyingSource<NativeFrameType>::TransferSource(
CrossThreadPersistent<FrameQueueUnderlyingSource<NativeFrameType>>
transferred_source) { … }
template <typename NativeFrameType>
void FrameQueueUnderlyingSource<NativeFrameType>::ClearTransferredSource() { … }
template <typename NativeFrameType>
void FrameQueueUnderlyingSource<NativeFrameType>::CloseController() { … }
template <typename NativeFrameType>
void FrameQueueUnderlyingSource<
NativeFrameType>::MaybeSendFrameFromQueueToStream() { … }
template <typename NativeFrameType>
void FrameQueueUnderlyingSource<NativeFrameType>::EnqueueBlinkFrame(
ScriptWrappable* blink_frame) const { … }
template <typename NativeFrameType>
bool FrameQueueUnderlyingSource<NativeFrameType>::MustUseMonitor() const { … }
template <typename NativeFrameType>
base::Lock& FrameQueueUnderlyingSource<NativeFrameType>::GetMonitorLock() { … }
template <typename NativeFrameType>
void FrameQueueUnderlyingSource<NativeFrameType>::MaybeMonitorPopFrameId(
media::VideoFrame::ID frame_id) { … }
template <typename NativeFrameType>
void FrameQueueUnderlyingSource<NativeFrameType>::MonitorPopFrameLocked(
const NativeFrameType& media_frame) { … }
template <typename NativeFrameType>
void FrameQueueUnderlyingSource<NativeFrameType>::MonitorPushFrameLocked(
const NativeFrameType& media_frame) { … }
template <typename NativeFrameType>
typename FrameQueueUnderlyingSource<NativeFrameType>::NewFrameAction
FrameQueueUnderlyingSource<NativeFrameType>::AnalyzeNewFrameLocked(
const NativeFrameType& new_frame,
const std::optional<NativeFrameType>& oldest_frame) { … }
template <>
ScriptWrappable*
FrameQueueUnderlyingSource<scoped_refptr<media::VideoFrame>>::MakeBlinkFrame(
scoped_refptr<media::VideoFrame> media_frame) { … }
template <>
ScriptWrappable*
FrameQueueUnderlyingSource<scoped_refptr<media::AudioBuffer>>::MakeBlinkFrame(
scoped_refptr<media::AudioBuffer> media_frame) { … }
template <>
bool FrameQueueUnderlyingSource<
scoped_refptr<media::AudioBuffer>>::MustUseMonitor() const { … }
template class MODULES_TEMPLATE_EXPORT
FrameQueueUnderlyingSource<scoped_refptr<media::AudioBuffer>>;
template class MODULES_TEMPLATE_EXPORT
FrameQueueUnderlyingSource<scoped_refptr<media::VideoFrame>>;
}