#include "cast/streaming/public/sender.h"
#include <algorithm>
#include <chrono>
#include <ratio>
#include <utility>
#include "cast/streaming/impl/rtp_defines.h"
#include "cast/streaming/impl/session_config.h"
#include "cast/streaming/impl/statistics_defines.h"
#include "platform/base/trivial_clock_traits.h"
#include "util/chrono_helpers.h"
#include "util/osp_logging.h"
#include "util/std_util.h"
#include "util/trace_logging.h"
namespace openscreen::cast {
operator<<;
namespace {
void DispatchEnqueueEvents(StreamType stream_type,
const EncodedFrame& frame,
Environment& environment) { … }
void DispatchAckEvent(StreamType stream_type,
RtpTimeTicks rtp_timestamp,
FrameId frame_id,
Environment& environment) { … }
void DispatchFrameLogMessages(
StreamType stream_type,
const std::vector<RtcpReceiverFrameLogMessage>& messages,
Environment& environment) { … }
}
Sender::Sender(Environment& environment,
SenderPacketRouter& packet_router,
SessionConfig config,
RtpPayloadType rtp_payload_type)
: … { … }
Sender::~Sender() { … }
void Sender::SetObserver(Sender::Observer* observer) { … }
int Sender::GetInFlightFrameCount() const { … }
Clock::duration Sender::GetInFlightMediaDuration(
RtpTimeTicks next_frame_rtp_timestamp) const { … }
Clock::duration Sender::GetMaxInFlightMediaDuration() const { … }
bool Sender::NeedsKeyFrame() const { … }
FrameId Sender::GetNextFrameId() const { … }
Clock::duration Sender::GetCurrentRoundTripTime() const { … }
Sender::EnqueueFrameResult Sender::EnqueueFrame(const EncodedFrame& frame) { … }
void Sender::CancelInFlightData() { … }
void Sender::OnReceivedRtcpPacket(Clock::time_point arrival_time,
ByteView packet) { … }
ByteBuffer Sender::GetRtcpPacketForImmediateSend(Clock::time_point send_time,
ByteBuffer buffer) { … }
ByteBuffer Sender::GetRtpPacketForImmediateSend(Clock::time_point send_time,
ByteBuffer buffer) { … }
Clock::time_point Sender::GetRtpResumeTime() { … }
RtpTimeTicks Sender::GetLastRtpTimestamp() const { … }
StreamType Sender::GetStreamType() const { … }
void Sender::OnReceiverReferenceTimeAdvanced(Clock::time_point reference_time) { … }
void Sender::OnReceiverReport(const RtcpReportBlock& receiver_report) { … }
void Sender::OnCastReceiverFrameLogMessages(
std::vector<RtcpReceiverFrameLogMessage> messages) { … }
void Sender::OnReceiverIndicatesPictureLoss() { … }
void Sender::OnReceiverCheckpoint(FrameId frame_id,
milliseconds playout_delay) { … }
void Sender::OnReceiverHasFrames(std::vector<FrameId> acks) { … }
void Sender::OnReceiverIsMissingPackets(std::vector<PacketNack> nacks) { … }
Sender::ChosenPacket Sender::ChooseNextRtpPacketNeedingSend() { … }
Sender::ChosenPacketAndWhen Sender::ChooseKickstartPacket() { … }
void Sender::CancelPendingFrame(FrameId frame_id, bool was_acked) { … }
void Sender::DispatchCancellations() { … }
void Sender::Observer::OnFrameCanceled(FrameId frame_id) { … }
void Sender::Observer::OnPictureLost() { … }
Sender::Observer::~Observer() = default;
Sender::PendingFrameSlot::PendingFrameSlot() = default;
Sender::PendingFrameSlot::~PendingFrameSlot() = default;
}