Skip to content

Commit

Permalink
Update implementations of webrtc::SetSessionDescriptionObserver to us…
Browse files Browse the repository at this point in the history
…e the new OnComplete signature.

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

Cr-Commit-Position: refs/heads/master@{#291658}
  • Loading branch information
tommi authored and Commit bot committed Aug 25, 2014
1 parent da32488 commit 91a3607
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
6 changes: 3 additions & 3 deletions content/renderer/media/mock_peer_connection_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ bool MockPeerConnectionImpl::GetStats(
webrtc::StatsReport::kStatsValueNameFingerprint,
"trackvalue"));

std::vector<webrtc::StatsReport> reports;
reports.push_back(report1);
webrtc::StatsReports reports;
reports.push_back(&report1);

// If selector is given, we pass back one report.
// If selector is not given, we pass back two.
Expand All @@ -291,7 +291,7 @@ bool MockPeerConnectionImpl::GetStats(
webrtc::StatsReport::Value(
webrtc::StatsReport::kStatsValueNameFingerprintAlgorithm,
"somevalue"));
reports.push_back(report2);
reports.push_back(&report2);
}

// Note that the callback is synchronous, not asynchronous; it will
Expand Down
23 changes: 11 additions & 12 deletions content/renderer/media/rtc_peer_connection_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
#include "third_party/WebKit/public/platform/WebRTCVoidRequest.h"
#include "third_party/WebKit/public/platform/WebURL.h"

using webrtc::StatsReport;
using webrtc::StatsReports;

namespace content {

// Converter functions from libjingle types to WebKit types.
Expand Down Expand Up @@ -255,13 +258,12 @@ class StatsResponse : public webrtc::StatsObserver {
TRACE_EVENT_ASYNC_BEGIN0("webrtc", "getStats_Native", this);
}

virtual void OnComplete(
const std::vector<webrtc::StatsReport>& reports) OVERRIDE {
virtual void OnComplete(const StatsReports& reports) OVERRIDE {
TRACE_EVENT0("webrtc", "StatsResponse::OnComplete")
for (std::vector<webrtc::StatsReport>::const_iterator it = reports.begin();
for (StatsReports::const_iterator it = reports.begin();
it != reports.end(); ++it) {
if (it->values.size() > 0) {
AddReport(*it);
if ((*it)->values.size() > 0) {
AddReport(*(*it));
}
}

Expand All @@ -274,12 +276,11 @@ class StatsResponse : public webrtc::StatsObserver {
}

private:
void AddReport(const webrtc::StatsReport& report) {
void AddReport(const StatsReport& report) {
int idx = response_->addReport(blink::WebString::fromUTF8(report.id),
blink::WebString::fromUTF8(report.type),
report.timestamp);
for (webrtc::StatsReport::Values::const_iterator value_it =
report.values.begin();
for (StatsReport::Values::const_iterator value_it = report.values.begin();
value_it != report.values.end(); ++value_it) {
AddStatistic(idx, value_it->display_name(), value_it->value);
}
Expand Down Expand Up @@ -758,8 +759,7 @@ void RTCPeerConnectionHandler::getStats(LocalRTCStatsRequest* request) {
if (!track) {
DVLOG(1) << "GetStats: Track not found.";
// TODO(hta): Consider how to get an error back.
std::vector<webrtc::StatsReport> no_reports;
observer->OnComplete(no_reports);
observer->OnComplete(StatsReports());
return;
}
}
Expand All @@ -776,8 +776,7 @@ void RTCPeerConnectionHandler::GetStats(
if (!native_peer_connection_->GetStats(observer, track, level)) {
DVLOG(1) << "GetStats failed.";
// TODO(hta): Consider how to get an error back.
std::vector<webrtc::StatsReport> no_reports;
observer->OnComplete(no_reports);
observer->OnComplete(StatsReports());
return;
}
}
Expand Down

0 comments on commit 91a3607

Please sign in to comment.