chromium/third_party/blink/renderer/modules/peerconnection/rtc_rtp_sender.cc

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/modules/peerconnection/rtc_rtp_sender.h"

#include <memory>
#include <string>
#include <tuple>
#include <utility>

#include "base/metrics/histogram_macros.h"
#include "base/numerics/safe_conversions.h"
#include "base/task/single_thread_task_runner.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/common/privacy_budget/identifiable_token_builder.h"
#include "third_party/blink/public/platform/modules/webrtc/webrtc_logging.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_rtc_encoding_options.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_rtc_insertable_streams.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_rtc_rtcp_parameters.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_rtc_rtp_capabilities.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_rtc_rtp_codec_parameters.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_rtc_rtp_header_extension_capability.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_rtc_rtp_header_extension_parameters.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/core/streams/readable_stream.h"
#include "third_party/blink/renderer/core/streams/writable_stream.h"
#include "third_party/blink/renderer/modules/mediastream/media_stream_track.h"
#include "third_party/blink/renderer/modules/peerconnection/identifiability_metrics.h"
#include "third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.h"
#include "third_party/blink/renderer/modules/peerconnection/peer_connection_features.h"
#include "third_party/blink/renderer/modules/peerconnection/rtc_dtls_transport.h"
#include "third_party/blink/renderer/modules/peerconnection/rtc_dtmf_sender.h"
#include "third_party/blink/renderer/modules/peerconnection/rtc_encoded_audio_sender_sink_optimizer.h"
#include "third_party/blink/renderer/modules/peerconnection/rtc_encoded_audio_sender_source_optimizer.h"
#include "third_party/blink/renderer/modules/peerconnection/rtc_encoded_audio_underlying_sink.h"
#include "third_party/blink/renderer/modules/peerconnection/rtc_encoded_audio_underlying_source.h"
#include "third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_sender_sink_optimizer.h"
#include "third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_sender_source_optimizer.h"
#include "third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_underlying_sink.h"
#include "third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_underlying_source.h"
#include "third_party/blink/renderer/modules/peerconnection/rtc_error_util.h"
#include "third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.h"
#include "third_party/blink/renderer/modules/peerconnection/rtc_stats_report.h"
#include "third_party/blink/renderer/modules/peerconnection/web_rtc_stats_report_callback_resolver.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/heap/persistent.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_dtmf_sender_handler.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_encoded_audio_stream_transformer.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_encoded_video_stream_transformer.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_stats.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_void_request.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/math_extras.h"

namespace blink {

namespace features {

// Killswitch for requesting key frames via setParameterOptions.
// TODO(crbug.com/1354101): remove after rollout.
BASE_FEATURE();

}  // namespace features

namespace {

webrtc::RtpCodec ToWebrtcRtpCodec(const RTCRtpCodec* codec);

// This enum is used for logging and values must match the ones in
// tools/metrics/histograms/enums.xml
enum class WebRtcScalabilityMode {};

WebRtcScalabilityMode ScalabilityModeStringToUMAMode(
    const std::string& scalability_mode_string) {}

class ReplaceTrackRequest : public RTCVoidRequest {};

class SetParametersRequest : public RTCVoidRequest {};

bool HasInvalidModification(const RTCRtpSendParameters* parameters,
                            const RTCRtpSendParameters* new_parameters) {}

// Relative weights for each priority as defined in RTCWEB-DATA
// https://tools.ietf.org/html/draft-ietf-rtcweb-data-channel
const double kPriorityWeightVeryLow =;
const double kPriorityWeightLow =;
const double kPriorityWeightMedium =;
const double kPriorityWeightHigh =;

std::string PriorityFromDouble(double priority) {}

double PriorityToDouble(const WTF::String& priority) {}

std::string PriorityFromEnum(webrtc::Priority priority) {}

webrtc::Priority PriorityToEnum(const WTF::String& priority) {}

std::tuple<Vector<webrtc::RtpEncodingParameters>,
           std::optional<webrtc::DegradationPreference>>
ToRtpParameters(ExecutionContext* context,
                const RTCRtpSendParameters* parameters,
                const String& kind) {}

webrtc::RtpCodec ToWebrtcRtpCodec(const RTCRtpCodec* codec) {}

}  // namespace

webrtc::RtpEncodingParameters ToRtpEncodingParameters(
    ExecutionContext* context,
    const RTCRtpEncodingParameters* encoding,
    const String& kind) {}

RTCRtpHeaderExtensionParameters* ToRtpHeaderExtensionParameters(
    const webrtc::RtpExtension& webrtc_header) {}

void SetRtpCodec(RTCRtpCodec& codec, const webrtc::RtpCodec& webrtc_codec) {}

RTCRtpCodec* ToRtpCodec(const webrtc::RtpCodec& webrtc_codec) {}

RTCRtpCodecParameters* ToRtpCodecParameters(
    const webrtc::RtpCodecParameters& webrtc_codec_parameters) {}

RTCRtpSender::RTCRtpSender(RTCPeerConnection* pc,
                           std::unique_ptr<RTCRtpSenderPlatform> sender,
                           String kind,
                           MediaStreamTrack* track,
                           MediaStreamVector streams,
                           bool require_encoded_insertable_streams,
                           scoped_refptr<base::SequencedTaskRunner>
                               encoded_transform_shortcircuit_runner)
    :{}

MediaStreamTrack* RTCRtpSender::track() {}

RTCDtlsTransport* RTCRtpSender::transport() {}

RTCDtlsTransport* RTCRtpSender::rtcpTransport() {}

ScriptPromise<IDLUndefined> RTCRtpSender::replaceTrack(
    ScriptState* script_state,
    MediaStreamTrack* with_track,
    ExceptionState& exception_state) {}

RTCRtpSendParameters* RTCRtpSender::getParameters() {}

ScriptPromise<IDLUndefined> RTCRtpSender::setParameters(
    ScriptState* script_state,
    const RTCRtpSendParameters* parameters,
    const RTCSetParameterOptions* options,
    ExceptionState& exception_state) {}

void RTCRtpSender::ClearLastReturnedParameters() {}

ScriptPromise<RTCStatsReport> RTCRtpSender::getStats(
    ScriptState* script_state) {}

RTCRtpSenderPlatform* RTCRtpSender::web_sender() {}

void RTCRtpSender::SetTrack(MediaStreamTrack* track) {}

MediaStreamVector RTCRtpSender::streams() const {}

void RTCRtpSender::set_streams(MediaStreamVector streams) {}

void RTCRtpSender::set_transceiver(RTCRtpTransceiver* transceiver) {}

void RTCRtpSender::set_transport(RTCDtlsTransport* transport) {}

RTCDTMFSender* RTCRtpSender::dtmf() {}

void RTCRtpSender::setStreams(HeapVector<Member<MediaStream>> streams,
                              ExceptionState& exception_state) {}

RTCInsertableStreams* RTCRtpSender::createEncodedStreams(
    ScriptState* script_state,
    ExceptionState& exception_state) {}

void RTCRtpSender::ContextDestroyed() {}

void RTCRtpSender::Trace(Visitor* visitor) const {}

RTCRtpCapabilities* RTCRtpSender::getCapabilities(ScriptState* state,
                                                  const String& kind) {}

void RTCRtpSender::MaybeShortCircuitEncodedStreams() {}

void RTCRtpSender::RegisterEncodedAudioStreamCallback() {}

void RTCRtpSender::UnregisterEncodedAudioStreamCallback() {}

void RTCRtpSender::SetAudioUnderlyingSource(
    RTCEncodedAudioUnderlyingSource* new_underlying_source,
    scoped_refptr<base::SingleThreadTaskRunner> new_source_task_runner) {}

void RTCRtpSender::SetAudioUnderlyingSink(
    RTCEncodedAudioUnderlyingSink* new_underlying_sink) {}

RTCInsertableStreams* RTCRtpSender::CreateEncodedAudioStreams(
    ScriptState* script_state) {}

void RTCRtpSender::OnAudioFrameFromEncoder(
    std::unique_ptr<webrtc::TransformableAudioFrameInterface> frame) {}

void RTCRtpSender::RegisterEncodedVideoStreamCallback() {}

void RTCRtpSender::UnregisterEncodedVideoStreamCallback() {}

void RTCRtpSender::SetVideoUnderlyingSource(
    RTCEncodedVideoUnderlyingSource* new_underlying_source,
    scoped_refptr<base::SingleThreadTaskRunner> new_source_task_runner) {}

void RTCRtpSender::SetVideoUnderlyingSink(
    RTCEncodedVideoUnderlyingSink* new_underlying_sink) {}

RTCInsertableStreams* RTCRtpSender::CreateEncodedVideoStreams(
    ScriptState* script_state) {}

void RTCRtpSender::setTransform(RTCRtpScriptTransform* transform,
                                ExceptionState& exception_state) {}

void RTCRtpSender::OnVideoFrameFromEncoder(
    std::unique_ptr<webrtc::TransformableVideoFrameInterface> frame) {}

void RTCRtpSender::LogMessage(const std::string& message) {}

}  // namespace blink