| OLD | NEW |
| (Empty) |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "modules/peerconnection/RTCRtpContributingSource.h" | |
| 6 | |
| 7 #include "modules/peerconnection/RTCRtpReceiver.h" | |
| 8 #include "public/platform/WebRTCRtpContributingSource.h" | |
| 9 | |
| 10 namespace blink { | |
| 11 | |
| 12 RTCRtpContributingSource::RTCRtpContributingSource( | |
| 13 RTCRtpReceiver* receiver, | |
| 14 const WebRTCRtpContributingSource& webContributingSource) | |
| 15 : receiver_(receiver), | |
| 16 timestamp_ms_(webContributingSource.TimestampMs()), | |
| 17 source_(webContributingSource.Source()) { | |
| 18 DCHECK(receiver_); | |
| 19 } | |
| 20 | |
| 21 void RTCRtpContributingSource::UpdateMembers( | |
| 22 const WebRTCRtpContributingSource& webContributingSource) { | |
| 23 timestamp_ms_ = webContributingSource.TimestampMs(); | |
| 24 DCHECK_EQ(webContributingSource.Source(), source_); | |
| 25 } | |
| 26 | |
| 27 double RTCRtpContributingSource::timestamp() { | |
| 28 receiver_->UpdateSourcesIfNeeded(); | |
| 29 return timestamp_ms_; | |
| 30 } | |
| 31 | |
| 32 uint32_t RTCRtpContributingSource::source() const { | |
| 33 // Skip |receiver_->UpdateSourcesIfNeeded()|, |source_| is a constant. | |
| 34 return source_; | |
| 35 } | |
| 36 | |
| 37 DEFINE_TRACE(RTCRtpContributingSource) { | |
| 38 visitor->Trace(receiver_); | |
| 39 } | |
| 40 | |
| 41 } // namespace blink | |
| OLD | NEW |