Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_RTC_RTP_RECEIVER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_RTC_RTP_RECEIVER_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_RTC_RTP_RECEIVER_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_RTC_RTP_RECEIVER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 #include "content/renderer/media/webrtc/webrtc_media_stream_track_adapter_map.h" | |
| 11 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 12 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
| 12 #include "third_party/WebKit/public/platform/WebRTCRtpReceiver.h" | 13 #include "third_party/WebKit/public/platform/WebRTCRtpReceiver.h" |
| 13 #include "third_party/webrtc/api/rtpreceiverinterface.h" | 14 #include "third_party/webrtc/api/rtpreceiverinterface.h" |
| 14 | 15 |
| 15 namespace content { | 16 namespace content { |
| 16 | 17 |
| 17 // Used to surface |webrtc::RtpReceiverInterface| to blink. Multiple | 18 // Used to surface |webrtc::RtpReceiverInterface| to blink. Multiple |
| 18 // |RTCRtpReceiver|s could reference the same webrtc receiver; |id| is the value | 19 // |RTCRtpReceiver|s could reference the same webrtc receiver; |id| is the value |
| 19 // of the pointer to the webrtc receiver. | 20 // of the pointer to the webrtc receiver. |
| 20 class CONTENT_EXPORT RTCRtpReceiver : public blink::WebRTCRtpReceiver { | 21 class CONTENT_EXPORT RTCRtpReceiver : public blink::WebRTCRtpReceiver { |
| 21 public: | 22 public: |
| 22 static uintptr_t getId( | 23 static uintptr_t getId( |
| 23 const webrtc::RtpReceiverInterface* webrtc_rtp_receiver); | 24 const webrtc::RtpReceiverInterface* webrtc_rtp_receiver); |
| 24 | 25 |
| 25 RTCRtpReceiver(webrtc::RtpReceiverInterface* webrtc_rtp_receiver, | 26 RTCRtpReceiver(webrtc::RtpReceiverInterface* webrtc_rtp_receiver, |
|
Guido Urdaneta
2017/06/19 16:10:51
Update raw pointer to scoped_refptr by value.
Acc
hbos_chromium
2017/06/19 16:45:39
I've never seen std::move be used in combination w
Guido Urdaneta
2017/06/20 11:26:15
Pass by value, not const-ref
| |
| 26 const blink::WebMediaStreamTrack& web_track); | 27 std::unique_ptr<WebRtcMediaStreamTrackAdapterMap::AdapterRef> |
| 28 track_adapter); | |
| 27 ~RTCRtpReceiver() override; | 29 ~RTCRtpReceiver() override; |
| 28 | 30 |
| 29 uintptr_t Id() const override; | 31 uintptr_t Id() const override; |
| 30 const blink::WebMediaStreamTrack& Track() const override; | 32 const blink::WebMediaStreamTrack& Track() const override; |
| 31 blink::WebVector<std::unique_ptr<blink::WebRTCRtpContributingSource>> | 33 blink::WebVector<std::unique_ptr<blink::WebRTCRtpContributingSource>> |
| 32 GetSources() override; | 34 GetSources() override; |
| 33 | 35 |
| 34 const webrtc::MediaStreamTrackInterface& webrtc_track() const; | 36 const webrtc::MediaStreamTrackInterface& webrtc_track() const; |
| 35 | 37 |
| 36 private: | 38 private: |
| 37 const scoped_refptr<webrtc::RtpReceiverInterface> webrtc_rtp_receiver_; | 39 const scoped_refptr<webrtc::RtpReceiverInterface> webrtc_rtp_receiver_; |
| 38 const blink::WebMediaStreamTrack web_track_; | 40 // The track adapter is the glue between blink and webrtc layer tracks. |
| 41 // Keeping a reference to the adapter ensures it is not disposed, as is | |
| 42 // required as long as the webrtc layer track is in use by the receiver. | |
| 43 std::unique_ptr<WebRtcMediaStreamTrackAdapterMap::AdapterRef> track_adapter_; | |
| 39 | 44 |
| 40 DISALLOW_COPY_AND_ASSIGN(RTCRtpReceiver); | 45 DISALLOW_COPY_AND_ASSIGN(RTCRtpReceiver); |
| 41 }; | 46 }; |
| 42 | 47 |
| 43 } // namespace content | 48 } // namespace content |
| 44 | 49 |
| 45 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_RTC_RTP_RECEIVER_H_ | 50 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_RTC_RTP_RECEIVER_H_ |
| OLD | NEW |