Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 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 "content/renderer/media/webrtc/rtc_rtp_sender.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "third_party/webrtc/base/scoped_ref_ptr.h" | |
| 9 | |
| 10 namespace content { | |
| 11 | |
| 12 namespace { | |
| 13 | |
| 14 inline bool operator==( | |
| 15 const std::unique_ptr<blink::WebMediaStreamTrack>& web_track, | |
| 16 const webrtc::MediaStreamTrackInterface* webrtc_track) { | |
| 17 if (!web_track) | |
| 18 return !webrtc_track; | |
| 19 return webrtc_track && web_track->Id() == webrtc_track->id().c_str(); | |
| 20 } | |
| 21 | |
| 22 } // namespace | |
| 23 | |
| 24 uintptr_t RTCRtpSender::getId( | |
| 25 const webrtc::RtpSenderInterface* webrtc_rtp_sender) { | |
| 26 return reinterpret_cast<uintptr_t>(webrtc_rtp_sender); | |
|
Guido Urdaneta
2017/05/02 12:31:48
Does this always work? Is there another way to get
hbos_chromium
2017/05/03 09:54:23
The only requirement of IDs is that they're a way
| |
| 27 } | |
| 28 | |
| 29 RTCRtpSender::RTCRtpSender( | |
| 30 webrtc::RtpSenderInterface* webrtc_rtp_sender, | |
| 31 std::unique_ptr<blink::WebMediaStreamTrack> web_track) | |
| 32 : webrtc_rtp_sender_(webrtc_rtp_sender), web_track_(std::move(web_track)) { | |
| 33 DCHECK(webrtc_rtp_sender_); | |
| 34 DCHECK(web_track_ == webrtc_track()); | |
| 35 } | |
| 36 | |
| 37 RTCRtpSender::~RTCRtpSender() {} | |
| 38 | |
| 39 uintptr_t RTCRtpSender::Id() const { | |
| 40 return getId(webrtc_rtp_sender_.get()); | |
| 41 } | |
| 42 | |
| 43 const blink::WebMediaStreamTrack* RTCRtpSender::Track() const { | |
| 44 DCHECK(web_track_ == webrtc_track()); | |
|
Guido Urdaneta
2017/05/02 12:31:48
Does DCHECK_EQ work in this case?
hbos_chromium
2017/05/03 09:54:23
No, not without defining more functions. Last I tr
| |
| 45 return web_track_.get(); | |
| 46 } | |
| 47 | |
| 48 const webrtc::MediaStreamTrackInterface* RTCRtpSender::webrtc_track() const { | |
| 49 return webrtc_rtp_sender_->track(); | |
| 50 } | |
| 51 | |
| 52 } // namespace content | |
| OLD | NEW |