#include "third_party/blink/renderer/modules/mediarecorder/media_recorder.h"
#include <algorithm>
#include <limits>
#include "base/time/time.h"
#include "third_party/blink/public/common/privacy_budget/identifiability_metric_builder.h"
#include "third_party/blink/public/common/privacy_budget/identifiability_study_settings.h"
#include "third_party/blink/public/common/privacy_budget/identifiable_surface.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/renderer/bindings/core/v8/dictionary.h"
#include "third_party/blink/renderer/bindings/core/v8/to_v8_traits.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_error_event_init.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/core/dom/events/event.h"
#include "third_party/blink/renderer/core/events/error_event.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/fileapi/blob.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/inspector/console_message.h"
#include "third_party/blink/renderer/modules/event_target_modules.h"
#include "third_party/blink/renderer/modules/mediarecorder/blob_event.h"
#include "third_party/blink/renderer/modules/mediarecorder/video_track_recorder.h"
#include "third_party/blink/renderer/platform/blob/blob_data.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/mediastream/media_stream_descriptor.h"
#include "third_party/blink/renderer/platform/network/mime/content_type.h"
#include "third_party/blink/renderer/platform/privacy_budget/identifiability_digest_helpers.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
namespace blink {
namespace {
struct MediaRecorderBitrates { … };
const int kSmallestPossibleOpusBitRate = …;
const int kLargestPossibleOpusBitRate = …;
const int kSmallestPossibleVpxBitRate = …;
const int kDefaultVideoBitRate = …;
const int kDefaultAudioBitRate = …;
String StateToString(MediaRecorder::State state) { … }
String BitrateModeToString(AudioTrackRecorder::BitrateMode bitrateMode) { … }
AudioTrackRecorder::BitrateMode GetBitrateModeFromOptions(
const MediaRecorderOptions* const options) { … }
void LogConsoleMessage(ExecutionContext* context, const String& message) { … }
uint32_t ClampAudioBitRate(ExecutionContext* context, uint32_t audio_bps) { … }
uint32_t ClampVideoBitRate(ExecutionContext* context, uint32_t video_bps) { … }
MediaRecorderBitrates GetBitratesFromOptions(
ExceptionState& exception_state,
ExecutionContext* context,
const MediaRecorderOptions* options) { … }
}
MediaRecorder* MediaRecorder::Create(ExecutionContext* context,
MediaStream* stream,
ExceptionState& exception_state) { … }
MediaRecorder* MediaRecorder::Create(ExecutionContext* context,
MediaStream* stream,
const MediaRecorderOptions* options,
ExceptionState& exception_state) { … }
MediaRecorder::MediaRecorder(ExecutionContext* context,
MediaStream* stream,
const MediaRecorderOptions* options,
ExceptionState& exception_state)
: … { … }
MediaRecorder::~MediaRecorder() = default;
String MediaRecorder::state() const { … }
String MediaRecorder::audioBitrateMode() const { … }
void MediaRecorder::start(ExceptionState& exception_state) { … }
void MediaRecorder::start(int time_slice, ExceptionState& exception_state) { … }
void MediaRecorder::stop(ExceptionState& exception_state) { … }
void MediaRecorder::pause(ExceptionState& exception_state) { … }
void MediaRecorder::resume(ExceptionState& exception_state) { … }
void MediaRecorder::requestData(ExceptionState& exception_state) { … }
bool MediaRecorder::isTypeSupported(ExecutionContext* context,
const String& type) { … }
const AtomicString& MediaRecorder::InterfaceName() const { … }
ExecutionContext* MediaRecorder::GetExecutionContext() const { … }
void MediaRecorder::ContextDestroyed() { … }
void MediaRecorder::WriteData(base::span<const uint8_t> data,
bool last_in_slice,
double timecode,
ErrorEvent* error_event) { … }
void MediaRecorder::OnError(DOMExceptionCode code, const String& message) { … }
void MediaRecorder::OnAllTracksEnded() { … }
void MediaRecorder::OnStreamChanged(const String& message) { … }
void MediaRecorder::CreateBlobEvent(Blob* blob, double timecode) { … }
void MediaRecorder::StopRecording(ErrorEvent* error_event) { … }
void MediaRecorder::ScheduleDispatchEvent(Event* event) { … }
void MediaRecorder::DispatchScheduledEvent() { … }
void MediaRecorder::Trace(Visitor* visitor) const { … }
void MediaRecorder::UpdateAudioBitrate(uint32_t bits_per_second) { … }
}