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

Side by Side Diff: content/renderer/media/mock_peer_connection_impl.cc

Issue 415403002: Clean up code a bit in MockPeerConnectionImpl. This addresses an issue in non-clang builds on ubunt… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/mock_peer_connection_impl.h" 5 #include "content/renderer/media/mock_peer_connection_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "content/renderer/media/webrtc/mock_peer_connection_dependency_factory. h" 10 #include "content/renderer/media/webrtc/mock_peer_connection_dependency_factory. h"
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 } 262 }
263 263
264 bool MockPeerConnectionImpl::GetStats( 264 bool MockPeerConnectionImpl::GetStats(
265 webrtc::StatsObserver* observer, 265 webrtc::StatsObserver* observer,
266 webrtc::MediaStreamTrackInterface* track, 266 webrtc::MediaStreamTrackInterface* track,
267 StatsOutputLevel level) { 267 StatsOutputLevel level) {
268 if (!getstats_result_) 268 if (!getstats_result_)
269 return false; 269 return false;
270 270
271 DCHECK_EQ(kStatsOutputLevelStandard, level); 271 DCHECK_EQ(kStatsOutputLevelStandard, level);
272 std::vector<webrtc::StatsReport> reports(track ? 1 : 2); 272 webrtc::StatsReport report1, report2;
273 webrtc::StatsReport& report = reports[0]; 273 report1.id = "1234";
274 report.id = "1234"; 274 report1.type = "ssrc";
275 report.type = "ssrc"; 275 report1.timestamp = 42;
276 report.timestamp = 42; 276 report1.values.push_back(
277 webrtc::StatsReport::Value value = { 277 webrtc::StatsReport::Value(
278 webrtc::StatsReport::kStatsValueNameFingerprint, 278 webrtc::StatsReport::kStatsValueNameFingerprint,
279 "trackvalue" 279 "trackvalue"));
280 }; 280
281 report.values.push_back(value); 281 std::vector<webrtc::StatsReport> reports;
282 reports.push_back(report1);
283
282 // If selector is given, we pass back one report. 284 // If selector is given, we pass back one report.
283 // If selector is not given, we pass back two. 285 // If selector is not given, we pass back two.
284 if (!track) { 286 if (!track) {
285 webrtc::StatsReport& report2 = reports[1];
286 report2.id = "nontrack"; 287 report2.id = "nontrack";
287 report2.type = "generic"; 288 report2.type = "generic";
288 report2.timestamp = 44; 289 report2.timestamp = 44;
289 report2.values.push_back(value); 290 report2.values.push_back(
290 webrtc::StatsReport::Value value2 = { 291 webrtc::StatsReport::Value(
291 webrtc::StatsReport::kStatsValueNameFingerprintAlgorithm, 292 webrtc::StatsReport::kStatsValueNameFingerprintAlgorithm,
292 "somevalue" 293 "somevalue"));
293 }; 294 reports.push_back(report2);
294 report2.values.push_back(value2);
295 } 295 }
296
296 // Note that the callback is synchronous, not asynchronous; it will 297 // Note that the callback is synchronous, not asynchronous; it will
297 // happen before the request call completes. 298 // happen before the request call completes.
298 observer->OnComplete(reports); 299 observer->OnComplete(reports);
300
299 return true; 301 return true;
300 } 302 }
301 303
302 const webrtc::SessionDescriptionInterface* 304 const webrtc::SessionDescriptionInterface*
303 MockPeerConnectionImpl::local_description() const { 305 MockPeerConnectionImpl::local_description() const {
304 return local_desc_.get(); 306 return local_desc_.get();
305 } 307 }
306 308
307 const webrtc::SessionDescriptionInterface* 309 const webrtc::SessionDescriptionInterface*
308 MockPeerConnectionImpl::remote_description() const { 310 MockPeerConnectionImpl::remote_description() const {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 sdp_mline_index_ = candidate->sdp_mline_index(); 359 sdp_mline_index_ = candidate->sdp_mline_index();
358 return candidate->ToString(&ice_sdp_); 360 return candidate->ToString(&ice_sdp_);
359 } 361 }
360 362
361 void MockPeerConnectionImpl::RegisterUMAObserver( 363 void MockPeerConnectionImpl::RegisterUMAObserver(
362 webrtc::UMAObserver* observer) { 364 webrtc::UMAObserver* observer) {
363 NOTIMPLEMENTED(); 365 NOTIMPLEMENTED();
364 } 366 }
365 367
366 } // namespace content 368 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698