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

Side by Side Diff: webrtc/api/rtpreceiver.h

Issue 1999853002: Forward the SignalFirstPacketReceived to RtpReceiver. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Add media type to BaseChannel. Created 4 years, 7 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 /* 1 /*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 // This file contains classes that implement RtpReceiverInterface. 11 // This file contains classes that implement RtpReceiverInterface.
12 // An RtpReceiver associates a MediaStreamTrackInterface with an underlying 12 // An RtpReceiver associates a MediaStreamTrackInterface with an underlying
13 // transport (provided by AudioProviderInterface/VideoProviderInterface) 13 // transport (provided by AudioProviderInterface/VideoProviderInterface)
14 14
15 #ifndef WEBRTC_API_RTPRECEIVER_H_ 15 #ifndef WEBRTC_API_RTPRECEIVER_H_
16 #define WEBRTC_API_RTPRECEIVER_H_ 16 #define WEBRTC_API_RTPRECEIVER_H_
17 17
18 #include <string> 18 #include <string>
19 19
20 #include "webrtc/api/mediastreamprovider.h" 20 #include "webrtc/api/mediastreamprovider.h"
21 #include "webrtc/api/rtpreceiverinterface.h" 21 #include "webrtc/api/rtpreceiverinterface.h"
22 #include "webrtc/api/remoteaudiosource.h" 22 #include "webrtc/api/remoteaudiosource.h"
23 #include "webrtc/api/videotracksource.h" 23 #include "webrtc/api/videotracksource.h"
24 #include "webrtc/base/basictypes.h" 24 #include "webrtc/base/basictypes.h"
25 #include "webrtc/base/sigslot.h"
25 #include "webrtc/media/base/videobroadcaster.h" 26 #include "webrtc/media/base/videobroadcaster.h"
26 27
27 namespace webrtc { 28 namespace webrtc {
28 29
29 class AudioRtpReceiver : public ObserverInterface, 30 class AudioRtpReceiver : public ObserverInterface,
30 public AudioSourceInterface::AudioObserver, 31 public AudioSourceInterface::AudioObserver,
31 public rtc::RefCountedObject<RtpReceiverInterface> { 32 public rtc::RefCountedObject<RtpReceiverInterface>,
33 public sigslot::has_slots<> {
32 public: 34 public:
33 AudioRtpReceiver(MediaStreamInterface* stream, 35 AudioRtpReceiver(MediaStreamInterface* stream,
34 const std::string& track_id, 36 const std::string& track_id,
35 uint32_t ssrc, 37 uint32_t ssrc,
36 AudioProviderInterface* provider); 38 AudioProviderInterface* provider);
37 39
38 virtual ~AudioRtpReceiver(); 40 virtual ~AudioRtpReceiver();
39 41
40 // ObserverInterface implementation 42 // ObserverInterface implementation
41 void OnChanged() override; 43 void OnChanged() override;
(...skipping 10 matching lines...) Expand all
52 return track_.get(); 54 return track_.get();
53 } 55 }
54 56
55 std::string id() const override { return id_; } 57 std::string id() const override { return id_; }
56 58
57 void Stop() override; 59 void Stop() override;
58 60
59 RtpParameters GetParameters() const override; 61 RtpParameters GetParameters() const override;
60 bool SetParameters(const RtpParameters& parameters) override; 62 bool SetParameters(const RtpParameters& parameters) override;
61 63
64 void SetObserver(RtpReceiverObserverInterface* observer) override;
65
62 private: 66 private:
63 void Reconfigure(); 67 void Reconfigure();
68 void OnFirstAudioPacketReceived();
64 69
65 const std::string id_; 70 const std::string id_;
66 const uint32_t ssrc_; 71 const uint32_t ssrc_;
67 AudioProviderInterface* provider_; // Set to null in Stop(). 72 AudioProviderInterface* provider_; // Set to null in Stop().
68 const rtc::scoped_refptr<AudioTrackInterface> track_; 73 const rtc::scoped_refptr<AudioTrackInterface> track_;
69 bool cached_track_enabled_; 74 bool cached_track_enabled_;
75 RtpReceiverObserverInterface* observer_;
pthatcher1 2016/06/08 17:35:55 observer_ = nullptr; ?
76 bool received_first_packet_ = false;
70 }; 77 };
71 78
72 class VideoRtpReceiver : public rtc::RefCountedObject<RtpReceiverInterface> { 79 class VideoRtpReceiver : public rtc::RefCountedObject<RtpReceiverInterface>,
80 public sigslot::has_slots<> {
73 public: 81 public:
74 VideoRtpReceiver(MediaStreamInterface* stream, 82 VideoRtpReceiver(MediaStreamInterface* stream,
75 const std::string& track_id, 83 const std::string& track_id,
76 rtc::Thread* worker_thread, 84 rtc::Thread* worker_thread,
77 uint32_t ssrc, 85 uint32_t ssrc,
78 VideoProviderInterface* provider); 86 VideoProviderInterface* provider);
79 87
80 virtual ~VideoRtpReceiver(); 88 virtual ~VideoRtpReceiver();
81 89
82 rtc::scoped_refptr<VideoTrackInterface> video_track() const { 90 rtc::scoped_refptr<VideoTrackInterface> video_track() const {
83 return track_.get(); 91 return track_.get();
84 } 92 }
85 93
86 // RtpReceiverInterface implementation 94 // RtpReceiverInterface implementation
87 rtc::scoped_refptr<MediaStreamTrackInterface> track() const override { 95 rtc::scoped_refptr<MediaStreamTrackInterface> track() const override {
88 return track_.get(); 96 return track_.get();
89 } 97 }
90 98
91 std::string id() const override { return id_; } 99 std::string id() const override { return id_; }
92 100
93 void Stop() override; 101 void Stop() override;
94 102
95 RtpParameters GetParameters() const override; 103 RtpParameters GetParameters() const override;
96 bool SetParameters(const RtpParameters& parameters) override; 104 bool SetParameters(const RtpParameters& parameters) override;
97 105
106 void SetObserver(RtpReceiverObserverInterface* observer) override;
107
98 private: 108 private:
109 void OnFirstVideoPacketReceived();
110
99 std::string id_; 111 std::string id_;
100 uint32_t ssrc_; 112 uint32_t ssrc_;
101 VideoProviderInterface* provider_; 113 VideoProviderInterface* provider_;
102 // |broadcaster_| is needed since the decoder can only handle one sink. 114 // |broadcaster_| is needed since the decoder can only handle one sink.
103 // It might be better if the decoder can handle multiple sinks and consider 115 // It might be better if the decoder can handle multiple sinks and consider
104 // the VideoSinkWants. 116 // the VideoSinkWants.
105 rtc::VideoBroadcaster broadcaster_; 117 rtc::VideoBroadcaster broadcaster_;
106 // |source_| is held here to be able to change the state of the source when 118 // |source_| is held here to be able to change the state of the source when
107 // the VideoRtpReceiver is stopped. 119 // the VideoRtpReceiver is stopped.
108 rtc::scoped_refptr<VideoTrackSource> source_; 120 rtc::scoped_refptr<VideoTrackSource> source_;
109 rtc::scoped_refptr<VideoTrackInterface> track_; 121 rtc::scoped_refptr<VideoTrackInterface> track_;
122 RtpReceiverObserverInterface* observer_;
pthatcher1 2016/06/08 17:35:55 Same here.
123 bool received_first_packet_ = false;
110 }; 124 };
111 125
112 } // namespace webrtc 126 } // namespace webrtc
113 127
114 #endif // WEBRTC_API_RTPRECEIVER_H_ 128 #endif // WEBRTC_API_RTPRECEIVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698