2011-07-07 08:21:25 +00:00
|
|
|
/*
|
2012-03-01 18:22:48 +00:00
|
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
2011-07-07 08:21:25 +00:00
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef VIDEO_RTP_VIDEO_STREAM_RECEIVER_H_
|
|
|
|
|
#define VIDEO_RTP_VIDEO_STREAM_RECEIVER_H_
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2019-03-01 11:01:59 -08:00
|
|
|
#include <atomic>
|
2011-10-13 15:19:55 +00:00
|
|
|
#include <list>
|
2016-11-15 00:57:57 -08:00
|
|
|
#include <map>
|
2016-03-01 11:52:33 -08:00
|
|
|
#include <memory>
|
2016-02-26 16:26:20 +01:00
|
|
|
#include <string>
|
2015-11-26 15:24:52 +01:00
|
|
|
#include <vector>
|
2011-10-13 15:19:55 +00:00
|
|
|
|
2018-08-09 16:16:34 +02:00
|
|
|
#include "absl/types/optional.h"
|
2019-10-16 19:18:21 +02:00
|
|
|
#include "api/array_view.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "api/crypto/frame_decryptor_interface.h"
|
2018-12-03 14:18:53 +01:00
|
|
|
#include "api/video/color_space.h"
|
2018-08-09 16:16:34 +02:00
|
|
|
#include "api/video_codecs/video_codec.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "call/rtp_packet_sink_interface.h"
|
2018-07-31 08:29:53 +02:00
|
|
|
#include "call/syncable.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "call/video_receive_stream.h"
|
|
|
|
|
#include "modules/rtp_rtcp/include/receive_statistics.h"
|
|
|
|
|
#include "modules/rtp_rtcp/include/remote_ntp_time_estimator.h"
|
2017-09-25 10:47:00 +02:00
|
|
|
#include "modules/rtp_rtcp/include/rtp_header_extension_map.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "modules/rtp_rtcp/include/rtp_rtcp.h"
|
|
|
|
|
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
2019-10-16 19:18:21 +02:00
|
|
|
#include "modules/rtp_rtcp/source/rtp_packet_received.h"
|
|
|
|
|
#include "modules/rtp_rtcp/source/rtp_video_header.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "modules/video_coding/h264_sps_pps_tracker.h"
|
2019-02-25 13:00:51 +01:00
|
|
|
#include "modules/video_coding/loss_notification_controller.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "modules/video_coding/packet_buffer.h"
|
|
|
|
|
#include "modules/video_coding/rtp_frame_reference_finder.h"
|
2019-10-30 14:12:24 +01:00
|
|
|
#include "modules/video_coding/unique_timestamp_counter.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "rtc_base/constructor_magic.h"
|
|
|
|
|
#include "rtc_base/critical_section.h"
|
2017-10-25 13:07:09 +02:00
|
|
|
#include "rtc_base/numerics/sequence_number_util.h"
|
2019-04-09 13:44:04 +02:00
|
|
|
#include "rtc_base/synchronization/sequence_checker.h"
|
2018-11-30 16:18:26 -08:00
|
|
|
#include "rtc_base/thread_annotations.h"
|
|
|
|
|
#include "rtc_base/thread_checker.h"
|
|
|
|
|
#include "video/buffered_frame_decryptor.h"
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2011-11-28 22:39:24 +00:00
|
|
|
namespace webrtc {
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2016-11-15 00:57:57 -08:00
|
|
|
class NackModule;
|
2016-04-25 01:26:26 -07:00
|
|
|
class PacketRouter;
|
2016-05-06 05:32:22 -07:00
|
|
|
class ProcessThread;
|
2013-08-15 23:38:54 +00:00
|
|
|
class ReceiveStatistics;
|
2016-05-03 21:22:04 -07:00
|
|
|
class ReceiveStatisticsProxy;
|
2016-04-25 01:26:26 -07:00
|
|
|
class RtcpRttStats;
|
2017-02-13 05:59:46 -08:00
|
|
|
class RtpPacketReceived;
|
2016-04-25 01:26:26 -07:00
|
|
|
class Transport;
|
2016-10-31 04:51:33 -07:00
|
|
|
class UlpfecReceiver;
|
2016-04-22 18:23:15 +02:00
|
|
|
|
2019-02-25 13:00:51 +01:00
|
|
|
class RtpVideoStreamReceiver : public LossNotificationSender,
|
|
|
|
|
public RecoveredPacketReceiver,
|
2017-06-21 01:05:22 -07:00
|
|
|
public RtpPacketSinkInterface,
|
2019-05-23 16:57:01 +02:00
|
|
|
public KeyFrameRequestSender,
|
2018-11-30 16:18:26 -08:00
|
|
|
public video_coding::OnCompleteFrameCallback,
|
2019-03-01 11:01:59 -08:00
|
|
|
public OnDecryptedFrameCallback,
|
|
|
|
|
public OnDecryptionStatusChangeCallback {
|
2011-11-28 22:39:24 +00:00
|
|
|
public:
|
2017-06-09 04:01:55 -07:00
|
|
|
RtpVideoStreamReceiver(
|
2019-03-04 19:39:01 +01:00
|
|
|
Clock* clock,
|
2016-11-15 00:57:57 -08:00
|
|
|
Transport* transport,
|
|
|
|
|
RtcpRttStats* rtt_stats,
|
2019-05-20 11:06:33 +02:00
|
|
|
// The packet router is optional; if provided, the RtpRtcp module for this
|
|
|
|
|
// stream is registered as a candidate for sending REMB and transport
|
|
|
|
|
// feedback.
|
2016-11-15 00:57:57 -08:00
|
|
|
PacketRouter* packet_router,
|
|
|
|
|
const VideoReceiveStream::Config* config,
|
Reland of Use RtxReceiveStream. (patchset #1 id:1 of https://codereview.webrtc.org/3007303002/ )
Reason for revert:
Identified a configuration problem in the video quality tests. Intend to fix and reland.
Original issue's description:
> Revert of Use RtxReceiveStream. (patchset #5 id:320001 of https://codereview.webrtc.org/3006063002/ )
>
> Reason for revert:
> This change appears to break ulpfec, with severe regressions, e.g., for webrtc_perf_test FullStackTest.ForemanCifPlr5Ulpfec
>
> Original issue's description:
> > Reland of Use RtxReceiveStream. (patchset #1 id:1 of https://codereview.webrtc.org/3010983002/ )
> >
> > Reason for revert:
> > Intend to fix perf failures and reland.
> >
> > Original issue's description:
> > > Revert of Use RtxReceiveStream. (patchset #5 id:80001 of https://codereview.webrtc.org/3008773002/ )
> > >
> > > Reason for revert:
> > > A few perf tests broken, including
> > >
> > > RampUpTest.UpDownUpAbsSendTimeSimulcastRedRtx
> > > RampUpTest.UpDownUpTransportSequenceNumberRtx
> > > RampUpTest.UpDownUpTransportSequenceNumberPacketLoss
> > >
> > >
> > > Original issue's description:
> > > > Use RtxReceiveStream.
> > > >
> > > > This also has the beneficial side-effect that when a media stream
> > > > which is protected by FlexFEC receives an RTX retransmission, the
> > > > retransmitted media packet is passed into the FlexFEC machinery,
> > > > which should improve its ability to recover packets via FEC.
> > > >
> > > > BUG=webrtc:7135
> > > >
> > > > Review-Url: https://codereview.webrtc.org/3008773002
> > > > Cr-Commit-Position: refs/heads/master@{#19649}
> > > > Committed: https://chromium.googlesource.com/external/webrtc/+/5c0f6c62ea3b1d2c43f8fc152961af27033475f7
> > >
> > > TBR=brandtr@webrtc.org,danilchap@webrtc.org,stefan@webrtc.org,magjed@webrtc.org
> > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > NOPRESUBMIT=true
> > > NOTREECHECKS=true
> > > NOTRY=true
> > > BUG=webrtc:7135
> > >
> > > Review-Url: https://codereview.webrtc.org/3010983002
> > > Cr-Commit-Position: refs/heads/master@{#19653}
> > > Committed: https://chromium.googlesource.com/external/webrtc/+/3c39c0137afa274d1d524b150b50304b38a2847b
> >
> > TBR=brandtr@webrtc.org,danilchap@webrtc.org,stefan@webrtc.org,magjed@webrtc.org
> > # Skipping CQ checks because original CL landed less than 1 days ago.
> > NOPRESUBMIT=true
> > NOTREECHECKS=true
> > BUG=webrtc:7135
> >
> > Review-Url: https://codereview.webrtc.org/3006063002
> > Cr-Commit-Position: refs/heads/master@{#19715}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/35713eaf565c0fef07c8afc158d7b8fdf7ec3d78
>
> TBR=brandtr@webrtc.org,danilchap@webrtc.org,stefan@webrtc.org,magjed@webrtc.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=webrtc:7135
>
> Review-Url: https://codereview.webrtc.org/3007303002
> Cr-Commit-Position: refs/heads/master@{#19744}
> Committed: https://chromium.googlesource.com/external/webrtc/+/8e7eee035178a7f10e19883681b5eaa4a7523107
TBR=brandtr@webrtc.org,danilchap@webrtc.org,stefan@webrtc.org,magjed@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7135
Review-Url: https://codereview.webrtc.org/3012963002
Cr-Commit-Position: refs/heads/master@{#19765}
2017-09-11 02:32:16 -07:00
|
|
|
ReceiveStatistics* rtp_receive_statistics,
|
2016-11-15 00:57:57 -08:00
|
|
|
ReceiveStatisticsProxy* receive_stats_proxy,
|
|
|
|
|
ProcessThread* process_thread,
|
|
|
|
|
NackSender* nack_sender,
|
2019-05-29 13:35:14 +02:00
|
|
|
// The KeyFrameRequestSender is optional; if not provided, key frame
|
|
|
|
|
// requests are sent via the internal RtpRtcp module.
|
|
|
|
|
KeyFrameRequestSender* keyframe_request_sender,
|
2018-10-17 17:27:25 -07:00
|
|
|
video_coding::OnCompleteFrameCallback* complete_frame_callback,
|
|
|
|
|
rtc::scoped_refptr<FrameDecryptorInterface> frame_decryptor);
|
2018-08-28 16:30:18 +02:00
|
|
|
~RtpVideoStreamReceiver() override;
|
2011-11-28 22:39:24 +00:00
|
|
|
|
2018-08-09 16:16:34 +02:00
|
|
|
void AddReceiveCodec(const VideoCodec& video_codec,
|
2019-05-23 13:21:12 +02:00
|
|
|
const std::map<std::string, std::string>& codec_params,
|
|
|
|
|
bool raw_payload);
|
2013-08-15 23:38:54 +00:00
|
|
|
|
2011-11-28 22:39:24 +00:00
|
|
|
void StartReceive();
|
|
|
|
|
void StopReceive();
|
|
|
|
|
|
2018-07-31 08:29:53 +02:00
|
|
|
// Produces the transport-related timestamps; current_delay_ms is left unset.
|
|
|
|
|
absl::optional<Syncable::Info> GetSyncInfo() const;
|
|
|
|
|
|
2016-02-08 14:07:14 +01:00
|
|
|
bool DeliverRtcp(const uint8_t* rtcp_packet, size_t rtcp_packet_length);
|
2011-11-28 22:39:24 +00:00
|
|
|
|
2017-09-04 07:03:46 -07:00
|
|
|
void FrameContinuous(int64_t seq_num);
|
2016-11-15 00:57:57 -08:00
|
|
|
|
2017-09-04 07:03:46 -07:00
|
|
|
void FrameDecoded(int64_t seq_num);
|
2016-11-15 00:57:57 -08:00
|
|
|
|
2016-05-06 05:32:22 -07:00
|
|
|
void SignalNetworkState(NetworkState state);
|
|
|
|
|
|
2019-10-30 14:12:24 +01:00
|
|
|
// Returns number of different frames seen.
|
|
|
|
|
int GetUniqueFramesSeen() const {
|
|
|
|
|
RTC_DCHECK_RUN_ON(&worker_task_checker_);
|
|
|
|
|
return frame_counter_.GetUniqueSeen();
|
|
|
|
|
}
|
2018-02-21 15:57:09 +01:00
|
|
|
|
2017-06-21 01:05:22 -07:00
|
|
|
// Implements RtpPacketSinkInterface.
|
|
|
|
|
void OnRtpPacket(const RtpPacketReceived& packet) override;
|
2017-02-13 05:59:46 -08:00
|
|
|
|
2018-10-02 13:55:47 +02:00
|
|
|
// TODO(philipel): Stop using VCMPacket in the new jitter buffer and then
|
2019-03-11 16:11:07 +01:00
|
|
|
// remove this function. Public only for tests.
|
2019-10-16 19:18:21 +02:00
|
|
|
void OnReceivedPayloadData(rtc::ArrayView<const uint8_t> codec_payload,
|
|
|
|
|
const RtpPacketReceived& rtp_packet,
|
|
|
|
|
const RTPVideoHeader& video);
|
2018-10-02 13:55:47 +02:00
|
|
|
|
2017-05-29 08:16:37 -07:00
|
|
|
// Implements RecoveredPacketReceiver.
|
|
|
|
|
void OnRecoveredPacket(const uint8_t* packet, size_t packet_length) override;
|
2011-11-28 22:39:24 +00:00
|
|
|
|
2019-03-25 15:51:03 +01:00
|
|
|
// Send an RTCP keyframe request.
|
2019-05-23 16:57:01 +02:00
|
|
|
void RequestKeyFrame() override;
|
2016-05-03 21:22:04 -07:00
|
|
|
|
2019-02-25 13:00:51 +01:00
|
|
|
// Implements LossNotificationSender.
|
|
|
|
|
void SendLossNotification(uint16_t last_decoded_seq_num,
|
|
|
|
|
uint16_t last_received_seq_num,
|
2019-06-03 14:37:50 +02:00
|
|
|
bool decodability_flag,
|
|
|
|
|
bool buffering_allowed) override;
|
2019-02-25 13:00:51 +01:00
|
|
|
|
2016-12-08 08:25:47 -08:00
|
|
|
bool IsUlpfecEnabled() const;
|
2016-05-06 05:32:22 -07:00
|
|
|
bool IsRetransmissionsEnabled() const;
|
2019-03-01 11:01:59 -08:00
|
|
|
|
|
|
|
|
// Returns true if a decryptor is attached and frames can be decrypted.
|
|
|
|
|
// Updated by OnDecryptionStatusChangeCallback. Note this refers to Frame
|
|
|
|
|
// Decryption not SRTP.
|
|
|
|
|
bool IsDecryptable() const;
|
|
|
|
|
|
2016-05-06 05:32:22 -07:00
|
|
|
// Don't use, still experimental.
|
|
|
|
|
void RequestPacketRetransmit(const std::vector<uint16_t>& sequence_numbers);
|
|
|
|
|
|
2016-11-15 00:57:57 -08:00
|
|
|
// Implements OnCompleteFrameCallback.
|
|
|
|
|
void OnCompleteFrame(
|
2018-02-22 14:35:06 +01:00
|
|
|
std::unique_ptr<video_coding::EncodedFrame> frame) override;
|
2016-11-15 00:57:57 -08:00
|
|
|
|
2018-11-30 16:18:26 -08:00
|
|
|
// Implements OnDecryptedFrameCallback.
|
|
|
|
|
void OnDecryptedFrame(
|
|
|
|
|
std::unique_ptr<video_coding::RtpFrameObject> frame) override;
|
|
|
|
|
|
2019-03-01 11:01:59 -08:00
|
|
|
// Implements OnDecryptionStatusChangeCallback.
|
Reland "Refactor FrameDecryptorInterface::Decrypt to use new API."
This reverts commit 7dd83e2bf73a7f1746c5ee976939bf52e19fa8be.
Reason for revert: This wasn't the cause of the break.
Original change's description:
> Revert "Refactor FrameDecryptorInterface::Decrypt to use new API."
>
> This reverts commit 642aa81f7d5cc55d5b99e2abc51327eed9d40195.
>
> Reason for revert: Speculative revert. The chromium roll is failing:
> https://ci.chromium.org/p/chromium/builders/try/linux-rel/64388
> But I can't figure out exactly what is failing, this looks suspecious.
>
> Original change's description:
> > Refactor FrameDecryptorInterface::Decrypt to use new API.
> >
> > This change refactors the FrameDecryptorInterface to use the new API. The new
> > API surface simply moves bytes_written to the return type and implements a
> > simple Status type.
> >
> > Bug: webrtc:10512
> > Change-Id: I622c5d344d58e618853c94c2f691cf7c8fb73a36
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/131460
> > Reviewed-by: Steve Anton <steveanton@webrtc.org>
> > Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
> > Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
> > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > Commit-Queue: Benjamin Wright <benwright@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#27497}
>
> TBR=brandtr@webrtc.org,steveanton@webrtc.org,solenberg@webrtc.org,ossu@webrtc.org,stefan@webrtc.org,benwright@webrtc.org
>
> Change-Id: Ia9ec70263762c34671af13f0d519e636eb8473cd
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:10512
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132013
> Reviewed-by: Henrik Boström <hbos@webrtc.org>
> Commit-Queue: Henrik Boström <hbos@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#27510}
TBR=brandtr@webrtc.org,steveanton@webrtc.org,solenberg@webrtc.org,hbos@webrtc.org,ossu@webrtc.org,stefan@webrtc.org,benwright@webrtc.org
Change-Id: I8e4b7965cf1d1a1554c3b46e6245f5ad0d2dcbb4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:10512
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/131982
Reviewed-by: Benjamin Wright <benwright@webrtc.org>
Commit-Queue: Benjamin Wright <benwright@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27529}
2019-04-09 20:08:41 +00:00
|
|
|
void OnDecryptionStatusChange(
|
|
|
|
|
FrameDecryptorInterface::Status status) override;
|
2019-03-01 11:01:59 -08:00
|
|
|
|
2019-04-03 10:44:18 -07:00
|
|
|
// Optionally set a frame decryptor after a stream has started. This will not
|
|
|
|
|
// reset the decoder state.
|
|
|
|
|
void SetFrameDecryptor(
|
|
|
|
|
rtc::scoped_refptr<FrameDecryptorInterface> frame_decryptor);
|
|
|
|
|
|
2018-03-25 22:19:25 +02:00
|
|
|
// Called by VideoReceiveStream when stats are updated.
|
|
|
|
|
void UpdateRtt(int64_t max_rtt_ms);
|
2016-11-15 00:57:57 -08:00
|
|
|
|
2018-06-15 12:28:07 +02:00
|
|
|
absl::optional<int64_t> LastReceivedPacketMs() const;
|
|
|
|
|
absl::optional<int64_t> LastReceivedKeyframePacketMs() const;
|
2017-05-18 08:08:53 -07:00
|
|
|
|
2017-08-02 07:39:07 -07:00
|
|
|
// RtpDemuxer only forwards a given RTP packet to one sink. However, some
|
|
|
|
|
// sinks, such as FlexFEC, might wish to be informed of all of the packets
|
|
|
|
|
// a given sink receives (or any set of sinks). They may do so by registering
|
|
|
|
|
// themselves as secondary sinks.
|
|
|
|
|
void AddSecondarySink(RtpPacketSinkInterface* sink);
|
|
|
|
|
void RemoveSecondarySink(const RtpPacketSinkInterface* sink);
|
|
|
|
|
|
2011-11-28 22:39:24 +00:00
|
|
|
private:
|
2019-05-31 13:25:50 +02:00
|
|
|
// Used for buffering RTCP feedback messages and sending them all together.
|
|
|
|
|
// Note:
|
|
|
|
|
// 1. Key frame requests and NACKs are mutually exclusive, with the
|
|
|
|
|
// former taking precedence over the latter.
|
|
|
|
|
// 2. Loss notifications are orthogonal to either. (That is, may be sent
|
|
|
|
|
// alongside either.)
|
|
|
|
|
class RtcpFeedbackBuffer : public KeyFrameRequestSender,
|
|
|
|
|
public NackSender,
|
|
|
|
|
public LossNotificationSender {
|
|
|
|
|
public:
|
|
|
|
|
RtcpFeedbackBuffer(KeyFrameRequestSender* key_frame_request_sender,
|
|
|
|
|
NackSender* nack_sender,
|
|
|
|
|
LossNotificationSender* loss_notification_sender);
|
|
|
|
|
|
|
|
|
|
~RtcpFeedbackBuffer() override = default;
|
|
|
|
|
|
|
|
|
|
// KeyFrameRequestSender implementation.
|
|
|
|
|
void RequestKeyFrame() override;
|
|
|
|
|
|
|
|
|
|
// NackSender implementation.
|
|
|
|
|
void SendNack(const std::vector<uint16_t>& sequence_numbers,
|
|
|
|
|
bool buffering_allowed) override;
|
|
|
|
|
|
|
|
|
|
// LossNotificationSender implementation.
|
|
|
|
|
void SendLossNotification(uint16_t last_decoded_seq_num,
|
|
|
|
|
uint16_t last_received_seq_num,
|
2019-06-03 14:37:50 +02:00
|
|
|
bool decodability_flag,
|
|
|
|
|
bool buffering_allowed) override;
|
2019-05-31 13:25:50 +02:00
|
|
|
|
|
|
|
|
// Send all RTCP feedback messages buffered thus far.
|
|
|
|
|
void SendBufferedRtcpFeedback();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
KeyFrameRequestSender* const key_frame_request_sender_;
|
|
|
|
|
NackSender* const nack_sender_;
|
|
|
|
|
LossNotificationSender* const loss_notification_sender_;
|
|
|
|
|
|
|
|
|
|
// NACKs are accessible from two threads due to nack_module_ being a module.
|
|
|
|
|
rtc::CriticalSection cs_;
|
|
|
|
|
|
|
|
|
|
// Key-frame-request-related state.
|
|
|
|
|
bool request_key_frame_ RTC_GUARDED_BY(cs_);
|
|
|
|
|
|
|
|
|
|
// NACK-related state.
|
|
|
|
|
std::vector<uint16_t> nack_sequence_numbers_ RTC_GUARDED_BY(cs_);
|
|
|
|
|
|
|
|
|
|
// LNTF-related state.
|
|
|
|
|
struct LossNotificationState {
|
|
|
|
|
LossNotificationState(uint16_t last_decoded_seq_num,
|
|
|
|
|
uint16_t last_received_seq_num,
|
|
|
|
|
bool decodability_flag)
|
|
|
|
|
: last_decoded_seq_num(last_decoded_seq_num),
|
|
|
|
|
last_received_seq_num(last_received_seq_num),
|
|
|
|
|
decodability_flag(decodability_flag) {}
|
|
|
|
|
|
|
|
|
|
uint16_t last_decoded_seq_num;
|
|
|
|
|
uint16_t last_received_seq_num;
|
|
|
|
|
bool decodability_flag;
|
|
|
|
|
};
|
|
|
|
|
absl::optional<LossNotificationState> lntf_state_ RTC_GUARDED_BY(cs_);
|
|
|
|
|
};
|
|
|
|
|
|
2018-08-09 16:16:34 +02:00
|
|
|
// Entry point doing non-stats work for a received packet. Called
|
|
|
|
|
// for the same packet both before and after RED decapsulation.
|
|
|
|
|
void ReceivePacket(const RtpPacketReceived& packet);
|
|
|
|
|
// Parses and handles RED headers.
|
2013-09-06 13:40:11 +00:00
|
|
|
// This function assumes that it's being called from only one thread.
|
2018-09-14 08:26:32 +02:00
|
|
|
void ParseAndHandleEncapsulatingHeader(const RtpPacketReceived& packet);
|
2018-03-23 13:22:29 +01:00
|
|
|
void NotifyReceiverOfEmptyPacket(uint16_t seq_num);
|
2015-01-15 07:40:20 +00:00
|
|
|
void UpdateHistograms();
|
Remove RED/RTX workaround from sender/receiver and VideoEngine2.
In older Chrome versions, the associated payload type in the RTX header
of retransmitted packets was always set to be the original media payload type,
regardless of the actual payload type of the packet. This meant that packets
encapsulated with RED headers had incorrect payload type information in the
RTX header. Due to an assumption in the receiver, this incorrect payload type
information would effectively be undone, leading to a working system.
Albeit working, this behaviour was undesired, and thus removed. In the interim,
several workarounds were introduced to not destroy interop between old and
new Chrome versions:
(1) https://codereview.webrtc.org/1649493004
- If no payload type mapping existed for RED over RTX, the payload type
of the underlying media would be used.
- If RED had been negotiated, received RTX packets would always be
assumed to contain RED.
(2) https://codereview.webrtc.org/1964473002
- If RED was removed from the remote description answer, it would be
disabled in the local receiver as well.
(3) https://codereview.webrtc.org/2033763002
- If RED was negotiated in the SDP, it would always be used, regardless
if ULPFEC was negotiated and used, or not.
Since the Chrome versions that exhibited the original bug now are very old,
this CL removes the workarounds from (1) and (2). In particular, after this
change, we will have the following behaviour:
- We assume that a payload type mapping for RED over RTX always is set.
If this is not the case, the RTX packet is not sent.
- The associated payload type of received RTX packets will always be obeyed.
- The (non)-existence of RED in the remote description does not affect the
local receiver.
The workaround in (3) still needs to exist, in order to interop with receivers
that did not have the workarounds in (1) and (2) removed. The change in (3)
can be removed in a couple of Chrome versions.
TESTED=Using AppRTC between patched Chrome (connected to ethernet) and standard Chrome M54 (connected to lossy internal Google WiFi), with and without FEC turned off using AppRTC flag. Also using "Munge SDP" sample on patched Chrome over loopback interface, with 100ms delay and 5% packet loss simulated using tc.
BUG=webrtc:6650
Review-Url: https://codereview.webrtc.org/2469093003
Cr-Commit-Position: refs/heads/master@{#15038}
2016-11-11 03:28:30 -08:00
|
|
|
bool IsRedEnabled() const;
|
2016-12-20 04:15:59 -08:00
|
|
|
void InsertSpsPpsIntoTracker(uint8_t payload_type);
|
2019-10-22 17:12:42 +02:00
|
|
|
void OnInsertedPacket(video_coding::PacketBuffer::InsertResult result);
|
|
|
|
|
void OnAssembledFrame(std::unique_ptr<video_coding::RtpFrameObject> frame);
|
2011-11-28 22:39:24 +00:00
|
|
|
|
2016-03-02 15:05:53 +01:00
|
|
|
Clock* const clock_;
|
2016-06-10 17:58:01 +02:00
|
|
|
// Ownership of this object lies with VideoReceiveStream, which owns |this|.
|
|
|
|
|
const VideoReceiveStream::Config& config_;
|
2016-04-25 01:26:26 -07:00
|
|
|
PacketRouter* const packet_router_;
|
2016-05-06 05:32:22 -07:00
|
|
|
ProcessThread* const process_thread_;
|
2016-03-02 15:05:53 +01:00
|
|
|
|
|
|
|
|
RemoteNtpTimeEstimator ntp_estimator_;
|
|
|
|
|
|
2017-09-25 10:47:00 +02:00
|
|
|
RtpHeaderExtensionMap rtp_header_extensions_;
|
Reland of Use RtxReceiveStream. (patchset #1 id:1 of https://codereview.webrtc.org/3007303002/ )
Reason for revert:
Identified a configuration problem in the video quality tests. Intend to fix and reland.
Original issue's description:
> Revert of Use RtxReceiveStream. (patchset #5 id:320001 of https://codereview.webrtc.org/3006063002/ )
>
> Reason for revert:
> This change appears to break ulpfec, with severe regressions, e.g., for webrtc_perf_test FullStackTest.ForemanCifPlr5Ulpfec
>
> Original issue's description:
> > Reland of Use RtxReceiveStream. (patchset #1 id:1 of https://codereview.webrtc.org/3010983002/ )
> >
> > Reason for revert:
> > Intend to fix perf failures and reland.
> >
> > Original issue's description:
> > > Revert of Use RtxReceiveStream. (patchset #5 id:80001 of https://codereview.webrtc.org/3008773002/ )
> > >
> > > Reason for revert:
> > > A few perf tests broken, including
> > >
> > > RampUpTest.UpDownUpAbsSendTimeSimulcastRedRtx
> > > RampUpTest.UpDownUpTransportSequenceNumberRtx
> > > RampUpTest.UpDownUpTransportSequenceNumberPacketLoss
> > >
> > >
> > > Original issue's description:
> > > > Use RtxReceiveStream.
> > > >
> > > > This also has the beneficial side-effect that when a media stream
> > > > which is protected by FlexFEC receives an RTX retransmission, the
> > > > retransmitted media packet is passed into the FlexFEC machinery,
> > > > which should improve its ability to recover packets via FEC.
> > > >
> > > > BUG=webrtc:7135
> > > >
> > > > Review-Url: https://codereview.webrtc.org/3008773002
> > > > Cr-Commit-Position: refs/heads/master@{#19649}
> > > > Committed: https://chromium.googlesource.com/external/webrtc/+/5c0f6c62ea3b1d2c43f8fc152961af27033475f7
> > >
> > > TBR=brandtr@webrtc.org,danilchap@webrtc.org,stefan@webrtc.org,magjed@webrtc.org
> > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > NOPRESUBMIT=true
> > > NOTREECHECKS=true
> > > NOTRY=true
> > > BUG=webrtc:7135
> > >
> > > Review-Url: https://codereview.webrtc.org/3010983002
> > > Cr-Commit-Position: refs/heads/master@{#19653}
> > > Committed: https://chromium.googlesource.com/external/webrtc/+/3c39c0137afa274d1d524b150b50304b38a2847b
> >
> > TBR=brandtr@webrtc.org,danilchap@webrtc.org,stefan@webrtc.org,magjed@webrtc.org
> > # Skipping CQ checks because original CL landed less than 1 days ago.
> > NOPRESUBMIT=true
> > NOTREECHECKS=true
> > BUG=webrtc:7135
> >
> > Review-Url: https://codereview.webrtc.org/3006063002
> > Cr-Commit-Position: refs/heads/master@{#19715}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/35713eaf565c0fef07c8afc158d7b8fdf7ec3d78
>
> TBR=brandtr@webrtc.org,danilchap@webrtc.org,stefan@webrtc.org,magjed@webrtc.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=webrtc:7135
>
> Review-Url: https://codereview.webrtc.org/3007303002
> Cr-Commit-Position: refs/heads/master@{#19744}
> Committed: https://chromium.googlesource.com/external/webrtc/+/8e7eee035178a7f10e19883681b5eaa4a7523107
TBR=brandtr@webrtc.org,danilchap@webrtc.org,stefan@webrtc.org,magjed@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7135
Review-Url: https://codereview.webrtc.org/3012963002
Cr-Commit-Position: refs/heads/master@{#19765}
2017-09-11 02:32:16 -07:00
|
|
|
ReceiveStatistics* const rtp_receive_statistics_;
|
2016-10-31 04:51:33 -07:00
|
|
|
std::unique_ptr<UlpfecReceiver> ulpfec_receiver_;
|
2014-04-24 22:10:24 +00:00
|
|
|
|
2019-04-09 13:44:04 +02:00
|
|
|
SequenceChecker worker_task_checker_;
|
2017-09-09 04:17:22 -07:00
|
|
|
bool receiving_ RTC_GUARDED_BY(worker_task_checker_);
|
|
|
|
|
int64_t last_packet_log_ms_ RTC_GUARDED_BY(worker_task_checker_);
|
2016-04-25 01:26:26 -07:00
|
|
|
|
|
|
|
|
const std::unique_ptr<RtpRtcp> rtp_rtcp_;
|
2016-11-15 00:57:57 -08:00
|
|
|
|
|
|
|
|
video_coding::OnCompleteFrameCallback* complete_frame_callback_;
|
2019-05-29 13:35:14 +02:00
|
|
|
KeyFrameRequestSender* const keyframe_request_sender_;
|
2019-05-31 13:25:50 +02:00
|
|
|
|
|
|
|
|
RtcpFeedbackBuffer rtcp_feedback_buffer_;
|
2016-11-15 00:57:57 -08:00
|
|
|
std::unique_ptr<NackModule> nack_module_;
|
2019-02-25 13:00:51 +01:00
|
|
|
std::unique_ptr<LossNotificationController> loss_notification_controller_;
|
2019-05-31 13:25:50 +02:00
|
|
|
|
2019-09-20 17:57:15 +02:00
|
|
|
video_coding::PacketBuffer packet_buffer_;
|
2019-10-30 14:12:24 +01:00
|
|
|
UniqueTimestampCounter frame_counter_ RTC_GUARDED_BY(worker_task_checker_);
|
2019-09-26 11:25:52 +02:00
|
|
|
|
|
|
|
|
rtc::CriticalSection reference_finder_lock_;
|
|
|
|
|
std::unique_ptr<video_coding::RtpFrameReferenceFinder> reference_finder_
|
|
|
|
|
RTC_GUARDED_BY(reference_finder_lock_);
|
|
|
|
|
absl::optional<VideoCodecType> current_codec_;
|
|
|
|
|
uint32_t last_assembled_frame_rtp_timestamp_;
|
|
|
|
|
|
2016-11-15 00:57:57 -08:00
|
|
|
rtc::CriticalSection last_seq_num_cs_;
|
2017-09-04 07:03:46 -07:00
|
|
|
std::map<int64_t, uint16_t> last_seq_num_for_pic_id_
|
2017-09-09 04:17:22 -07:00
|
|
|
RTC_GUARDED_BY(last_seq_num_cs_);
|
2016-11-15 00:57:57 -08:00
|
|
|
video_coding::H264SpsPpsTracker tracker_;
|
2018-08-09 16:16:34 +02:00
|
|
|
|
2019-05-23 13:21:12 +02:00
|
|
|
// Maps payload type to codec type, for packetization.
|
|
|
|
|
std::map<uint8_t, absl::optional<VideoCodecType>> payload_type_map_;
|
|
|
|
|
|
2016-12-20 04:15:59 -08:00
|
|
|
// TODO(johan): Remove pt_codec_params_ once
|
|
|
|
|
// https://bugs.chromium.org/p/webrtc/issues/detail?id=6883 is resolved.
|
|
|
|
|
// Maps a payload type to a map of out-of-band supplied codec parameters.
|
|
|
|
|
std::map<uint8_t, std::map<std::string, std::string>> pt_codec_params_;
|
|
|
|
|
int16_t last_payload_type_ = -1;
|
2017-05-16 08:06:30 -07:00
|
|
|
|
|
|
|
|
bool has_received_frame_;
|
2017-08-02 07:39:07 -07:00
|
|
|
|
2017-08-25 00:49:08 -07:00
|
|
|
std::vector<RtpPacketSinkInterface*> secondary_sinks_
|
2017-09-09 04:17:22 -07:00
|
|
|
RTC_GUARDED_BY(worker_task_checker_);
|
2018-09-26 16:04:32 +02:00
|
|
|
|
2019-06-25 10:16:14 +02:00
|
|
|
// Info for GetSyncInfo is updated on network or worker thread, and queried on
|
|
|
|
|
// the worker thread.
|
|
|
|
|
rtc::CriticalSection sync_info_lock_;
|
2018-09-26 16:04:32 +02:00
|
|
|
absl::optional<uint32_t> last_received_rtp_timestamp_
|
2019-06-25 10:16:14 +02:00
|
|
|
RTC_GUARDED_BY(sync_info_lock_);
|
2018-09-26 16:04:32 +02:00
|
|
|
absl::optional<int64_t> last_received_rtp_system_time_ms_
|
2019-06-25 10:16:14 +02:00
|
|
|
RTC_GUARDED_BY(sync_info_lock_);
|
2018-10-17 17:27:25 -07:00
|
|
|
|
2018-11-30 16:18:26 -08:00
|
|
|
// Used to validate the buffered frame decryptor is always run on the correct
|
|
|
|
|
// thread.
|
|
|
|
|
rtc::ThreadChecker network_tc_;
|
|
|
|
|
// Handles incoming encrypted frames and forwards them to the
|
|
|
|
|
// rtp_reference_finder if they are decryptable.
|
|
|
|
|
std::unique_ptr<BufferedFrameDecryptor> buffered_frame_decryptor_
|
|
|
|
|
RTC_PT_GUARDED_BY(network_tc_);
|
2019-03-01 11:01:59 -08:00
|
|
|
std::atomic<bool> frames_decryptable_;
|
2018-12-03 14:18:53 +01:00
|
|
|
absl::optional<ColorSpace> last_color_space_;
|
2019-09-26 11:25:52 +02:00
|
|
|
|
2019-11-12 15:20:21 +00:00
|
|
|
int64_t last_completed_picture_id_ = 0;
|
2011-07-07 08:21:25 +00:00
|
|
|
};
|
2011-11-28 22:39:24 +00:00
|
|
|
|
2015-11-26 15:24:52 +01:00
|
|
|
} // namespace webrtc
|
2011-11-28 22:39:24 +00:00
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // VIDEO_RTP_VIDEO_STREAM_RECEIVER_H_
|