https://github.com/w3c/webrtc-stats/pull/10/files added mediaType to the tracks. The closest in the current stats is the ssrc type.
This is somewhat easier than looking up the media type by iterating pc.getLocalStreams / pc.getRemoteStreams and all tracks. Temporary until stats get revamped to conform to the spec obviously.
BUG=webrtc:4117
Review URL: https://codereview.webrtc.org/1307633007
Cr-Commit-Position: refs/heads/master@{#11412}
diff --git a/talk/app/webrtc/statscollector_unittest.cc b/talk/app/webrtc/statscollector_unittest.cc
index e7ee911..b22a8fb 100644
--- a/talk/app/webrtc/statscollector_unittest.cc
+++ b/talk/app/webrtc/statscollector_unittest.cc
@@ -643,6 +643,10 @@
*reports, StatsReport::kStatsValueNameSsrc);
EXPECT_EQ(rtc::ToString<uint32_t>(kSsrcOfTrack), ssrc_id);
+ std::string media_type = ExtractSsrcStatsValue(*reports,
+ StatsReport::kStatsValueNameMediaType);
+ EXPECT_EQ("audio", media_type);
+
// Verifies the values in the track report.
if (voice_sender_info) {
UpdateVoiceSenderInfoFromAudioTrack(audio_track, voice_sender_info);
@@ -1032,6 +1036,10 @@
std::string track_id = ExtractSsrcStatsValue(
reports, StatsReport::kStatsValueNameTrackId);
EXPECT_EQ(kLocalTrackId, track_id);
+
+ std::string media_type = ExtractSsrcStatsValue(reports,
+ StatsReport::kStatsValueNameMediaType);
+ EXPECT_EQ("video", media_type);
}
// This test verifies that an SSRC object has the identifier of a Transport