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

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

Issue 2542413002: Generalize FlexfecReceiveStream::Config. (CL1) (Closed)
Patch Set: Rebase. Created 4 years 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/call_unittest.cc ('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 std::string FlexfecReceiveStream::Config::ToString() const {
26 std::stringstream ss;
27 ss << "{payload_type: " << payload_type;
28 ss << ", remote_ssrc: " << remote_ssrc;
29 ss << ", local_ssrc: " << local_ssrc;
30 ss << ", protected_media_ssrcs: [";
31 size_t i = 0;
32 for (; i + 1 < protected_media_ssrcs.size(); ++i)
33 ss << protected_media_ssrcs[i] << ", ";
34 if (!protected_media_ssrcs.empty())
35 ss << protected_media_ssrcs[i];
36 ss << "], transport_cc: " << (transport_cc ? "on" : "off");
37 ss << ", extensions: [";
38 i = 0;
39 for (; i + 1 < extensions.size(); ++i)
40 ss << extensions[i].ToString() << ", ";
41 if (!extensions.empty())
42 ss << extensions[i].ToString();
43 ss << "]}";
44 return ss.str();
45 }
46
25 namespace { 47 namespace {
26 48
27 // TODO(brandtr): Update this function when we support multistream protection. 49 // TODO(brandtr): Update this function when we support multistream protection.
28 std::unique_ptr<FlexfecReceiver> MaybeCreateFlexfecReceiver( 50 std::unique_ptr<FlexfecReceiver> MaybeCreateFlexfecReceiver(
29 const FlexfecReceiveStream::Config& config, 51 const FlexfecReceiveStream::Config& config,
30 RecoveredPacketReceiver* recovered_packet_callback) { 52 RecoveredPacketReceiver* recovered_packet_callback) {
31 if (config.flexfec_payload_type < 0) { 53 if (config.payload_type < 0) {
32 LOG(LS_WARNING) << "Invalid FlexFEC payload type given. " 54 LOG(LS_WARNING) << "Invalid FlexFEC payload type given. "
33 << "This FlexfecReceiveStream will therefore be useless."; 55 << "This FlexfecReceiveStream will therefore be useless.";
34 return nullptr; 56 return nullptr;
35 } 57 }
36 RTC_DCHECK_GE(config.flexfec_payload_type, 0); 58 RTC_DCHECK_GE(config.payload_type, 0);
37 RTC_DCHECK_LE(config.flexfec_payload_type, 127); 59 RTC_DCHECK_LE(config.payload_type, 127);
38 if (config.flexfec_ssrc == 0) { 60 if (config.remote_ssrc == 0) {
39 LOG(LS_WARNING) << "Invalid FlexFEC SSRC given. " 61 LOG(LS_WARNING) << "Invalid FlexFEC SSRC given. "
40 << "This FlexfecReceiveStream will therefore be useless."; 62 << "This FlexfecReceiveStream will therefore be useless.";
41 return nullptr; 63 return nullptr;
42 } 64 }
43 if (config.protected_media_ssrcs.empty()) { 65 if (config.protected_media_ssrcs.empty()) {
44 LOG(LS_WARNING) << "No protected media SSRC supplied. " 66 LOG(LS_WARNING) << "No protected media SSRC supplied. "
45 << "This FlexfecReceiveStream will therefore be useless."; 67 << "This FlexfecReceiveStream will therefore be useless.";
46 return nullptr; 68 return nullptr;
47 } 69 }
48 70
49 if (config.protected_media_ssrcs.size() > 1) { 71 if (config.protected_media_ssrcs.size() > 1) {
50 LOG(LS_WARNING) 72 LOG(LS_WARNING)
51 << "The supplied FlexfecConfig contained multiple protected " 73 << "The supplied FlexfecConfig contained multiple protected "
52 "media streams, but our implementation currently only " 74 "media streams, but our implementation currently only "
53 "supports protecting a single media stream. " 75 "supports protecting a single media stream. "
54 "To avoid confusion, disabling FlexFEC completely."; 76 "To avoid confusion, disabling FlexFEC completely.";
55 return nullptr; 77 return nullptr;
56 } 78 }
57 RTC_DCHECK_EQ(1U, config.protected_media_ssrcs.size()); 79 RTC_DCHECK_EQ(1U, config.protected_media_ssrcs.size());
58 return std::unique_ptr<FlexfecReceiver>( 80 return std::unique_ptr<FlexfecReceiver>(
59 new FlexfecReceiver(config.flexfec_ssrc, config.protected_media_ssrcs[0], 81 new FlexfecReceiver(config.remote_ssrc, config.protected_media_ssrcs[0],
60 recovered_packet_callback)); 82 recovered_packet_callback));
61 } 83 }
62 84
63 } // namespace 85 } // namespace
64 86
65 namespace internal { 87 namespace internal {
66 88
67 FlexfecReceiveStream::FlexfecReceiveStream( 89 FlexfecReceiveStream::FlexfecReceiveStream(
68 const Config& config, 90 const Config& config,
69 RecoveredPacketReceiver* recovered_packet_callback) 91 RecoveredPacketReceiver* recovered_packet_callback)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 125
104 // TODO(brandtr): Implement this member function when we have designed the 126 // TODO(brandtr): Implement this member function when we have designed the
105 // stats for FlexFEC. 127 // stats for FlexFEC.
106 FlexfecReceiveStream::Stats FlexfecReceiveStream::GetStats() const { 128 FlexfecReceiveStream::Stats FlexfecReceiveStream::GetStats() const {
107 return webrtc::FlexfecReceiveStream::Stats(); 129 return webrtc::FlexfecReceiveStream::Stats();
108 } 130 }
109 131
110 } // namespace internal 132 } // namespace internal
111 133
112 } // namespace webrtc 134 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/call/call_unittest.cc ('k') | webrtc/call/flexfec_receive_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698