Index: webrtc/call/flexfec_receive_stream.cc |
diff --git a/webrtc/call/flexfec_receive_stream.cc b/webrtc/call/flexfec_receive_stream.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..dccb9f2db02d5de700af06e0193e22832f19903a |
--- /dev/null |
+++ b/webrtc/call/flexfec_receive_stream.cc |
@@ -0,0 +1,70 @@ |
+/* |
+ * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
+ * |
+ * 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. |
+ */ |
+ |
+#include "webrtc/call/flexfec_receive_stream.h" |
+ |
+#include "webrtc/base/logging.h" |
+ |
+namespace webrtc { |
+ |
+std::string FlexfecReceiveStream::Stats::ToString(int64_t time_ms) const { |
+ std::stringstream ss; |
+ ss << "FlexfecReceiveStream stats: " << time_ms |
+ << ", {flexfec_bitrate_bps: " << flexfec_bitrate_bps << "}"; |
+ return ss.str(); |
+} |
+ |
+namespace internal { |
+ |
+FlexfecReceiveStream::FlexfecReceiveStream( |
+ Config configuration, |
+ RecoveredPacketReceiver* recovered_packet_callback) |
+ : config_(configuration), |
+ recovered_packet_callback_(recovered_packet_callback), |
+ receiver_(FlexfecReceiver::Create(config_.flexfec_ssrc, |
+ config_.protected_media_ssrc, |
+ recovered_packet_callback_)) { |
+ LOG(LS_INFO) << "FlexfecReceiveStream: " << config_.ToString(); |
+} |
+ |
+FlexfecReceiveStream::~FlexfecReceiveStream() { |
+ LOG(LS_INFO) << "~FlexfecReceiveStream: " << config_.ToString(); |
+ Stop(); |
+} |
+ |
+bool FlexfecReceiveStream::AddAndProcessReceivedPacket(const uint8_t* packet, |
+ size_t packet_length) { |
+ { |
+ rtc::CritScope cs(&crit_); |
+ if (!started_) |
+ return false; |
+ } |
+ return receiver_->AddAndProcessReceivedPacket(packet, packet_length); |
+} |
+ |
+void FlexfecReceiveStream::Start() { |
+ rtc::CritScope cs(&crit_); |
+ started_ = true; |
+} |
+ |
+void FlexfecReceiveStream::Stop() { |
+ rtc::CritScope cs(&crit_); |
+ started_ = false; |
+} |
+ |
+// TODO(brandtr): Implement this member function when we have designed the |
+// stats for FlexFEC. |
+FlexfecReceiveStream::Stats FlexfecReceiveStream::GetStats() const { |
+ return webrtc::FlexfecReceiveStream::Stats(); |
+} |
+ |
+} // namespace internal |
+ |
+} // namespace webrtc |