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

Side by Side Diff: talk/app/webrtc/test/fakemediastreamsignaling.h

Issue 1426443007: Revert of Adding the ability to create an RtpSender without a track. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « talk/app/webrtc/rtpsenderreceiver_unittest.cc ('k') | talk/app/webrtc/videotrack.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * libjingle
3 * Copyright 2013 Google Inc.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28 #ifndef TALK_APP_WEBRTC_TEST_FAKEMEDIASTREAMSIGNALING_H_
29 #define TALK_APP_WEBRTC_TEST_FAKEMEDIASTREAMSIGNALING_H_
30
31 #include "talk/app/webrtc/audiotrack.h"
32 #include "talk/app/webrtc/mediastreamsignaling.h"
33 #include "talk/app/webrtc/videotrack.h"
34
35 static const char kStream1[] = "stream1";
36 static const char kVideoTrack1[] = "video1";
37 static const char kAudioTrack1[] = "audio1";
38
39 static const char kStream2[] = "stream2";
40 static const char kVideoTrack2[] = "video2";
41 static const char kAudioTrack2[] = "audio2";
42
43 class FakeMediaStreamSignaling : public webrtc::MediaStreamSignaling,
44 public webrtc::MediaStreamSignalingObserver {
45 public:
46 explicit FakeMediaStreamSignaling(cricket::ChannelManager* channel_manager) :
47 webrtc::MediaStreamSignaling(rtc::Thread::Current(), this,
48 channel_manager) {
49 }
50
51 void SendAudioVideoStream1() {
52 ClearLocalStreams();
53 AddLocalStream(CreateStream(kStream1, kAudioTrack1, kVideoTrack1));
54 }
55
56 void SendAudioVideoStream2() {
57 ClearLocalStreams();
58 AddLocalStream(CreateStream(kStream2, kAudioTrack2, kVideoTrack2));
59 }
60
61 void SendAudioVideoStream1And2() {
62 ClearLocalStreams();
63 AddLocalStream(CreateStream(kStream1, kAudioTrack1, kVideoTrack1));
64 AddLocalStream(CreateStream(kStream2, kAudioTrack2, kVideoTrack2));
65 }
66
67 void SendNothing() {
68 ClearLocalStreams();
69 }
70
71 void UseOptionsAudioOnly() {
72 ClearLocalStreams();
73 AddLocalStream(CreateStream(kStream2, kAudioTrack2, ""));
74 }
75
76 void UseOptionsVideoOnly() {
77 ClearLocalStreams();
78 AddLocalStream(CreateStream(kStream2, "", kVideoTrack2));
79 }
80
81 void ClearLocalStreams() {
82 while (local_streams()->count() != 0) {
83 RemoveLocalStream(local_streams()->at(0));
84 }
85 }
86
87 // Implements MediaStreamSignalingObserver.
88 virtual void OnAddRemoteStream(webrtc::MediaStreamInterface* stream) {}
89 virtual void OnRemoveRemoteStream(webrtc::MediaStreamInterface* stream) {}
90 virtual void OnAddDataChannel(webrtc::DataChannelInterface* data_channel) {}
91 virtual void OnAddLocalAudioTrack(webrtc::MediaStreamInterface* stream,
92 webrtc::AudioTrackInterface* audio_track,
93 uint32_t ssrc) {}
94 virtual void OnAddLocalVideoTrack(webrtc::MediaStreamInterface* stream,
95 webrtc::VideoTrackInterface* video_track,
96 uint32_t ssrc) {}
97 virtual void OnAddRemoteAudioTrack(webrtc::MediaStreamInterface* stream,
98 webrtc::AudioTrackInterface* audio_track,
99 uint32_t ssrc) {}
100 virtual void OnAddRemoteVideoTrack(webrtc::MediaStreamInterface* stream,
101 webrtc::VideoTrackInterface* video_track,
102 uint32_t ssrc) {}
103 virtual void OnRemoveRemoteAudioTrack(
104 webrtc::MediaStreamInterface* stream,
105 webrtc::AudioTrackInterface* audio_track) {}
106 virtual void OnRemoveRemoteVideoTrack(
107 webrtc::MediaStreamInterface* stream,
108 webrtc::VideoTrackInterface* video_track) {}
109 virtual void OnRemoveLocalAudioTrack(webrtc::MediaStreamInterface* stream,
110 webrtc::AudioTrackInterface* audio_track,
111 uint32_t ssrc) {}
112 virtual void OnRemoveLocalVideoTrack(
113 webrtc::MediaStreamInterface* stream,
114 webrtc::VideoTrackInterface* video_track) {}
115 virtual void OnRemoveLocalStream(webrtc::MediaStreamInterface* stream) {}
116
117 private:
118 rtc::scoped_refptr<webrtc::MediaStreamInterface> CreateStream(
119 const std::string& stream_label,
120 const std::string& audio_track_id,
121 const std::string& video_track_id) {
122 rtc::scoped_refptr<webrtc::MediaStreamInterface> stream(
123 webrtc::MediaStream::Create(stream_label));
124
125 if (!audio_track_id.empty()) {
126 rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track(
127 webrtc::AudioTrack::Create(audio_track_id, NULL));
128 stream->AddTrack(audio_track);
129 }
130
131 if (!video_track_id.empty()) {
132 rtc::scoped_refptr<webrtc::VideoTrackInterface> video_track(
133 webrtc::VideoTrack::Create(video_track_id, NULL));
134 stream->AddTrack(video_track);
135 }
136 return stream;
137 }
138 };
139
140 #endif // TALK_APP_WEBRTC_TEST_FAKEMEDIASTREAMSIGNALING_H_
OLDNEW
« no previous file with comments | « talk/app/webrtc/rtpsenderreceiver_unittest.cc ('k') | talk/app/webrtc/videotrack.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698