OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/webrtc/media_stream_track_metrics.h" | 5 #include "content/renderer/media/webrtc/media_stream_track_metrics.h" |
6 | 6 |
7 #include <inttypes.h> | 7 #include <inttypes.h> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 pc_id, | 382 pc_id, |
383 track_id.c_str(), | 383 track_id.c_str(), |
384 stream_type == RECEIVED_STREAM ? 1 : 0); | 384 stream_type == RECEIVED_STREAM ? 1 : 0); |
385 | 385 |
386 base::MD5Context ctx; | 386 base::MD5Context ctx; |
387 base::MD5Init(&ctx); | 387 base::MD5Init(&ctx); |
388 base::MD5Update(&ctx, unique_id_string); | 388 base::MD5Update(&ctx, unique_id_string); |
389 base::MD5Digest digest; | 389 base::MD5Digest digest; |
390 base::MD5Final(&digest, &ctx); | 390 base::MD5Final(&digest, &ctx); |
391 | 391 |
392 COMPILE_ASSERT(sizeof(digest.a) > sizeof(uint64), NeedBiggerDigest); | 392 static_assert(sizeof(digest.a) > sizeof(uint64), "need a bigger digest"); |
393 return *reinterpret_cast<uint64*>(digest.a); | 393 return *reinterpret_cast<uint64*>(digest.a); |
394 } | 394 } |
395 | 395 |
396 uint64 MediaStreamTrackMetrics::MakeUniqueId(const std::string& track_id, | 396 uint64 MediaStreamTrackMetrics::MakeUniqueId(const std::string& track_id, |
397 StreamType stream_type) { | 397 StreamType stream_type) { |
398 return MakeUniqueIdImpl( | 398 return MakeUniqueIdImpl( |
399 reinterpret_cast<uint64>(reinterpret_cast<void*>(this)), | 399 reinterpret_cast<uint64>(reinterpret_cast<void*>(this)), |
400 track_id, | 400 track_id, |
401 stream_type); | 401 stream_type); |
402 } | 402 } |
403 | 403 |
404 } // namespace content | 404 } // namespace content |
OLD | NEW |