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

Side by Side Diff: webrtc/media/base/fakemediaengine.h

Issue 1984983002: Remove use of RtpHeaderExtension and clean up (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed comments 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 (c) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 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
(...skipping 10 matching lines...) Expand all
21 #include "webrtc/audio_sink.h" 21 #include "webrtc/audio_sink.h"
22 #include "webrtc/base/copyonwritebuffer.h" 22 #include "webrtc/base/copyonwritebuffer.h"
23 #include "webrtc/base/networkroute.h" 23 #include "webrtc/base/networkroute.h"
24 #include "webrtc/base/stringutils.h" 24 #include "webrtc/base/stringutils.h"
25 #include "webrtc/media/base/audiosource.h" 25 #include "webrtc/media/base/audiosource.h"
26 #include "webrtc/media/base/mediaengine.h" 26 #include "webrtc/media/base/mediaengine.h"
27 #include "webrtc/media/base/rtputils.h" 27 #include "webrtc/media/base/rtputils.h"
28 #include "webrtc/media/base/streamparams.h" 28 #include "webrtc/media/base/streamparams.h"
29 #include "webrtc/p2p/base/sessiondescription.h" 29 #include "webrtc/p2p/base/sessiondescription.h"
30 30
31 using webrtc::RtpExtension;
32
31 namespace cricket { 33 namespace cricket {
32 34
33 class FakeMediaEngine; 35 class FakeMediaEngine;
34 class FakeVideoEngine; 36 class FakeVideoEngine;
35 class FakeVoiceEngine; 37 class FakeVoiceEngine;
36 38
37 // A common helper class that handles sending and receiving RTP/RTCP packets. 39 // A common helper class that handles sending and receiving RTP/RTCP packets.
38 template <class Base> class RtpHelper : public Base { 40 template <class Base> class RtpHelper : public Base {
39 public: 41 public:
40 RtpHelper() 42 RtpHelper()
41 : sending_(false), 43 : sending_(false),
42 playout_(false), 44 playout_(false),
43 fail_set_send_codecs_(false), 45 fail_set_send_codecs_(false),
44 fail_set_recv_codecs_(false), 46 fail_set_recv_codecs_(false),
45 send_ssrc_(0), 47 send_ssrc_(0),
46 ready_to_send_(false) {} 48 ready_to_send_(false) {}
47 const std::vector<RtpHeaderExtension>& recv_extensions() { 49 const std::vector<RtpExtension>& recv_extensions() {
48 return recv_extensions_; 50 return recv_extensions_;
49 } 51 }
50 const std::vector<RtpHeaderExtension>& send_extensions() { 52 const std::vector<RtpExtension>& send_extensions() {
51 return send_extensions_; 53 return send_extensions_;
52 } 54 }
53 bool sending() const { return sending_; } 55 bool sending() const { return sending_; }
54 bool playout() const { return playout_; } 56 bool playout() const { return playout_; }
55 const std::list<std::string>& rtp_packets() const { return rtp_packets_; } 57 const std::list<std::string>& rtp_packets() const { return rtp_packets_; }
56 const std::list<std::string>& rtcp_packets() const { return rtcp_packets_; } 58 const std::list<std::string>& rtcp_packets() const { return rtcp_packets_; }
57 59
58 bool SendRtp(const void* data, 60 bool SendRtp(const void* data,
59 size_t len, 61 size_t len,
60 const rtc::PacketOptions& options) { 62 const rtc::PacketOptions& options) {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 } else { 199 } else {
198 muted_streams_.erase(ssrc); 200 muted_streams_.erase(ssrc);
199 } 201 }
200 return true; 202 return true;
201 } 203 }
202 bool set_sending(bool send) { 204 bool set_sending(bool send) {
203 sending_ = send; 205 sending_ = send;
204 return true; 206 return true;
205 } 207 }
206 void set_playout(bool playout) { playout_ = playout; } 208 void set_playout(bool playout) { playout_ = playout; }
207 bool SetRecvRtpHeaderExtensions( 209 bool SetRecvRtpHeaderExtensions(const std::vector<RtpExtension>& extensions) {
208 const std::vector<RtpHeaderExtension>& extensions) {
209 recv_extensions_ = extensions; 210 recv_extensions_ = extensions;
210 return true; 211 return true;
211 } 212 }
212 bool SetSendRtpHeaderExtensions( 213 bool SetSendRtpHeaderExtensions(const std::vector<RtpExtension>& extensions) {
213 const std::vector<RtpHeaderExtension>& extensions) {
214 send_extensions_ = extensions; 214 send_extensions_ = extensions;
215 return true; 215 return true;
216 } 216 }
217 virtual void OnPacketReceived(rtc::CopyOnWriteBuffer* packet, 217 virtual void OnPacketReceived(rtc::CopyOnWriteBuffer* packet,
218 const rtc::PacketTime& packet_time) { 218 const rtc::PacketTime& packet_time) {
219 rtp_packets_.push_back(std::string(packet->data<char>(), packet->size())); 219 rtp_packets_.push_back(std::string(packet->data<char>(), packet->size()));
220 } 220 }
221 virtual void OnRtcpReceived(rtc::CopyOnWriteBuffer* packet, 221 virtual void OnRtcpReceived(rtc::CopyOnWriteBuffer* packet,
222 const rtc::PacketTime& packet_time) { 222 const rtc::PacketTime& packet_time) {
223 rtcp_packets_.push_back(std::string(packet->data<char>(), packet->size())); 223 rtcp_packets_.push_back(std::string(packet->data<char>(), packet->size()));
224 } 224 }
225 virtual void OnReadyToSend(bool ready) { 225 virtual void OnReadyToSend(bool ready) {
226 ready_to_send_ = ready; 226 ready_to_send_ = ready;
227 } 227 }
228 virtual void OnNetworkRouteChanged(const std::string& transport_name, 228 virtual void OnNetworkRouteChanged(const std::string& transport_name,
229 const rtc::NetworkRoute& network_route) { 229 const rtc::NetworkRoute& network_route) {
230 last_network_route_ = network_route; 230 last_network_route_ = network_route;
231 ++num_network_route_changes_; 231 ++num_network_route_changes_;
232 } 232 }
233 bool fail_set_send_codecs() const { return fail_set_send_codecs_; } 233 bool fail_set_send_codecs() const { return fail_set_send_codecs_; }
234 bool fail_set_recv_codecs() const { return fail_set_recv_codecs_; } 234 bool fail_set_recv_codecs() const { return fail_set_recv_codecs_; }
235 235
236 private: 236 private:
237 bool sending_; 237 bool sending_;
238 bool playout_; 238 bool playout_;
239 std::vector<RtpHeaderExtension> recv_extensions_; 239 std::vector<RtpExtension> recv_extensions_;
240 std::vector<RtpHeaderExtension> send_extensions_; 240 std::vector<RtpExtension> send_extensions_;
241 std::list<std::string> rtp_packets_; 241 std::list<std::string> rtp_packets_;
242 std::list<std::string> rtcp_packets_; 242 std::list<std::string> rtcp_packets_;
243 std::vector<StreamParams> send_streams_; 243 std::vector<StreamParams> send_streams_;
244 std::vector<StreamParams> receive_streams_; 244 std::vector<StreamParams> receive_streams_;
245 std::set<uint32_t> muted_streams_; 245 std::set<uint32_t> muted_streams_;
246 std::map<uint32_t, webrtc::RtpParameters> rtp_parameters_; 246 std::map<uint32_t, webrtc::RtpParameters> rtp_parameters_;
247 bool fail_set_send_codecs_; 247 bool fail_set_send_codecs_;
248 bool fail_set_recv_codecs_; 248 bool fail_set_recv_codecs_;
249 uint32_t send_ssrc_; 249 uint32_t send_ssrc_;
250 std::string rtcp_cname_; 250 std::string rtcp_cname_;
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 // A base class for all of the shared parts between FakeVoiceEngine 677 // A base class for all of the shared parts between FakeVoiceEngine
678 // and FakeVideoEngine. 678 // and FakeVideoEngine.
679 class FakeBaseEngine { 679 class FakeBaseEngine {
680 public: 680 public:
681 FakeBaseEngine() 681 FakeBaseEngine()
682 : options_changed_(false), 682 : options_changed_(false),
683 fail_create_channel_(false) {} 683 fail_create_channel_(false) {}
684 void set_fail_create_channel(bool fail) { fail_create_channel_ = fail; } 684 void set_fail_create_channel(bool fail) { fail_create_channel_ = fail; }
685 685
686 RtpCapabilities GetCapabilities() const { return capabilities_; } 686 RtpCapabilities GetCapabilities() const { return capabilities_; }
687 void set_rtp_header_extensions( 687 void set_rtp_header_extensions(const std::vector<RtpExtension>& extensions) {
688 const std::vector<RtpHeaderExtension>& extensions) {
689 capabilities_.header_extensions = extensions; 688 capabilities_.header_extensions = extensions;
690 } 689 }
691 690
692 protected: 691 protected:
693 // Flag used by optionsmessagehandler_unittest for checking whether any 692 // Flag used by optionsmessagehandler_unittest for checking whether any
694 // relevant setting has been updated. 693 // relevant setting has been updated.
695 // TODO(thaloun): Replace with explicit checks of before & after values. 694 // TODO(thaloun): Replace with explicit checks of before & after values.
696 bool options_changed_; 695 bool options_changed_;
697 bool fail_create_channel_; 696 bool fail_create_channel_;
698 RtpCapabilities capabilities_; 697 RtpCapabilities capabilities_;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 virtual ~FakeMediaEngine() {} 818 virtual ~FakeMediaEngine() {}
820 819
821 void SetAudioCodecs(const std::vector<AudioCodec>& codecs) { 820 void SetAudioCodecs(const std::vector<AudioCodec>& codecs) {
822 voice_.SetCodecs(codecs); 821 voice_.SetCodecs(codecs);
823 } 822 }
824 void SetVideoCodecs(const std::vector<VideoCodec>& codecs) { 823 void SetVideoCodecs(const std::vector<VideoCodec>& codecs) {
825 video_.SetCodecs(codecs); 824 video_.SetCodecs(codecs);
826 } 825 }
827 826
828 void SetAudioRtpHeaderExtensions( 827 void SetAudioRtpHeaderExtensions(
829 const std::vector<RtpHeaderExtension>& extensions) { 828 const std::vector<RtpExtension>& extensions) {
830 voice_.set_rtp_header_extensions(extensions); 829 voice_.set_rtp_header_extensions(extensions);
831 } 830 }
832 void SetVideoRtpHeaderExtensions( 831 void SetVideoRtpHeaderExtensions(
833 const std::vector<RtpHeaderExtension>& extensions) { 832 const std::vector<RtpExtension>& extensions) {
834 video_.set_rtp_header_extensions(extensions); 833 video_.set_rtp_header_extensions(extensions);
835 } 834 }
836 835
837 FakeVoiceMediaChannel* GetVoiceChannel(size_t index) { 836 FakeVoiceMediaChannel* GetVoiceChannel(size_t index) {
838 return voice_.GetChannel(index); 837 return voice_.GetChannel(index);
839 } 838 }
840 FakeVideoMediaChannel* GetVideoChannel(size_t index) { 839 FakeVideoMediaChannel* GetVideoChannel(size_t index) {
841 return video_.GetChannel(index); 840 return video_.GetChannel(index);
842 } 841 }
843 842
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 910
912 private: 911 private:
913 std::vector<FakeDataMediaChannel*> channels_; 912 std::vector<FakeDataMediaChannel*> channels_;
914 std::vector<DataCodec> data_codecs_; 913 std::vector<DataCodec> data_codecs_;
915 DataChannelType last_channel_type_; 914 DataChannelType last_channel_type_;
916 }; 915 };
917 916
918 } // namespace cricket 917 } // namespace cricket
919 918
920 #endif // WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_ 919 #endif // WEBRTC_MEDIA_BASE_FAKEMEDIAENGINE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698