Commit 40cb6e8a authored by tommi@chromium.org's avatar tommi@chromium.org

Clean up code a bit in MockPeerConnectionImpl. This addresses an issue in...

Clean up code a bit in MockPeerConnectionImpl. This addresses an issue in non-clang builds on ubuntu 12.04 using gcc 4.6.4 which has been in there for a while now:

The error is as follows:

../../content/renderer/media/mock_peer_connection_impl.cc: In member function
'virtual bool content::MockPeerConnectionImpl::GetStats(webrtc::StatsObserver*,
webrtc::MediaStreamTrackInterface*,
webrtc::PeerConnectionInterface::StatsOutputLevel)':
../../content/renderer/media/mock_peer_connection_impl.cc:280:3: error: in C++98
'value' must be initialized by constructor, not by '{...}'
../../content/renderer/media/mock_peer_connection_impl.cc:293:5: error: in C++98
'value2' must be initialized by constructor, not by '{...}'

R=xians@chromium.org

Review URL: https://codereview.chromium.org/415403002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285547 0039d316-1c4b-4281-b951-d872f2087c98
parent ddfd5dea
...@@ -269,33 +269,35 @@ bool MockPeerConnectionImpl::GetStats( ...@@ -269,33 +269,35 @@ bool MockPeerConnectionImpl::GetStats(
return false; return false;
DCHECK_EQ(kStatsOutputLevelStandard, level); DCHECK_EQ(kStatsOutputLevelStandard, level);
std::vector<webrtc::StatsReport> reports(track ? 1 : 2); webrtc::StatsReport report1, report2;
webrtc::StatsReport& report = reports[0]; report1.id = "1234";
report.id = "1234"; report1.type = "ssrc";
report.type = "ssrc"; report1.timestamp = 42;
report.timestamp = 42; report1.values.push_back(
webrtc::StatsReport::Value value = { webrtc::StatsReport::Value(
webrtc::StatsReport::kStatsValueNameFingerprint, webrtc::StatsReport::kStatsValueNameFingerprint,
"trackvalue" "trackvalue"));
};
report.values.push_back(value); std::vector<webrtc::StatsReport> reports;
reports.push_back(report1);
// If selector is given, we pass back one report. // If selector is given, we pass back one report.
// If selector is not given, we pass back two. // If selector is not given, we pass back two.
if (!track) { if (!track) {
webrtc::StatsReport& report2 = reports[1];
report2.id = "nontrack"; report2.id = "nontrack";
report2.type = "generic"; report2.type = "generic";
report2.timestamp = 44; report2.timestamp = 44;
report2.values.push_back(value); report2.values.push_back(
webrtc::StatsReport::Value value2 = { webrtc::StatsReport::Value(
webrtc::StatsReport::kStatsValueNameFingerprintAlgorithm, webrtc::StatsReport::kStatsValueNameFingerprintAlgorithm,
"somevalue" "somevalue"));
}; reports.push_back(report2);
report2.values.push_back(value2);
} }
// Note that the callback is synchronous, not asynchronous; it will // Note that the callback is synchronous, not asynchronous; it will
// happen before the request call completes. // happen before the request call completes.
observer->OnComplete(reports); observer->OnComplete(reports);
return true; return true;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment