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

Side by Side Diff: webrtc/call/flexfec_receive_stream.cc

Issue 2397843005: Add FlexfecReceiveStream. (Closed)
Patch Set: Add FlexfecReceiveStream. Created 4 years, 2 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 unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "webrtc/call/flexfec_receive_stream.h"
12
13 #include "webrtc/base/logging.h"
14
15 namespace webrtc {
16
17 std::string FlexfecReceiveStream::Stats::ToString(int64_t time_ms) const {
18 std::stringstream ss;
19 ss << "FlexfecReceiveStream stats: " << time_ms
20 << ", {flexfec_bitrate_bps: " << flexfec_bitrate_bps << "}";
21 return ss.str();
22 }
23
24 namespace internal {
25
26 FlexfecReceiveStream::FlexfecReceiveStream(
27 Config configuration,
28 RecoveredPacketReceiver* recovered_packet_callback)
29 : config_(configuration),
30 recovered_packet_callback_(recovered_packet_callback),
31 receiver_(FlexfecReceiver::Create(config_.flexfec_ssrc,
32 config_.protected_media_ssrc,
33 recovered_packet_callback_)) {
34 LOG(LS_INFO) << "FlexfecReceiveStream: " << config_.ToString();
35 }
36
37 FlexfecReceiveStream::~FlexfecReceiveStream() {
38 LOG(LS_INFO) << "~FlexfecReceiveStream: " << config_.ToString();
39 Stop();
40 }
41
42 bool FlexfecReceiveStream::AddAndProcessReceivedPacket(const uint8_t* packet,
43 size_t packet_length) {
44 {
45 rtc::CritScope cs(&crit_);
46 if (!started_)
47 return false;
48 }
49 return receiver_->AddAndProcessReceivedPacket(packet, packet_length);
50 }
51
52 void FlexfecReceiveStream::Start() {
53 rtc::CritScope cs(&crit_);
54 started_ = true;
55 }
56
57 void FlexfecReceiveStream::Stop() {
58 rtc::CritScope cs(&crit_);
59 started_ = false;
60 }
61
62 // TODO(brandtr): Implement this member function when we have designed the
63 // stats for FlexFEC.
64 FlexfecReceiveStream::Stats FlexfecReceiveStream::GetStats() const {
65 return webrtc::FlexfecReceiveStream::Stats();
66 }
67
68 } // namespace internal
69
70 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698