Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Unified Diff: webrtc/video/rtp_video_stream_receiver.cc

Issue 2974453002: Protected streams report RTP messages directly to the FlexFec streams (Closed)
Patch Set: Appease lint. Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/video/rtp_video_stream_receiver.h ('k') | webrtc/video/rtp_video_stream_receiver_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video/rtp_video_stream_receiver.cc
diff --git a/webrtc/video/rtp_video_stream_receiver.cc b/webrtc/video/rtp_video_stream_receiver.cc
index ae19d90e1a98f36cb9653abc0521a28779a6792e..66df339efe05f050d2cabbd955c9694917019588 100644
--- a/webrtc/video/rtp_video_stream_receiver.cc
+++ b/webrtc/video/rtp_video_stream_receiver.cc
@@ -10,6 +10,7 @@
#include "webrtc/video/rtp_video_stream_receiver.h"
+#include <algorithm>
#include <utility>
#include <vector>
@@ -192,6 +193,8 @@ RtpVideoStreamReceiver::RtpVideoStreamReceiver(
}
RtpVideoStreamReceiver::~RtpVideoStreamReceiver() {
+ RTC_DCHECK(secondary_sinks_.empty());
+
if (nack_module_) {
process_thread_->DeRegisterModule(nack_module_.get());
}
@@ -309,6 +312,9 @@ int32_t RtpVideoStreamReceiver::OnInitializeDecoder(
// This method handles both regular RTP packets and packets recovered
// via FlexFEC.
void RtpVideoStreamReceiver::OnRtpPacket(const RtpPacketReceived& packet) {
+ // TODO(eladalon): https://bugs.chromium.org/p/webrtc/issues/detail?id=8056
+ // RTC_DCHECK_RUN_ON(&worker_thread_checker_);
+
{
rtc::CritScope lock(&receive_cs_);
if (!receiving_) {
@@ -362,6 +368,10 @@ void RtpVideoStreamReceiver::OnRtpPacket(const RtpPacketReceived& packet) {
rtp_receive_statistics_->IncomingPacket(
header, packet.size(), IsPacketRetransmitted(header, in_order));
}
+
+ for (RtpPacketSinkInterface* secondary_sink : secondary_sinks_) {
+ secondary_sink->OnRtpPacket(packet);
+ }
}
int32_t RtpVideoStreamReceiver::RequestKeyFrame() {
@@ -429,6 +439,29 @@ rtc::Optional<int64_t> RtpVideoStreamReceiver::LastReceivedKeyframePacketMs()
return packet_buffer_->LastReceivedKeyframePacketMs();
}
+void RtpVideoStreamReceiver::AddSecondarySink(RtpPacketSinkInterface* sink) {
+ // TODO(eladalon): https://bugs.chromium.org/p/webrtc/issues/detail?id=8056
+ // RTC_DCHECK_RUN_ON(&worker_thread_checker_);
+ RTC_DCHECK(std::find(secondary_sinks_.cbegin(), secondary_sinks_.cend(),
+ sink) == secondary_sinks_.cend());
+ secondary_sinks_.push_back(sink);
+}
+
+void RtpVideoStreamReceiver::RemoveSecondarySink(
+ const RtpPacketSinkInterface* sink) {
+ // TODO(eladalon): https://bugs.chromium.org/p/webrtc/issues/detail?id=8056
+ // RTC_DCHECK_RUN_ON(&worker_thread_checker_);
+ auto it = std::find(secondary_sinks_.begin(), secondary_sinks_.end(), sink);
+ if (it == secondary_sinks_.end()) {
+ // We might be rolling-back a call whose setup failed mid-way. In such a
+ // case, it's simpler to remove "everything" rather than remember what
+ // has already been added.
+ LOG(LS_WARNING) << "Removal of unknown sink.";
+ return;
+ }
+ secondary_sinks_.erase(it);
+}
+
void RtpVideoStreamReceiver::ReceivePacket(const uint8_t* packet,
size_t packet_length,
const RTPHeader& header,
« no previous file with comments | « webrtc/video/rtp_video_stream_receiver.h ('k') | webrtc/video/rtp_video_stream_receiver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698