Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Side by Side Diff: content/renderer/media/webrtc/rtc_rtp_receiver.h

Issue 2946663003: content::RTCRtpSenders/Receivers using track adapter references. (Closed)
Patch Set: scoped_refptr and std::move Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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(
26 const blink::WebMediaStreamTrack& web_track); 27 scoped_refptr<webrtc::RtpReceiverInterface> webrtc_rtp_receiver,
28 std::unique_ptr<WebRtcMediaStreamTrackAdapterMap::AdapterRef>
29 track_adapter);
27 ~RTCRtpReceiver() override; 30 ~RTCRtpReceiver() override;
28 31
29 uintptr_t Id() const override; 32 uintptr_t Id() const override;
30 const blink::WebMediaStreamTrack& Track() const override; 33 const blink::WebMediaStreamTrack& Track() const override;
31 blink::WebVector<std::unique_ptr<blink::WebRTCRtpContributingSource>> 34 blink::WebVector<std::unique_ptr<blink::WebRTCRtpContributingSource>>
32 GetSources() override; 35 GetSources() override;
33 36
34 const webrtc::MediaStreamTrackInterface& webrtc_track() const; 37 const webrtc::MediaStreamTrackInterface& webrtc_track() const;
35 38
36 private: 39 private:
37 const scoped_refptr<webrtc::RtpReceiverInterface> webrtc_rtp_receiver_; 40 const scoped_refptr<webrtc::RtpReceiverInterface> webrtc_rtp_receiver_;
38 const blink::WebMediaStreamTrack web_track_; 41 // The track adapter is the glue between blink and webrtc layer tracks.
42 // Keeping a reference to the adapter ensures it is not disposed, as is
43 // required as long as the webrtc layer track is in use by the receiver.
44 std::unique_ptr<WebRtcMediaStreamTrackAdapterMap::AdapterRef> track_adapter_;
39 45
40 DISALLOW_COPY_AND_ASSIGN(RTCRtpReceiver); 46 DISALLOW_COPY_AND_ASSIGN(RTCRtpReceiver);
41 }; 47 };
42 48
43 } // namespace content 49 } // namespace content
44 50
45 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_RTC_RTP_RECEIVER_H_ 51 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_RTC_RTP_RECEIVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698