Skip to content

Commit 80a9d67

Browse files
committed
support dummy I/O devices.
1 parent a4f337d commit 80a9d67

File tree

7 files changed

+565
-31
lines changed

7 files changed

+565
-31
lines changed

BUILD.gn

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ import("../webrtc.gni")
22

33
declare_args() {
44
libwebrtc_intel_media_sdk = false
5-
libwebrtc_desktop_capture = true
5+
libwebrtc_desktop_capture = false
6+
libwebrtc_video_capture = false
7+
libwebrtc_dummy_audio_device = true
68
}
79

810
if (is_android) {
@@ -41,9 +43,14 @@ rtc_shared_library("libwebrtc") {
4143

4244
defines = [
4345
"USE_LIBYUV",
44-
"WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE",
4546
]
4647

48+
if(libwebrtc_dummy_audio_device) {
49+
defines += [ "LIB_WEBRTC_USE_DUMMY_AUDIO_DEVICE" ]
50+
} else {
51+
defines += [ "WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE" ]
52+
}
53+
4754
if (is_win) {
4855
defines += [
4956
"LIB_WEBRTC_API_EXPORTS",
@@ -88,18 +95,13 @@ rtc_shared_library("libwebrtc") {
8895
"include/rtc_rtp_transceiver.h",
8996
"include/rtc_session_description.h",
9097
"include/rtc_types.h",
91-
"include/rtc_video_device.h",
9298
"include/rtc_video_frame.h",
9399
"include/rtc_video_renderer.h",
94100
"include/rtc_video_source.h",
95101
"include/rtc_video_track.h",
96102
"include/helper.h",
97103
"src/helper.cc",
98104
"src/base/portable.cc",
99-
"src/internal/vcm_capturer.cc",
100-
"src/internal/vcm_capturer.h",
101-
"src/internal/video_capturer.cc",
102-
"src/internal/video_capturer.h",
103105
"src/libwebrtc.cc",
104106
"src/rtc_audio_device_impl.cc",
105107
"src/rtc_audio_device_impl.h",
@@ -137,8 +139,6 @@ rtc_shared_library("libwebrtc") {
137139
"src/rtc_rtp_transceiver_impl.h",
138140
"src/rtc_session_description_impl.cc",
139141
"src/rtc_session_description_impl.h",
140-
"src/rtc_video_device_impl.cc",
141-
"src/rtc_video_device_impl.h",
142142
"src/rtc_video_frame_impl.cc",
143143
"src/rtc_video_frame_impl.h",
144144
"src/rtc_video_sink_adapter.cc",
@@ -149,6 +149,28 @@ rtc_shared_library("libwebrtc") {
149149
"src/rtc_video_track_impl.h",
150150
]
151151

152+
if(libwebrtc_dummy_audio_device) {
153+
sources += [
154+
"src/audio_device_dummy.cc",
155+
"src/audio_device_dummy.h",
156+
]
157+
}
158+
159+
160+
# video capture device
161+
if (libwebrtc_video_capture) {
162+
defines += [ "RTC_VIDEO_CAPTURE_DEVICE" ]
163+
sources += [
164+
"include/rtc_video_capturer.h",
165+
"src/internal/video_capturer.h",
166+
"src/internal/video_capturer.cc",
167+
"src/internal/vcm_capturer.cc",
168+
"src/internal/vcm_capturer.h",
169+
"src/rtc_video_device_impl.cc",
170+
"src/rtc_video_device_impl.h",
171+
]
172+
}
173+
152174
# intel media sdk
153175
if (is_win && libwebrtc_intel_media_sdk) {
154176
sources += [
@@ -235,7 +257,7 @@ rtc_shared_library("libwebrtc") {
235257

236258
# screen capture device
237259
if (libwebrtc_desktop_capture) {
238-
defines += [ "RTC_DESKTOP_DEVICE" ]
260+
defines += [ "RTC_DESKTOP_CAPTURE_DEVICE" ]
239261
sources += [
240262
"include/rtc_desktop_capturer.h",
241263
"include/rtc_desktop_device.h",

include/rtc_desktop_device.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef LIB_WEBRTC_RTC_DESKTOP_DEVICE_HXX
2-
#define LIB_WEBRTC_RTC_DESKTOP_DEVICE_HXX
1+
#ifndef LIB_WEBRTC_RTC_DESKTOP_CAPTURE_DEVICE_HXX
2+
#define LIB_WEBRTC_RTC_DESKTOP_CAPTURE_DEVICE_HXX
33

44
#include "rtc_types.h"
55

include/rtc_peerconnection_factory.h

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "rtc_audio_source.h"
55
#include "rtc_audio_track.h"
66
#include "rtc_types.h"
7-
#ifdef RTC_DESKTOP_DEVICE
7+
#ifdef RTC_DESKTOP_CAPTURE_DEVICE
88
#include "rtc_desktop_device.h"
99
#endif
1010
#include "rtc_media_stream.h"
@@ -31,24 +31,28 @@ class RTCPeerConnectionFactory : public RefCountInterface {
3131

3232
virtual void Delete(scoped_refptr<RTCPeerConnection> peerconnection) = 0;
3333

34+
#if !defined(LIB_WEBRTC_USE_DUMMY_AUDIO_DEVICE)
3435
virtual scoped_refptr<RTCAudioDevice> GetAudioDevice() = 0;
35-
36-
virtual scoped_refptr<RTCVideoDevice> GetVideoDevice() = 0;
37-
#ifdef RTC_DESKTOP_DEVICE
38-
virtual scoped_refptr<RTCDesktopDevice> GetDesktopDevice() = 0;
3936
#endif
40-
virtual scoped_refptr<RTCAudioSource> CreateAudioSource(
41-
const string audio_source_label) = 0;
4237

38+
#ifdef RTC_VIDEO_CAPTURE_DEVICE
39+
virtual scoped_refptr<RTCVideoDevice> GetVideoDevice() = 0;
4340
virtual scoped_refptr<RTCVideoSource> CreateVideoSource(
4441
scoped_refptr<RTCVideoCapturer> capturer, const string video_source_label,
4542
scoped_refptr<RTCMediaConstraints> constraints) = 0;
46-
#ifdef RTC_DESKTOP_DEVICE
43+
#endif
44+
45+
#ifdef RTC_DESKTOP_CAPTURE_DEVICE
46+
virtual scoped_refptr<RTCDesktopDevice> GetDesktopDevice() = 0;
4747
virtual scoped_refptr<RTCVideoSource> CreateDesktopSource(
4848
scoped_refptr<RTCDesktopCapturer> capturer,
4949
const string video_source_label,
5050
scoped_refptr<RTCMediaConstraints> constraints) = 0;
5151
#endif
52+
53+
virtual scoped_refptr<RTCAudioSource> CreateAudioSource(
54+
const string audio_source_label) = 0;
55+
5256
virtual scoped_refptr<RTCAudioTrack> CreateAudioTrack(
5357
scoped_refptr<RTCAudioSource> source, const string track_id) = 0;
5458

0 commit comments

Comments
 (0)