Return false if PeerConnection::GetStats() is called on invalid tracks

Before calling StatsCollctor::GetStats() in PeerConnection::GetStats(), check if the track is valid. If not, return false.
A track is invalid if it is not a nullptr and there is no report data for it.

BUG=webrtc:6652

Review-Url: https://codereview.webrtc.org/2470023004
Cr-Commit-Position: refs/heads/master@{#14934}
This commit is contained in:
zhihuang
2016-11-04 11:38:15 -07:00
committed by Commit bot
parent 3326d0ac82
commit e9e94c3fee
4 changed files with 16 additions and 4 deletions

View File

@ -1577,10 +1577,7 @@ TEST_F(PeerConnectionInterfaceTest, GetStatsForVideoTrack) {
}
// Test that we don't get statistics for an invalid track.
// TODO(tommi): Fix this test. DoGetStats will return true
// for the unknown track (since GetStats is async), but no
// data is returned for the track.
TEST_F(PeerConnectionInterfaceTest, DISABLED_GetStatsForInvalidTrack) {
TEST_F(PeerConnectionInterfaceTest, GetStatsForInvalidTrack) {
InitiateCall();
rtc::scoped_refptr<AudioTrackInterface> unknown_audio_track(
pc_factory_->CreateAudioTrack("unknown track", NULL));