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 6b8ea0f45da013ca768771e512f07eaf78082548..bf211f2adc5aa089fedb69d0e83ec71b6e7d3590 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> |
@@ -191,6 +192,8 @@ RtpVideoStreamReceiver::RtpVideoStreamReceiver( |
} |
RtpVideoStreamReceiver::~RtpVideoStreamReceiver() { |
+ RTC_DCHECK(secondary_sinks_.empty()); |
+ |
if (nack_module_) { |
process_thread_->DeRegisterModule(nack_module_.get()); |
} |
@@ -361,6 +364,29 @@ void RtpVideoStreamReceiver::OnRtpPacket(const RtpPacketReceived& packet) { |
rtp_receive_statistics_->IncomingPacket( |
header, packet.size(), IsPacketRetransmitted(header, in_order)); |
} |
+ |
+ for (auto* secondary_sink : secondary_sinks_) { |
+ secondary_sink->OnRtpPacket(packet); |
danilchap
2017/07/19 12:07:25
can recovered packet trigger secondary_sink? shoul
eladalon
2017/07/21 14:42:08
* This is in line with the behavior before this CL
|
+ } |
+} |
+ |
+void RtpVideoStreamReceiver::AddSecondarySink(RtpPacketSinkInterface* sink) { |
+ 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) { |
+ 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 (" << sink << ")."; |
+ return; |
+ } |
+ secondary_sinks_.erase(it); |
} |
int32_t RtpVideoStreamReceiver::RequestKeyFrame() { |