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

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

Issue 2499963002: Make configuration logic harsher in FlexfecReceiveStream. (Closed)
Patch Set: Feedback response 1. Created 4 years, 1 month 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
« no previous file with comments | « webrtc/call/flexfec_receive_stream.h ('k') | webrtc/call/flexfec_receive_stream_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/call/flexfec_receive_stream.h" 11 #include "webrtc/call/flexfec_receive_stream.h"
12 12
13 #include "webrtc/base/checks.h" 13 #include "webrtc/base/checks.h"
14 #include "webrtc/base/logging.h" 14 #include "webrtc/base/logging.h"
15 15
16 namespace webrtc { 16 namespace webrtc {
17 17
18 std::string FlexfecReceiveStream::Stats::ToString(int64_t time_ms) const { 18 std::string FlexfecReceiveStream::Stats::ToString(int64_t time_ms) const {
19 std::stringstream ss; 19 std::stringstream ss;
20 ss << "FlexfecReceiveStream stats: " << time_ms 20 ss << "FlexfecReceiveStream stats: " << time_ms
21 << ", {flexfec_bitrate_bps: " << flexfec_bitrate_bps << "}"; 21 << ", {flexfec_bitrate_bps: " << flexfec_bitrate_bps << "}";
22 return ss.str(); 22 return ss.str();
23 } 23 }
24 24
25 namespace { 25 namespace {
26 26
27 // TODO(brandtr): Update this function when we support multistream protection. 27 // TODO(brandtr): Update this function when we support multistream protection.
28 std::unique_ptr<FlexfecReceiver> MaybeUpdateConfigAndCreateFlexfecReceiver( 28 std::unique_ptr<FlexfecReceiver> MaybeCreateFlexfecReceiver(
29 FlexfecReceiveStream::Config* config, 29 const FlexfecReceiveStream::Config& config,
30 RecoveredPacketReceiver* recovered_packet_callback) { 30 RecoveredPacketReceiver* recovered_packet_callback) {
31 if (config->protected_media_ssrcs.empty()) { 31 if (config.flexfec_payload_type < 0) {
32 LOG(LS_ERROR) << "Invalid FlexFEC payload type given. "
33 << "This FlexfecReceiveStream will therefore be useless.";
34 return nullptr;
35 }
36 RTC_DCHECK_GE(config.flexfec_payload_type, 0);
37 RTC_DCHECK_LE(config.flexfec_payload_type, 127);
38 if (config.flexfec_ssrc == 0) {
39 LOG(LS_ERROR) << "Invalid FlexFEC SSRC given. "
40 << "This FlexfecReceiveStream will therefore be useless.";
41 return nullptr;
42 }
43 if (config.protected_media_ssrcs.empty()) {
32 LOG(LS_ERROR) << "No protected media SSRC supplied. " 44 LOG(LS_ERROR) << "No protected media SSRC supplied. "
33 << "This FlexfecReceiveStream will therefore be useless."; 45 << "This FlexfecReceiveStream will therefore be useless.";
34 return nullptr; 46 return nullptr;
35 } else if (config->protected_media_ssrcs.size() > 1) { 47 }
48
49 if (config.protected_media_ssrcs.size() > 1) {
36 LOG(LS_WARNING) 50 LOG(LS_WARNING)
terelius 2016/11/15 10:01:58 Should this be LS_ERROR?
brandtr 2016/11/15 10:28:14 Changed all to be WARNINGs, as per offline discuss
37 << "The supplied FlexfecConfig contained multiple protected " 51 << "The supplied FlexfecConfig contained multiple protected "
38 "media streams, but our implementation currently only " 52 "media streams, but our implementation currently only "
39 "supports protecting a single media stream. This " 53 "supports protecting a single media stream. "
40 "FlexfecReceiveStream will therefore only accept media " 54 "To avoid confusion, disabling FlexFEC completely.";
41 "packets from the first supplied media stream, with SSRC " 55 return nullptr;
42 << config->protected_media_ssrcs[0] << ".";
43 config->protected_media_ssrcs.resize(1);
44 } 56 }
57 RTC_DCHECK_EQ(1U, config.protected_media_ssrcs.size());
45 return std::unique_ptr<FlexfecReceiver>(new FlexfecReceiver( 58 return std::unique_ptr<FlexfecReceiver>(new FlexfecReceiver(
46 config->flexfec_ssrc, config->protected_media_ssrcs[0], 59 config.flexfec_ssrc, config.protected_media_ssrcs[0],
47 recovered_packet_callback)); 60 recovered_packet_callback));
48 } 61 }
49 62
50 } // namespace 63 } // namespace
51 64
52 namespace internal { 65 namespace internal {
53 66
54 FlexfecReceiveStream::FlexfecReceiveStream( 67 FlexfecReceiveStream::FlexfecReceiveStream(
55 Config configuration, 68 Config configuration,
56 RecoveredPacketReceiver* recovered_packet_callback) 69 RecoveredPacketReceiver* recovered_packet_callback)
57 : started_(false), 70 : started_(false),
58 config_(configuration), 71 config_(configuration),
59 receiver_(MaybeUpdateConfigAndCreateFlexfecReceiver( 72 receiver_(MaybeCreateFlexfecReceiver(
60 &config_, 73 config_,
61 recovered_packet_callback)) { 74 recovered_packet_callback)) {
62 LOG(LS_INFO) << "FlexfecReceiveStream: " << config_.ToString(); 75 LOG(LS_INFO) << "FlexfecReceiveStream: " << config_.ToString();
63 } 76 }
64 77
65 FlexfecReceiveStream::~FlexfecReceiveStream() { 78 FlexfecReceiveStream::~FlexfecReceiveStream() {
66 LOG(LS_INFO) << "~FlexfecReceiveStream: " << config_.ToString(); 79 LOG(LS_INFO) << "~FlexfecReceiveStream: " << config_.ToString();
67 Stop(); 80 Stop();
68 } 81 }
69 82
70 bool FlexfecReceiveStream::AddAndProcessReceivedPacket(const uint8_t* packet, 83 bool FlexfecReceiveStream::AddAndProcessReceivedPacket(const uint8_t* packet,
(...skipping 20 matching lines...) Expand all
91 104
92 // TODO(brandtr): Implement this member function when we have designed the 105 // TODO(brandtr): Implement this member function when we have designed the
93 // stats for FlexFEC. 106 // stats for FlexFEC.
94 FlexfecReceiveStream::Stats FlexfecReceiveStream::GetStats() const { 107 FlexfecReceiveStream::Stats FlexfecReceiveStream::GetStats() const {
95 return webrtc::FlexfecReceiveStream::Stats(); 108 return webrtc::FlexfecReceiveStream::Stats();
96 } 109 }
97 110
98 } // namespace internal 111 } // namespace internal
99 112
100 } // namespace webrtc 113 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/call/flexfec_receive_stream.h ('k') | webrtc/call/flexfec_receive_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698