Add DEPRECATED prefix to track stats IDs.

There's no way to add a deprecation warning unique to using
RTCMediaStreamTrackStats, but we could signal to users that it is
deprecated by adding "DEPRECATED_" to its ID.

This could break apps with hardcoded assumptions about what the stats
IDs are, but apps doing this are using the API incorrectly anyway, so
if anyone is affected by this change that would be a good time to
remove any dependency on this (see https://crbug.com/webrtc/10656
regading the fact that IDs should be unpredictable).

Bug: webrtc:14175
Change-Id: I6242c4efc08e9570420c00af5aaf491b1af819f1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/269004
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37595}
This commit is contained in:
Henrik Boström
2022-07-21 10:56:52 +02:00
committed by WebRTC LUCI CQ
parent 082d270b31
commit a5cc0accfb
2 changed files with 5 additions and 5 deletions

View File

@ -97,7 +97,7 @@ std::string RTCMediaStreamTrackStatsIDFromDirectionAndAttachment(
int attachment_id) {
char buf[1024];
rtc::SimpleStringBuilder sb(buf);
sb << "RTCMediaStreamTrack_" << direction << "_" << attachment_id;
sb << "DEPRECATED_RTCMediaStreamTrack_" << direction << "_" << attachment_id;
return sb.str();
}

View File

@ -740,12 +740,12 @@ class RTCStatsCollectorTest : public ::testing::Test {
// track (sender)
graph.sender = stats_->SetupLocalTrackAndSender(
cricket::MEDIA_TYPE_VIDEO, "LocalVideoTrackID", 3, false, 50);
graph.sender_track_id = "RTCMediaStreamTrack_sender_" +
graph.sender_track_id = "DEPRECATED_RTCMediaStreamTrack_sender_" +
rtc::ToString(graph.sender->AttachmentId());
// track (receiver) and stream (remote stream)
graph.receiver = stats_->SetupRemoteTrackAndReceiver(
cricket::MEDIA_TYPE_VIDEO, "RemoteVideoTrackID", "RemoteStreamId", 4);
graph.receiver_track_id = "RTCMediaStreamTrack_receiver_" +
graph.receiver_track_id = "DEPRECATED_RTCMediaStreamTrack_receiver_" +
rtc::ToString(graph.receiver->AttachmentId());
graph.remote_stream_id = "RTCMediaStream_RemoteStreamId";
// peer-connection
@ -853,13 +853,13 @@ class RTCStatsCollectorTest : public ::testing::Test {
// track (sender)
graph.sender = stats_->SetupLocalTrackAndSender(
cricket::MEDIA_TYPE_AUDIO, "LocalAudioTrackID", kLocalSsrc, false, 50);
graph.sender_track_id = "RTCMediaStreamTrack_sender_" +
graph.sender_track_id = "DEPRECATED_RTCMediaStreamTrack_sender_" +
rtc::ToString(graph.sender->AttachmentId());
// track (receiver) and stream (remote stream)
graph.receiver = stats_->SetupRemoteTrackAndReceiver(
cricket::MEDIA_TYPE_AUDIO, "RemoteAudioTrackID", "RemoteStreamId",
kRemoteSsrc);
graph.receiver_track_id = "RTCMediaStreamTrack_receiver_" +
graph.receiver_track_id = "DEPRECATED_RTCMediaStreamTrack_receiver_" +
rtc::ToString(graph.receiver->AttachmentId());
graph.remote_stream_id = "RTCMediaStream_RemoteStreamId";
// peer-connection