6617 changed files with 1070692 additions and 253 deletions
-
1Linux_Workspace.vpw
-
48Projects/argus/argus.vpj
-
88Projects/argus/makefile
-
38Projects/defender-dc-trig/Debug/default.conf
-
288Projects/defender-dc-trig/defender-dc-trig.vpj
-
6Projects/defender-dc-trig/defender-dc-trig.vpw
-
213Projects/defender-dc-trig/makefile
-
12lib/App/argus/RGoose_Kernel.cpp
-
4lib/App/argus/RGoose_Kernel.h
-
246lib/App/defender/ArgusBackend.cpp
-
50lib/App/defender/ArgusBackend.h
-
217lib/App/defender/RGoose_Kernel.cpp
-
58lib/App/defender/RGoose_Kernel.h
-
4lib/components/base/basicFunctionality.cpp
-
5lib/components/base/basicFunctionality.h
-
2lib/components/base/basicMutex.h
-
1lib/components/base/basicSettingsProvider.h
-
8lib/components/base/basicThread.h
-
12lib/data/json/json_reader.cpp
-
8lib/data/json/json_value.cpp
-
4lib/data/json/json_writer.cpp
-
220lib/data/protocol/protocolDefender.cpp
-
7lib/data/protocol/protocolDefender.h
-
75lib/data/protocol/protocolSafeShore.cpp
-
31lib/data/protocol/protocolSafeShore.h
-
97lib/data/protocol/protocolZLMEDIA.cpp
-
42lib/data/protocol/protocolZLMEDIA.h
-
174lib/data/servletWS/servletChannelWS.cpp
-
67lib/data/servletWS/servletChannelWS.h
-
17lib/data/servletWS/servletClientHandlerWS.cpp
-
23lib/data/servletWS/servletClientHandlerWS.h
-
158lib/data/servletWS/servletWS.cpp
-
27lib/data/servletWS/servletWS.h
-
0lib/data/servletWebRTC/servletChannelWebRTC.cpp
-
0lib/data/servletWebRTC/servletChannelWebRTC.h
-
451lib/data/servletWebRTC/servletClientHandlerWebRTC.bakup
-
192lib/data/servletWebRTC/servletClientHandlerWebRTC.cpp
-
29lib/data/servletWebRTC/servletClientHandlerWebRTC.h
-
0lib/data/servletWebRTC/servletWebRTC.cpp
-
0lib/data/servletWebRTC/servletWebRTC.h
-
117lib/data/webrtc/AUTHORS
-
712lib/data/webrtc/BUILD.gn
-
68lib/data/webrtc/CODE_OF_CONDUCT.md
-
2290lib/data/webrtc/DEPS
-
11lib/data/webrtc/ENG_REVIEW_OWNERS
-
29lib/data/webrtc/LICENSE
-
23lib/data/webrtc/OWNERS
-
24lib/data/webrtc/PATENTS
-
1212lib/data/webrtc/PRESUBMIT.py
-
13lib/data/webrtc/README.chromium
-
28lib/data/webrtc/README.md
-
190lib/data/webrtc/WATCHLISTS
-
63lib/data/webrtc/abseil-in-webrtc.md
-
0lib/data/webrtc/api/BUILD.gn
-
0lib/data/webrtc/api/DEPS
-
0lib/data/webrtc/api/DESIGN.md
-
0lib/data/webrtc/api/OWNERS
-
0lib/data/webrtc/api/README.md
-
0lib/data/webrtc/api/array_view.h
-
0lib/data/webrtc/api/array_view_unittest.cc
-
0lib/data/webrtc/api/async_resolver_factory.h
-
0lib/data/webrtc/api/audio/BUILD.gn
-
0lib/data/webrtc/api/audio/OWNERS
-
0lib/data/webrtc/api/audio/audio_frame.cc
-
0lib/data/webrtc/api/audio/audio_frame.h
-
0lib/data/webrtc/api/audio/audio_mixer.h
-
0lib/data/webrtc/api/audio/channel_layout.cc
-
0lib/data/webrtc/api/audio/channel_layout.h
-
0lib/data/webrtc/api/audio/echo_canceller3_config.cc
-
0lib/data/webrtc/api/audio/echo_canceller3_config.h
-
3lib/data/webrtc/api/audio/echo_canceller3_config_json.cc
-
0lib/data/webrtc/api/audio/echo_canceller3_config_json.h
-
0lib/data/webrtc/api/audio/echo_canceller3_factory.cc
-
0lib/data/webrtc/api/audio/echo_canceller3_factory.h
-
0lib/data/webrtc/api/audio/echo_control.h
-
0lib/data/webrtc/api/audio/test/BUILD.gn
-
0lib/data/webrtc/api/audio/test/audio_frame_unittest.cc
-
0lib/data/webrtc/api/audio/test/echo_canceller3_config_json_unittest.cc
-
0lib/data/webrtc/api/audio/test/echo_canceller3_config_unittest.cc
-
0lib/data/webrtc/api/audio_codecs/BUILD.gn
-
0lib/data/webrtc/api/audio_codecs/L16/BUILD.gn
-
0lib/data/webrtc/api/audio_codecs/L16/audio_decoder_L16.cc
-
0lib/data/webrtc/api/audio_codecs/L16/audio_decoder_L16.h
-
0lib/data/webrtc/api/audio_codecs/L16/audio_encoder_L16.cc
-
0lib/data/webrtc/api/audio_codecs/L16/audio_encoder_L16.h
-
0lib/data/webrtc/api/audio_codecs/OWNERS
-
0lib/data/webrtc/api/audio_codecs/audio_codec_pair_id.cc
-
0lib/data/webrtc/api/audio_codecs/audio_codec_pair_id.h
-
0lib/data/webrtc/api/audio_codecs/audio_decoder.cc
-
0lib/data/webrtc/api/audio_codecs/audio_decoder.h
-
0lib/data/webrtc/api/audio_codecs/audio_decoder_factory.h
-
0lib/data/webrtc/api/audio_codecs/audio_decoder_factory_template.h
-
0lib/data/webrtc/api/audio_codecs/audio_encoder.cc
-
0lib/data/webrtc/api/audio_codecs/audio_encoder.h
-
0lib/data/webrtc/api/audio_codecs/audio_encoder_factory.h
-
0lib/data/webrtc/api/audio_codecs/audio_encoder_factory_template.h
-
0lib/data/webrtc/api/audio_codecs/audio_format.cc
-
0lib/data/webrtc/api/audio_codecs/audio_format.h
-
0lib/data/webrtc/api/audio_codecs/builtin_audio_decoder_factory.cc
-
0lib/data/webrtc/api/audio_codecs/builtin_audio_decoder_factory.h
@ -0,0 +1,38 @@ |
|||
KERNEL : |
|||
{ |
|||
DBC : |
|||
{ |
|||
DATABASE_HOST = "localhost"; |
|||
DATABASE_NAME = "dfsl_gunter"; |
|||
DATABASE_USER = "dbroot"; |
|||
DATABASE_PASSWORD = "NoGud4U"; |
|||
}; |
|||
SSDP : |
|||
{ |
|||
DEVICE_TYPE = "urn:schemas-upnp-org:device:InternetGatewayDevice:1"; |
|||
SERVER_STRING = "Atom Argus App Server"; |
|||
DEVICE_FRIENDLY_NAME = "Argus Application Server"; |
|||
DEVICE_UUID = "47035424-731b-4d83-98c5-c4310993bbb3"; |
|||
MANUFACTURER = "Dr.Frucht Systems"; |
|||
MANUFACTURER_URL = "http://www.smartsecsystems.com"; |
|||
MODEL_NAME = "Intel Atom Argus Server"; |
|||
DEVICE_SERIAL_NUMBER = "1.0.12"; |
|||
PRESENTATION_URL = "http://%%s/"; |
|||
ICONS : |
|||
{ |
|||
ICON_0 : |
|||
{ |
|||
FORMAT = "png"; |
|||
WIDTH = 32; |
|||
HEIGHT = 32; |
|||
DEPTH = 32; |
|||
URL = "http://%%s/favicon-32x32.png"; |
|||
}; |
|||
}; |
|||
SERVICES : |
|||
{ |
|||
}; |
|||
}; |
|||
IDENTITY = "d7d823703f68ba05c04efdb7474c2de5"; |
|||
SITE_ID = 1; |
|||
}; |
|||
@ -0,0 +1,288 @@ |
|||
<!DOCTYPE Project SYSTEM "http://www.slickedit.com/dtd/vse/10.0/vpj.dtd"> |
|||
<Project |
|||
Version="10.0" |
|||
VendorName="SlickEdit" |
|||
TemplateName="GNU C/C++" |
|||
WorkingDir="." |
|||
BuildSystem="automakefile" |
|||
BuildMakeFile="makefile"> |
|||
<Config |
|||
Name="Debug" |
|||
Type="gnuc" |
|||
DebugCallbackName="gdb" |
|||
Version="1" |
|||
OutputFile="%bdtrigd" |
|||
CompilerConfigName="Latest Version" |
|||
Defines='"/DDEBUG" "/D__STDC_CONSTANT_MACROS"'> |
|||
<Menu> |
|||
<Target |
|||
Name="Compile" |
|||
MenuCaption="&Compile" |
|||
Dialog="_gnuc_options_form Compile" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
OutputExts="*.o" |
|||
SaveOption="SaveCurrent" |
|||
RunFromDir="%rw"> |
|||
<Exec |
|||
CmdLine='g++ -c %xup -x c++ %defd -g %~other -o "%bd%n%oe" %i %f' |
|||
OtherOptions="-std=c++11 -Wno-write-strings -I../../lib/include `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --cflags`"/> |
|||
</Target> |
|||
<Target |
|||
Name="Link" |
|||
MenuCaption="&Link" |
|||
ShowOnMenu="Never" |
|||
Dialog="_gnuc_options_form Link" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
SaveOption="SaveCurrent" |
|||
RunFromDir="%rw"> |
|||
<Exec |
|||
CmdLine='g++ %xup -g %~other -o "%o" %objs' |
|||
OtherOptions="-lpthread -lmysqlclient -lcurl -lm -lssl -lcrypto -lconfig -lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --libs`"/> |
|||
</Target> |
|||
<Target |
|||
Name="Build" |
|||
MenuCaption="&Build" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
SaveOption="SaveWorkspaceFiles" |
|||
RunFromDir="%rw"> |
|||
<Exec CmdLine='make -f "makefile" CFG=%b'/> |
|||
</Target> |
|||
<Target |
|||
Name="Rebuild" |
|||
MenuCaption="&Rebuild" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
SaveOption="SaveWorkspaceFiles" |
|||
RunFromDir="%rw"> |
|||
<Exec CmdLine='make -f "makefile" rebuild CFG=%b'/> |
|||
</Target> |
|||
<Target |
|||
Name="Debug" |
|||
MenuCaption="&Debug" |
|||
Dialog="_gnuc_options_form Run/Debug" |
|||
BuildFirst="1" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
SaveOption="SaveNone" |
|||
RunFromDir="%rw"> |
|||
<Exec CmdLine='vsdebugio -prog "%o"'/> |
|||
</Target> |
|||
<Target |
|||
Name="Execute" |
|||
MenuCaption="E&xecute" |
|||
Dialog="_gnuc_options_form Run/Debug" |
|||
BuildFirst="1" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
SaveOption="SaveWorkspaceFiles" |
|||
RunFromDir="%rw"> |
|||
<Exec CmdLine='"%o"'/> |
|||
</Target> |
|||
<Target |
|||
Name="dash" |
|||
MenuCaption="-" |
|||
Deletable="0"> |
|||
<Exec/> |
|||
</Target> |
|||
<Target |
|||
Name="GNU C Options" |
|||
MenuCaption="GNU C &Options..." |
|||
ShowOnMenu="HideIfNoCmdLine" |
|||
Deletable="0" |
|||
SaveOption="SaveNone"> |
|||
<Exec |
|||
CmdLine="gnucoptions" |
|||
Type="Slick-C"/> |
|||
</Target> |
|||
</Menu> |
|||
<List Name="GNUC Options"> |
|||
<Item |
|||
Name="LinkerOutputType" |
|||
Value="Executable"/> |
|||
</List> |
|||
<Includes> |
|||
</Includes> |
|||
<Libs PreObjects="0"> |
|||
</Libs> |
|||
</Config> |
|||
<Config |
|||
Name="Release" |
|||
Type="gnuc" |
|||
DebugCallbackName="gdb" |
|||
Version="1" |
|||
OutputFile="%bdtrigd" |
|||
CompilerConfigName="Latest Version" |
|||
Defines='"/DDEBUG" "/D__STDC_CONSTANT_MACROS"'> |
|||
<Menu> |
|||
<Target |
|||
Name="Compile" |
|||
MenuCaption="&Compile" |
|||
Dialog="_gnuc_options_form Compile" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
OutputExts="*.o" |
|||
SaveOption="SaveCurrent" |
|||
RunFromDir="%rw"> |
|||
<Exec |
|||
CmdLine='g++ -c %xup -x c++ %defd %~other -o "%bd%n%oe" %i %f' |
|||
OtherOptions="-std=c++11 -Wno-write-strings -I../../lib/include `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --cflags`"/> |
|||
</Target> |
|||
<Target |
|||
Name="Link" |
|||
MenuCaption="&Link" |
|||
ShowOnMenu="Never" |
|||
Dialog="_gnuc_options_form Link" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
SaveOption="SaveCurrent" |
|||
RunFromDir="%rw"> |
|||
<Exec |
|||
CmdLine='g++ %xup %~other -o "%o" %objs' |
|||
OtherOptions="-lpthread -lmysqlclient -lcurl -lm -lssl -lcrypto -lconfig -lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --libs`"/> |
|||
</Target> |
|||
<Target |
|||
Name="Build" |
|||
MenuCaption="&Build" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
SaveOption="SaveWorkspaceFiles" |
|||
RunFromDir="%rw"> |
|||
<Exec CmdLine='make -f "makefile" CFG=%b'/> |
|||
</Target> |
|||
<Target |
|||
Name="Rebuild" |
|||
MenuCaption="&Rebuild" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
SaveOption="SaveWorkspaceFiles" |
|||
RunFromDir="%rw"> |
|||
<Exec CmdLine='make -f "makefile" rebuild CFG=%b'/> |
|||
</Target> |
|||
<Target |
|||
Name="Debug" |
|||
MenuCaption="&Debug" |
|||
Dialog="_gnuc_options_form Run/Debug" |
|||
BuildFirst="1" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
SaveOption="SaveNone" |
|||
RunFromDir="%rw"> |
|||
<Exec CmdLine='vsdebugio -prog "%o"'/> |
|||
</Target> |
|||
<Target |
|||
Name="Execute" |
|||
MenuCaption="E&xecute" |
|||
Dialog="_gnuc_options_form Run/Debug" |
|||
BuildFirst="1" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
SaveOption="SaveWorkspaceFiles" |
|||
RunFromDir="%rw"> |
|||
<Exec CmdLine='"%o"'/> |
|||
</Target> |
|||
<Target |
|||
Name="dash" |
|||
MenuCaption="-" |
|||
Deletable="0"> |
|||
<Exec/> |
|||
</Target> |
|||
<Target |
|||
Name="GNU C Options" |
|||
MenuCaption="GNU C &Options..." |
|||
ShowOnMenu="HideIfNoCmdLine" |
|||
Deletable="0" |
|||
SaveOption="SaveNone"> |
|||
<Exec |
|||
CmdLine="gnucoptions" |
|||
Type="Slick-C"/> |
|||
</Target> |
|||
</Menu> |
|||
<List Name="GNUC Options"> |
|||
<Item |
|||
Name="LinkerOutputType" |
|||
Value="Executable"/> |
|||
</List> |
|||
<Includes> |
|||
</Includes> |
|||
<Libs PreObjects="0"> |
|||
</Libs> |
|||
</Config> |
|||
<Files> |
|||
<Folder |
|||
Name="Source Files" |
|||
Filters="*.c;*.C;*.cc;*.cpp;*.cp;*.cxx;*.c++;*.prg;*.pas;*.dpr;*.asm;*.s;*.bas;*.java;*.cs;*.sc;*.e;*.cob;*.html;*.rc;*.tcl;*.py;*.pl;*.d"> |
|||
<F N="../../lib/App/defender/ArgusBackend.cpp"/> |
|||
<F N="../../lib/alg/generic/base64.cpp"/> |
|||
<F N="../../lib/components/base/basicDualThread.cpp"/> |
|||
<F N="../../lib/components/base/basicEngine.cpp"/> |
|||
<F N="../../lib/components/base/basicEvent.cpp"/> |
|||
<F N="../../lib/components/base/basicEventHandler.cpp"/> |
|||
<F N="../../lib/components/base/basicEventHeap.cpp"/> |
|||
<F N="../../lib/components/base/basicFunctionality.cpp"/> |
|||
<F N="../../lib/components/base/basicLogCollection.cpp"/> |
|||
<F N="../../lib/components/base/basicLoggingService.cpp"/> |
|||
<F N="../../lib/components/base/basicMutex.cpp"/> |
|||
<F N="../../lib/components/base/basicObject.cpp"/> |
|||
<F N="../../lib/components/base/basicPosition.cpp"/> |
|||
<F N="../../lib/components/base/basicRing.cpp"/> |
|||
<F N="../../lib/components/base/basicSettings.cpp"/> |
|||
<F N="../../lib/components/base/basicSettingsProvider.cpp"/> |
|||
<F N="../../lib/components/base/basicThread.cpp"/> |
|||
<F N="../../lib/components/base/basicTimeStamp.cpp"/> |
|||
<F N="../../lib/components/base/basicTypes.cpp"/> |
|||
<F N="../../lib/data/mysql/database_class.cpp"/> |
|||
<F N="../../lib/data/json/json_reader.cpp"/> |
|||
<F N="../../lib/data/json/json_value.cpp"/> |
|||
<F N="../../lib/data/json/json_writer.cpp"/> |
|||
<F N="../../lib/alg/generic/libzip.cpp"/> |
|||
<F N="../../lib/alg/generic/md5.cpp"/> |
|||
<F N="../../lib/components/object/objectConsoleLoggingService.cpp"/> |
|||
<F N="../../lib/components/object/objectFileLoggingService.cpp"/> |
|||
<F N="../../lib/components/object/objectSystemAnchor.cpp"/> |
|||
<F N="../../lib/data/protocol/onvifMediaObserver.cpp"/> |
|||
<F N="../../lib/data/ponvif/ponvif.cpp"/> |
|||
<F N="../../lib/App/defender/RGoose_Kernel.cpp"/> |
|||
<F N="../../lib/defender-dc-trig/rgooseServerModule.cpp"/> |
|||
<F N="../../lib/defender-dc-trig/rgooseUSBRelayModule.cpp"/> |
|||
<F N="../../lib/alg/generic/Transform.cpp"/> |
|||
<F N="../../lib/alg/generic/utm.cpp"/> |
|||
<F N="../../lib/data/protocol/xmlParser.cpp"/> |
|||
</Folder> |
|||
<Folder |
|||
Name="Header Files" |
|||
Filters="*.h;*.H;*.hh;*.hpp;*.hxx;*.inc;*.sh;*.cpy;*.if"> |
|||
<F N="../../lib/App/defender/ArgusBackend.h"/> |
|||
<F N="../../lib/alg/generic/base64.h"/> |
|||
<F N="../../lib/components/base/basicEventHandler.h"/> |
|||
<F N="../../lib/components/base/basicFunctionality.h"/> |
|||
<F N="../../lib/components/base/basicSettingsProvider.h"/> |
|||
<F N="../../lib/components/base/basicThread.h"/> |
|||
<F N="../../lib/components/base/basicTypes.h"/> |
|||
<F N="../../lib/data/mysql/database_class.h"/> |
|||
<F N="../../lib/alg/generic/libzip.h"/> |
|||
<F N="../../lib/data/ponvif/ponvif.h"/> |
|||
<F N="../../lib/data/protocol/protocolNMEA.h"/> |
|||
<F N="../../lib/data/protocol/protocolUBX.h"/> |
|||
<F N="../../lib/App/defender/RGoose_Kernel.h"/> |
|||
<F N="../../lib/defender-dc-trig/rgooseServerModule.h"/> |
|||
<F N="../../lib/defender-dc-trig/rgooseUSBRelayModule.h"/> |
|||
<F N="../../lib/data/protocol/xmlParser.h"/> |
|||
</Folder> |
|||
<Folder |
|||
Name="Resource Files" |
|||
Filters="*.ico;*.cur;*.dlg"/> |
|||
<Folder |
|||
Name="Bitmaps" |
|||
Filters="*.bmp"/> |
|||
<Folder |
|||
Name="Other Files" |
|||
Filters=""> |
|||
<F |
|||
N="makefile" |
|||
Type="Makefile"/> |
|||
</Folder> |
|||
</Files> |
|||
</Project> |
|||
@ -0,0 +1,6 @@ |
|||
<!DOCTYPE Workspace SYSTEM "http://www.slickedit.com/dtd/vse/10.0/vpw.dtd"> |
|||
<Workspace Version="10.0" VendorName="SlickEdit"> |
|||
<Projects> |
|||
<Project File="defender-dc-trig.vpj"/> |
|||
</Projects> |
|||
</Workspace> |
|||
@ -0,0 +1,213 @@ |
|||
# SlickEdit generated file. Do not edit this file except in designated areas.
|
|||
|
|||
# Make command to use for dependencies
|
|||
MAKE=make |
|||
RM=rm |
|||
MKDIR=mkdir |
|||
|
|||
# -----Begin user-editable area-----
|
|||
|
|||
# -----End user-editable area-----
|
|||
|
|||
# If no configuration is specified, "Debug" will be used
|
|||
ifndef CFG |
|||
CFG=Debug |
|||
endif |
|||
|
|||
#
|
|||
# Configuration: Debug
|
|||
#
|
|||
ifeq "$(CFG)" "Debug" |
|||
OUTDIR=Debug |
|||
OUTFILE=$(OUTDIR)/trigd |
|||
CFG_INC= |
|||
CFG_LIB= |
|||
CFG_OBJ= |
|||
COMMON_OBJ=$(OUTDIR)/ArgusBackend.o $(OUTDIR)/base64.o \
|
|||
$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \
|
|||
$(OUTDIR)/basicEvent.o $(OUTDIR)/basicEventHandler.o \
|
|||
$(OUTDIR)/basicEventHeap.o $(OUTDIR)/basicFunctionality.o \
|
|||
$(OUTDIR)/basicLogCollection.o $(OUTDIR)/basicLoggingService.o \
|
|||
$(OUTDIR)/basicMutex.o $(OUTDIR)/basicObject.o \
|
|||
$(OUTDIR)/basicPosition.o $(OUTDIR)/basicRing.o \
|
|||
$(OUTDIR)/basicSettings.o $(OUTDIR)/basicSettingsProvider.o \
|
|||
$(OUTDIR)/basicThread.o $(OUTDIR)/basicTimeStamp.o \
|
|||
$(OUTDIR)/basicTypes.o $(OUTDIR)/database_class.o \
|
|||
$(OUTDIR)/json_reader.o $(OUTDIR)/json_value.o \
|
|||
$(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o $(OUTDIR)/md5.o \
|
|||
$(OUTDIR)/objectConsoleLoggingService.o \
|
|||
$(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectSystemAnchor.o \
|
|||
$(OUTDIR)/onvifMediaObserver.o $(OUTDIR)/ponvif.o \
|
|||
$(OUTDIR)/RGoose_Kernel.o $(OUTDIR)/rgooseServerModule.o \
|
|||
$(OUTDIR)/rgooseUSBRelayModule.o $(OUTDIR)/Transform.o \
|
|||
$(OUTDIR)/utm.o $(OUTDIR)/xmlParser.o |
|||
OBJ=$(COMMON_OBJ) $(CFG_OBJ) |
|||
ALL_OBJ=$(OUTDIR)/ArgusBackend.o $(OUTDIR)/base64.o \
|
|||
$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \
|
|||
$(OUTDIR)/basicEvent.o $(OUTDIR)/basicEventHandler.o \
|
|||
$(OUTDIR)/basicEventHeap.o $(OUTDIR)/basicFunctionality.o \
|
|||
$(OUTDIR)/basicLogCollection.o $(OUTDIR)/basicLoggingService.o \
|
|||
$(OUTDIR)/basicMutex.o $(OUTDIR)/basicObject.o \
|
|||
$(OUTDIR)/basicPosition.o $(OUTDIR)/basicRing.o \
|
|||
$(OUTDIR)/basicSettings.o $(OUTDIR)/basicSettingsProvider.o \
|
|||
$(OUTDIR)/basicThread.o $(OUTDIR)/basicTimeStamp.o \
|
|||
$(OUTDIR)/basicTypes.o $(OUTDIR)/database_class.o \
|
|||
$(OUTDIR)/json_reader.o $(OUTDIR)/json_value.o \
|
|||
$(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o $(OUTDIR)/md5.o \
|
|||
$(OUTDIR)/objectConsoleLoggingService.o \
|
|||
$(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectSystemAnchor.o \
|
|||
$(OUTDIR)/onvifMediaObserver.o $(OUTDIR)/ponvif.o \
|
|||
$(OUTDIR)/RGoose_Kernel.o $(OUTDIR)/rgooseServerModule.o \
|
|||
$(OUTDIR)/rgooseUSBRelayModule.o $(OUTDIR)/Transform.o \
|
|||
$(OUTDIR)/utm.o $(OUTDIR)/xmlParser.o |
|||
|
|||
COMPILE=g++ -c -x c++ "-DDEBUG" "-D__STDC_CONSTANT_MACROS" -g -std=c++11 -Wno-write-strings -I../../lib/include `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --cflags` -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $< |
|||
LINK=g++ -g -lpthread -lmysqlclient -lcurl -lm -lssl -lcrypto -lconfig -lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --libs` -o "$(OUTFILE)" $(ALL_OBJ) |
|||
|
|||
# Pattern rules
|
|||
$(OUTDIR)/%.o : ../../lib/data/ponvif/%.cpp |
|||
$(COMPILE) |
|||
|
|||
$(OUTDIR)/%.o : ../../lib/components/base/%.cpp |
|||
$(COMPILE) |
|||
|
|||
$(OUTDIR)/%.o : ../../lib/alg/generic/%.cpp |
|||
$(COMPILE) |
|||
|
|||
$(OUTDIR)/%.o : ../../lib/App/defender/%.cpp |
|||
$(COMPILE) |
|||
|
|||
$(OUTDIR)/%.o : ../../lib/data/protocol/%.cpp |
|||
$(COMPILE) |
|||
|
|||
$(OUTDIR)/%.o : ../../lib/defender-dc-trig/%.cpp |
|||
$(COMPILE) |
|||
|
|||
$(OUTDIR)/%.o : ../../lib/data/json/%.cpp |
|||
$(COMPILE) |
|||
|
|||
$(OUTDIR)/%.o : ../../lib/data/mysql/%.cpp |
|||
$(COMPILE) |
|||
|
|||
$(OUTDIR)/%.o : ../../lib/components/object/%.cpp |
|||
$(COMPILE) |
|||
|
|||
# Build rules
|
|||
all: $(OUTFILE) |
|||
|
|||
$(OUTFILE): $(OUTDIR) $(OBJ) |
|||
$(LINK) |
|||
|
|||
$(OUTDIR): |
|||
$(MKDIR) -p "$(OUTDIR)" |
|||
|
|||
# Rebuild this project
|
|||
rebuild: cleanall all |
|||
|
|||
# Clean this project
|
|||
clean: |
|||
$(RM) -f $(OUTFILE) |
|||
$(RM) -f $(OBJ) |
|||
|
|||
# Clean this project and all dependencies
|
|||
cleanall: clean |
|||
endif |
|||
|
|||
#
|
|||
# Configuration: Release
|
|||
#
|
|||
ifeq "$(CFG)" "Release" |
|||
OUTDIR=Release |
|||
OUTFILE=$(OUTDIR)/trigd |
|||
CFG_INC= |
|||
CFG_LIB= |
|||
CFG_OBJ= |
|||
COMMON_OBJ=$(OUTDIR)/ArgusBackend.o $(OUTDIR)/base64.o \
|
|||
$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \
|
|||
$(OUTDIR)/basicEvent.o $(OUTDIR)/basicEventHandler.o \
|
|||
$(OUTDIR)/basicEventHeap.o $(OUTDIR)/basicFunctionality.o \
|
|||
$(OUTDIR)/basicLogCollection.o $(OUTDIR)/basicLoggingService.o \
|
|||
$(OUTDIR)/basicMutex.o $(OUTDIR)/basicObject.o \
|
|||
$(OUTDIR)/basicPosition.o $(OUTDIR)/basicRing.o \
|
|||
$(OUTDIR)/basicSettings.o $(OUTDIR)/basicSettingsProvider.o \
|
|||
$(OUTDIR)/basicThread.o $(OUTDIR)/basicTimeStamp.o \
|
|||
$(OUTDIR)/basicTypes.o $(OUTDIR)/database_class.o \
|
|||
$(OUTDIR)/json_reader.o $(OUTDIR)/json_value.o \
|
|||
$(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o $(OUTDIR)/md5.o \
|
|||
$(OUTDIR)/objectConsoleLoggingService.o \
|
|||
$(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectSystemAnchor.o \
|
|||
$(OUTDIR)/onvifMediaObserver.o $(OUTDIR)/ponvif.o \
|
|||
$(OUTDIR)/RGoose_Kernel.o $(OUTDIR)/rgooseServerModule.o \
|
|||
$(OUTDIR)/rgooseUSBRelayModule.o $(OUTDIR)/Transform.o \
|
|||
$(OUTDIR)/utm.o $(OUTDIR)/xmlParser.o |
|||
OBJ=$(COMMON_OBJ) $(CFG_OBJ) |
|||
ALL_OBJ=$(OUTDIR)/ArgusBackend.o $(OUTDIR)/base64.o \
|
|||
$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \
|
|||
$(OUTDIR)/basicEvent.o $(OUTDIR)/basicEventHandler.o \
|
|||
$(OUTDIR)/basicEventHeap.o $(OUTDIR)/basicFunctionality.o \
|
|||
$(OUTDIR)/basicLogCollection.o $(OUTDIR)/basicLoggingService.o \
|
|||
$(OUTDIR)/basicMutex.o $(OUTDIR)/basicObject.o \
|
|||
$(OUTDIR)/basicPosition.o $(OUTDIR)/basicRing.o \
|
|||
$(OUTDIR)/basicSettings.o $(OUTDIR)/basicSettingsProvider.o \
|
|||
$(OUTDIR)/basicThread.o $(OUTDIR)/basicTimeStamp.o \
|
|||
$(OUTDIR)/basicTypes.o $(OUTDIR)/database_class.o \
|
|||
$(OUTDIR)/json_reader.o $(OUTDIR)/json_value.o \
|
|||
$(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o $(OUTDIR)/md5.o \
|
|||
$(OUTDIR)/objectConsoleLoggingService.o \
|
|||
$(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectSystemAnchor.o \
|
|||
$(OUTDIR)/onvifMediaObserver.o $(OUTDIR)/ponvif.o \
|
|||
$(OUTDIR)/RGoose_Kernel.o $(OUTDIR)/rgooseServerModule.o \
|
|||
$(OUTDIR)/rgooseUSBRelayModule.o $(OUTDIR)/Transform.o \
|
|||
$(OUTDIR)/utm.o $(OUTDIR)/xmlParser.o |
|||
|
|||
COMPILE=g++ -c -x c++ "-DDEBUG" "-D__STDC_CONSTANT_MACROS" -std=c++11 -Wno-write-strings -I../../lib/include `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --cflags` -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $< |
|||
LINK=g++ -lpthread -lmysqlclient -lcurl -lm -lssl -lcrypto -lconfig -lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --libs` -o "$(OUTFILE)" $(ALL_OBJ) |
|||
|
|||
# Pattern rules
|
|||
$(OUTDIR)/%.o : ../../lib/data/ponvif/%.cpp |
|||
$(COMPILE) |
|||
|
|||
$(OUTDIR)/%.o : ../../lib/components/base/%.cpp |
|||
$(COMPILE) |
|||
|
|||
$(OUTDIR)/%.o : ../../lib/alg/generic/%.cpp |
|||
$(COMPILE) |
|||
|
|||
$(OUTDIR)/%.o : ../../lib/App/defender/%.cpp |
|||
$(COMPILE) |
|||
|
|||
$(OUTDIR)/%.o : ../../lib/data/protocol/%.cpp |
|||
$(COMPILE) |
|||
|
|||
$(OUTDIR)/%.o : ../../lib/defender-dc-trig/%.cpp |
|||
$(COMPILE) |
|||
|
|||
$(OUTDIR)/%.o : ../../lib/data/json/%.cpp |
|||
$(COMPILE) |
|||
|
|||
$(OUTDIR)/%.o : ../../lib/data/mysql/%.cpp |
|||
$(COMPILE) |
|||
|
|||
$(OUTDIR)/%.o : ../../lib/components/object/%.cpp |
|||
$(COMPILE) |
|||
|
|||
# Build rules
|
|||
all: $(OUTFILE) |
|||
|
|||
$(OUTFILE): $(OUTDIR) $(OBJ) |
|||
$(LINK) |
|||
|
|||
$(OUTDIR): |
|||
$(MKDIR) -p "$(OUTDIR)" |
|||
|
|||
# Rebuild this project
|
|||
rebuild: cleanall all |
|||
|
|||
# Clean this project
|
|||
clean: |
|||
$(RM) -f $(OUTFILE) |
|||
$(RM) -f $(OBJ) |
|||
|
|||
# Clean this project and all dependencies
|
|||
cleanall: clean |
|||
endif |
|||
@ -0,0 +1,246 @@ |
|||
#include "ArgusBackend.h"
|
|||
|
|||
// Global Variables
|
|||
|
|||
CSTR gsCFG_ADDRESS; |
|||
uint16_t guCFG_PORT = DEFAULT_SERVER_PORT; |
|||
CSTR gsCFG_LICENSE; |
|||
CSTR gsCFG_DB_SERVER; |
|||
CSTR gsCFG_DB_NAME; |
|||
CSTR gsCFG_DB_USER; |
|||
CSTR gsCFG_DB_PASSWORD; |
|||
CSTR gsCFG_PID_FILE = (CSTR) DEFAULT_SERVER_PID_FILE; |
|||
SOFTWARE_INFO gsSOFT_INFO; |
|||
bool gbCFG_MASTER_ROLE = true; |
|||
|
|||
bool gModule_GeoFence_Enabled = true; |
|||
bool gModule_SMS_Enabled = false; |
|||
bool gModule_Email_Enabled = false; |
|||
bool gSignal_Handler_Enabled = true; |
|||
|
|||
#define LOG( X ) m_pLog->Log( "main", 0, X )
|
|||
#define LOG_ERROR( X ) m_pLog->Log( "main", 0, _LOG_ERROR, X )
|
|||
|
|||
ARGUS_Kernel * Kernel = NULL; |
|||
//LRF_HardwareManager * HWManager = NULL;
|
|||
basicLogCollection * m_pLog = NULL; |
|||
networkServer * NetworkManager = NULL; |
|||
|
|||
void (*old_update_handler_2)(int); //SIGINT
|
|||
void (*old_kill_handler_3)(int); //SIGQUIT
|
|||
void (*old_kill_handler_9)(int); //SIGKILL
|
|||
void (*old_alarm_handler_14)(int); //SIGALRM
|
|||
void (*old_kill_handler_15)(int); //SIGTERM
|
|||
|
|||
|
|||
|
|||
|
|||
void signal_SIGKILL_handler( int SIG ){ |
|||
if( Kernel!= NULL ){ |
|||
if( gSignal_Handler_Enabled ){ |
|||
m_pLog->Log("SIG", 0, _LOG_DEBUG, "Shutdown Service by Signal" ); |
|||
Kernel->setStatus( TH_ENDED ); // Closing all Connections;
|
|||
} else { |
|||
m_pLog->Log("SIG", 0, _LOG_DEBUG, "Shutdown Signal Handler Disabled" ); |
|||
}; |
|||
}; |
|||
}; |
|||
|
|||
int main (int argc, char *argv[]){ |
|||
MySQL_Connector * DBC = NULL; |
|||
basicSettingsProvider * SETTINGS = NULL; |
|||
bool WBG; // Working Background
|
|||
bool SSE; // Server Statistics Engine
|
|||
bool NDC; // No Default Configuration
|
|||
CSTR FLE_NAME; |
|||
CSTR DCF_NAME; |
|||
CSTR SSP_NAME; |
|||
objectFileLoggingService * FLE = NULL; |
|||
objectConsoleLoggingService * CLE = NULL; |
|||
// default init
|
|||
WBG = true; |
|||
FLE_NAME = (CSTR) DEFAULT_SERVER_LOG_FILE; |
|||
SSE = true; |
|||
NDC = true; |
|||
DCF_NAME = (CSTR) DEFAULT_SERVER_CONFIG_PATH; |
|||
SSP_NAME = (CSTR) DEFAULT_SERVER_SOCKET_PATH; |
|||
gsSOFT_INFO.SW_BUILD_DATE = UNIX_TIMESTAMP; |
|||
gsSOFT_INFO.DATA_VALID = false; |
|||
m_pLog = basicLogCollection::getInstance(); |
|||
gsSOFT_INFO.SW_MODE_FLAGS = 0 |
|||
#ifdef SKIP_TARGET_LOG
|
|||
| SW_INFO_NO_TARGET_LOG |
|||
#endif
|
|||
#ifdef HIBERNATE_ENABLE
|
|||
| SW_INFO_HIBERNATE_ENA |
|||
#endif
|
|||
#ifdef TGD
|
|||
| SW_INFO_TGD_MOTORS |
|||
#ifdef TGD_VERSION_2
|
|||
| SW_INFO_TGD_VER_2 |
|||
#endif
|
|||
#endif
|
|||
#ifdef ENCODER_8192
|
|||
| SW_INFO_EU_PROJECT |
|||
#endif
|
|||
#ifdef NO_BLACK_TARGETS
|
|||
| SW_INFO_NO_BLACK_TARGETS |
|||
#endif
|
|||
#ifndef NO_MOTORS
|
|||
| SW_INFO_MOTOR_CTRL_ENA |
|||
#endif
|
|||
#ifdef THREADED_FLIP
|
|||
| SW_INFO_THREAD_FLIP |
|||
#endif
|
|||
#ifndef PRU_SLAVE
|
|||
| SW_INFO_FLAG_MASTER |
|||
#endif
|
|||
#ifdef DEBUG
|
|||
| SW_INFO_DEBUG_MODE |
|||
#endif
|
|||
; |
|||
|
|||
|
|||
// Reading Config
|
|||
if( argc > 1 ){ |
|||
for( int i = 0; i < argc; i++ ){ |
|||
switch( argv[i][0] ){ |
|||
case '-': |
|||
case '\\': |
|||
case '/':{ |
|||
switch( argv[i][1] ){ |
|||
case 'h': case 'H': case 'v': case 'V': case '?':{ |
|||
printf( "Dr Frucht Systems R-Goose Server\n"); |
|||
printf( "Software version <%s>\n", VERSION_NUMBER ); |
|||
printf( " -h -H This Message\n" ); |
|||
printf( " -i -I Interactive Mode\n" ); |
|||
return 0; |
|||
break; |
|||
}; |
|||
case 'i': case 'I':{ |
|||
WBG = false; |
|||
CLE = new objectConsoleLoggingService(); |
|||
if( CLE != NULL ) { |
|||
m_pLog->addHandler( CLE ); |
|||
}; |
|||
break; |
|||
}; |
|||
case 'c': case 'C':{ |
|||
DCF_NAME = (CSTR) malloc( MAX_PATH_LEN ); |
|||
if( DCF_NAME != NULL ) { |
|||
sprintf( DCF_NAME, "%s", argv[i+1] ); |
|||
} else { |
|||
printf("ERROR!\n\n"); |
|||
return -1; |
|||
}; |
|||
break; |
|||
}; |
|||
}; |
|||
break; |
|||
}; |
|||
}; |
|||
}; |
|||
}; |
|||
|
|||
FLE = new objectFileLoggingService( FLE_NAME ); |
|||
if( FLE != NULL ) { |
|||
m_pLog->addHandler( FLE ); |
|||
}; |
|||
LOG("Starting Log Engne!"); |
|||
if ( fileExist( DCF_NAME ) ){ |
|||
SETTINGS = basicSettingsProvider::getInstance(DCF_NAME); |
|||
} else { |
|||
SETTINGS = basicSettingsProvider::getInstance(); |
|||
}; |
|||
|
|||
// Demonizing or not
|
|||
if( WBG ){ |
|||
printf( "Dr Frucht Systems LRF Server ver. %s\n", VERSION_NUMBER ); |
|||
printf( "Configuration Applied:\n"); |
|||
printf( " Service Established %s at %d\n", gsCFG_ADDRESS, guCFG_PORT ); |
|||
printf( " PID File: %s\n", gsCFG_PID_FILE ); |
|||
printf( " Log File: %s\n", FLE_NAME ); |
|||
printf( " License: %s\n", gsCFG_LICENSE ); |
|||
printf( " Database Server: %s Database: %s\n", gsCFG_DB_SERVER, gsCFG_DB_NAME ); |
|||
if( NDC ){ |
|||
printf( " No configuration file (%s) supplied.\n", DCF_NAME); |
|||
} else { |
|||
printf( " Configuration read from: %s\n", DCF_NAME ); |
|||
}; |
|||
|
|||
//Demonizing
|
|||
pid_t pid, sid; |
|||
sync(); |
|||
close( STDIN_FILENO ); |
|||
close( STDOUT_FILENO ); |
|||
close( STDERR_FILENO ); |
|||
|
|||
pid = fork(); |
|||
if( pid < 0 ){ |
|||
return pid; |
|||
}; |
|||
if( pid > 0 ){ |
|||
return 0; |
|||
}; |
|||
//umask(0);
|
|||
sid = setsid(); |
|||
if (sid < 0) { |
|||
return sid; |
|||
}; |
|||
|
|||
pid = fork(); |
|||
if( pid < 0 ){ |
|||
return pid; |
|||
}; |
|||
if( pid > 0 ){ |
|||
FILE *pPIDF = fopen( gsCFG_PID_FILE, "w+" ); |
|||
if( pPIDF ){ |
|||
fprintf( pPIDF, "%d\n", pid ); |
|||
fclose( pPIDF ); |
|||
} |
|||
return 0; |
|||
}; |
|||
}; |
|||
|
|||
uint8_t m_bKernelExitCode = 0; |
|||
|
|||
do{ |
|||
Kernel = new ARGUS_Kernel(); |
|||
if( Kernel == NULL ) { |
|||
// Aborting Work
|
|||
LOG_ERROR( "++++ Kernel failed to born ++++" ); |
|||
unlink( gsCFG_PID_FILE ); |
|||
LOG( "PID File Deleted" ); |
|||
delete( m_pLog ); |
|||
return -1; |
|||
}; |
|||
//Loop till some Restart action
|
|||
if( Kernel != NULL ){ |
|||
LOG( "++++ Server Started ++++" ); |
|||
if ( Kernel->create() == false ){ |
|||
LOG_ERROR("Kernel create failure!"); |
|||
} else { |
|||
//Install Signal Listeners
|
|||
old_kill_handler_15 = signal( 15, signal_SIGKILL_handler ); |
|||
old_kill_handler_9 = signal( 9, signal_SIGKILL_handler ); |
|||
// Waiting for Worker to Shut Down
|
|||
Kernel->WaitFinish( false ); |
|||
m_bKernelExitCode = Kernel->getExitCause(); |
|||
signal( 9, old_kill_handler_9 ); |
|||
signal( 15, old_kill_handler_15 ); |
|||
}; |
|||
delete( Kernel ); |
|||
LOG( "++++ Server Ended ++++" ); |
|||
}; |
|||
} while( m_bKernelExitCode > 0 ); |
|||
|
|||
delete( NetworkManager ); |
|||
//LOG( "++++ CDC DEL ++++" );
|
|||
unlink( gsCFG_PID_FILE ); |
|||
LOG( "PID File Deleted" ); |
|||
if( FLE!= NULL ) delete( FLE ); |
|||
if( CLE!= NULL ) delete( CLE ); |
|||
delete( m_pLog ); |
|||
return(0); |
|||
} |
|||
|
|||
@ -0,0 +1,50 @@ |
|||
/******************************************************************* |
|||
* |
|||
* DESCRIPTION: Argus project main header file |
|||
* |
|||
* AUTHOR: Gagua |
|||
* |
|||
* HISTORY: |
|||
* |
|||
* DATE:5/29/2019 |
|||
* |
|||
*******************************************************************/ |
|||
#ifndef __ARGUS_BACKEND_MAIN_HEADER__ |
|||
#define __ARGUS_BACKEND_MAIN_HEADER__ |
|||
|
|||
/** include files **/ |
|||
|
|||
#include <stdlib.h> |
|||
#include <stdio.h> |
|||
#include <signal.h> |
|||
|
|||
#include "../../components/base/basicSettings.h" |
|||
#include "../../components/base/basicLogCollection.h" |
|||
#include "../../components/base/basicMemoryOperation.h" |
|||
#include "../../components/object/objectFileLoggingService.h" |
|||
#include "../../components/object/objectConsoleLoggingService.h" |
|||
#include "../../data/net/netServer.h" |
|||
#include "../../data/ponvif/ponvif.h" |
|||
#include "../../data/protocol/onvifMediaObserver.h" |
|||
#include "../../data/mysql/database_class.h" |
|||
#include "RGoose_Kernel.h" |
|||
|
|||
/** local definitions **/ |
|||
//http://xmsecu.com:8080/ocx/NewActive.exe |
|||
/* default settings */ |
|||
|
|||
/** external functions **/ |
|||
|
|||
/** external data **/ |
|||
|
|||
/** internal functions **/ |
|||
|
|||
/** public data **/ |
|||
|
|||
/** private data **/ |
|||
|
|||
/** public functions **/ |
|||
|
|||
/** private functions **/ |
|||
|
|||
#endif |
|||
@ -0,0 +1,217 @@ |
|||
/*******************************************************************
|
|||
* |
|||
* DESCRIPTION: ARGUS Kernel source |
|||
* |
|||
* AUTHOR: gagua |
|||
* |
|||
* HISTORY: |
|||
* |
|||
* DATE:5/29/2019 |
|||
* |
|||
*******************************************************************/ |
|||
#include "RGoose_Kernel.h"
|
|||
#include <sys/types.h>
|
|||
|
|||
#define LOG( X ) m_pLog->Log( "KRNL", this, X )
|
|||
#define LOG_ERROR( X ) m_pLog->Log( "KRNL", this, _LOG_ERROR, X )
|
|||
|
|||
|
|||
ARGUS_Kernel::ARGUS_Kernel( config_setting_t *Settings ):basicThread(){ |
|||
m_bExitCause = 0; |
|||
m_nSiteID = 0; |
|||
m_tTimeTSeconds = time( NULL ); |
|||
m_pLog = basicLogCollection::getInstance(); |
|||
m_pEventHeap = basicEventHeap::getInstance(); |
|||
m_pSettings = basicSettingsProvider::getInstance()->getSubNode( Settings, "KERNEL" ); |
|||
if( basicSettingsProvider::getInstance()->isCompromised() ) { |
|||
basicSettingsProvider::getInstance()->validate(); |
|||
}; |
|||
}; |
|||
|
|||
ARGUS_Kernel::~ARGUS_Kernel(){ |
|||
|
|||
#ifdef DEBUG
|
|||
LOG("Destructor"); |
|||
#endif
|
|||
WaitFinish(true); |
|||
#ifdef DEBUG
|
|||
LOG("Deleting Components"); |
|||
#endif
|
|||
|
|||
|
|||
#ifdef DEBUG
|
|||
LOG("Destructor Finished"); |
|||
#endif
|
|||
}; |
|||
|
|||
bool ARGUS_Kernel::create( void ){ |
|||
char tBuffer[256]; |
|||
if( m_pSettings != NULL ) { |
|||
config_setting_t * pSetting; |
|||
int tVal; |
|||
const char * tBuf; |
|||
|
|||
|
|||
//Connect( CSTR DBName, CSTR DBHost, CSTR DBUser, CSTR DBPassword, uint16_t Port = 3300 );
|
|||
LOG("Getting Settings ..."); |
|||
if( !config_setting_lookup_string( m_pSettings, ARGUS_KERNEL_TAG_SERVER_IDENTITY, &tBuf ) ){ |
|||
char * tVar; |
|||
char * tTS; |
|||
tTS = getTStr(NULL); |
|||
tVar = MD5String(tTS); |
|||
free(tTS); |
|||
sprintf( m_sIdentity, tVar ); |
|||
pSetting = config_setting_add( m_pSettings, ARGUS_KERNEL_TAG_SERVER_IDENTITY, CONFIG_TYPE_STRING ); |
|||
config_setting_set_string( pSetting, tVar ); |
|||
free( tVar ); |
|||
basicSettingsProvider::getInstance()->compromise(); |
|||
LOG("Server Identity not defined - generating new!"); |
|||
} else { |
|||
sprintf( m_sIdentity, tBuf ); |
|||
sprintf( tBuffer, "Server Identity Read From Settings: %s", tBuf ); |
|||
LOG( tBuffer ); |
|||
}; |
|||
if( !config_setting_lookup_int( m_pSettings, ARGUS_KERNEL_TAG_SITE_ID, &tVal ) ){ |
|||
tVal = m_nSiteID = 1; |
|||
pSetting = config_setting_add( m_pSettings, ARGUS_KERNEL_TAG_SITE_ID, CONFIG_TYPE_INT ); |
|||
config_setting_set_int( pSetting, tVal ); |
|||
basicSettingsProvider::getInstance()->compromise(); |
|||
LOG("Site ID not defined - using [1] as number!"); |
|||
} else { |
|||
m_nSiteID = tVal; |
|||
sprintf( tBuffer, "Site ID Read From Settings: %d", m_nSiteID ); |
|||
LOG( tBuffer ); |
|||
}; |
|||
/*
|
|||
#ifdef __EU_PROJECT__
|
|||
if( !config_setting_lookup_bool( m_pSettings, KNL_SETTINGS_SAFE_SHORE, &tVal ) ){ |
|||
tVal = m_bSafeShoreSupport = true; |
|||
pSetting = config_setting_add( m_pSettings, KNL_SETTINGS_SAFE_SHORE, CONFIG_TYPE_BOOL ); |
|||
config_setting_set_bool( pSetting, tVal ); |
|||
m_pSettingsProvider->compromise(); |
|||
LOG("Safe-Shore support not defined"); |
|||
} else { |
|||
m_bSafeShoreSupport = (bool)tVal; |
|||
sprintf( tBuffer, "Safe-Shore support Read From Settings: %d", tVal ); |
|||
LOG( tBuffer ); |
|||
}; |
|||
#endif
|
|||
if( !config_setting_lookup_bool( m_pSettings, KNL_SETTINGS_DEFENDER, &tVal ) ){ |
|||
tVal = m_bDefenderSupport = true; |
|||
pSetting = config_setting_add( m_pSettings, KNL_SETTINGS_DEFENDER, CONFIG_TYPE_BOOL ); |
|||
config_setting_set_bool( pSetting, tVal ); |
|||
m_pSettingsProvider->compromise(); |
|||
LOG("Defender support not defined"); |
|||
} else { |
|||
m_bDefenderSupport = (bool)tVal; |
|||
sprintf( tBuffer, "Defender support Read From Settings: %d", tVal ); |
|||
LOG( tBuffer ); |
|||
}; |
|||
|
|||
if (!config_setting_lookup_int(m_pSettings, KNL_SETTINGS_DETECTOR_WIDTH, &tVal )){ |
|||
tVal = m_nWidth = 1000; |
|||
pSetting = config_setting_add(m_pSettings, KNL_SETTINGS_DETECTOR_WIDTH, CONFIG_TYPE_INT); |
|||
config_setting_set_int(pSetting, tVal ); |
|||
m_pSettingsProvider->compromise(); |
|||
LOG("No Detector Width"); |
|||
} else { |
|||
m_nWidth = tVal; |
|||
sprintf( tBuffer, "Detector Width Read From Settings: %d", tVal ); |
|||
LOG( tBuffer ); |
|||
}; |
|||
if (!config_setting_lookup_int(m_pSettings, KNL_SETTINGS_FILTER_KERNELS, &tVal )){ |
|||
tVal = m_nKernelFilter = 0x000000ff; |
|||
pSetting = config_setting_add(m_pSettings, KNL_SETTINGS_FILTER_KERNELS, CONFIG_TYPE_INT); |
|||
config_setting_set_int(pSetting, tVal ); |
|||
m_pSettingsProvider->compromise(); |
|||
LOG("No Fltered Kernels Defined - All LRF Will Work"); |
|||
} else { |
|||
m_nKernelFilter = tVal; |
|||
sprintf( tBuffer, "Filter Kernels Read From Settings: %d", tVal ); |
|||
LOG( tBuffer ); |
|||
}; |
|||
if (!config_setting_lookup_int(m_pSettings, KNL_SETTINGS_DETECTOR_SST, &tVal )){ |
|||
tVal = m_nSST = 0; |
|||
pSetting = config_setting_add(m_pSettings, KNL_SETTINGS_DETECTOR_SST, CONFIG_TYPE_INT); |
|||
config_setting_set_int(pSetting, tVal ); |
|||
m_pSettingsProvider->compromise(); |
|||
LOG("No Detector SST"); |
|||
} else { |
|||
m_nSST = tVal; |
|||
sprintf( tBuffer, "Detector SST Read From Settings: %d", tVal ); |
|||
LOG( tBuffer ); |
|||
}; |
|||
if( m_pSettingsProvider->isCompromised() ) { |
|||
LOG("Save Settings"); |
|||
m_pSettingsProvider->validate(); |
|||
}; |
|||
*/ |
|||
} else { |
|||
LOG_ERROR("Failed Read Config Settings!"); |
|||
return false; |
|||
}; |
|||
|
|||
#ifdef DEBUG
|
|||
LOG( "Settings Read Done" ); |
|||
#endif
|
|||
|
|||
|
|||
#ifdef DEBUG
|
|||
LOG( "Kernel Trhead is about to be Created" ); |
|||
#endif
|
|||
if( init() == false ){ |
|||
LOG_ERROR("Error in starting Kernel Thread!"); |
|||
return false; |
|||
}; |
|||
#ifdef DEBUG
|
|||
LOG( "Kernel Thread Created" ); |
|||
#endif
|
|||
return true; |
|||
}; |
|||
|
|||
void ARGUS_Kernel::WaitFinish( bool Force ){ |
|||
if( Force ){ |
|||
#ifdef DEBUG
|
|||
LOG( "Thread End Forced" ); |
|||
#endif
|
|||
} else { |
|||
// 3 seconds sleep to settle down processes
|
|||
SLEEP(3000); |
|||
}; |
|||
waitThreadEnd( Force ); |
|||
#ifdef DEBUG
|
|||
LOG( "Thread is Detached" ); |
|||
#endif
|
|||
}; |
|||
|
|||
/* Main Kernel Thread Procedure */ |
|||
void ARGUS_Kernel::m_fThreadProc( void ){ |
|||
char Buffer[CTEXT]; |
|||
time_t tTimeTSeconds; |
|||
int lastTSS = 0; |
|||
int lastTMS = 0; |
|||
#ifdef DEBUG
|
|||
pid_t pid = gettid(); |
|||
char pidBuf[16]; |
|||
sprintf(pidBuf,"pid:%d", pid); |
|||
LOG(pidBuf); |
|||
#endif
|
|||
m_bThreadStatus = TH_WORKING; |
|||
while( m_bThreadStatus < TH_ENDED ){ |
|||
m_tTimeTSeconds = time( NULL ); |
|||
|
|||
if( m_tTimeTSeconds != tTimeTSeconds ){ // Each Second Process
|
|||
tTimeTSeconds = m_tTimeTSeconds; |
|||
|
|||
}; |
|||
SLEEP( SLEEP_KERNEL_INTERVAL ); |
|||
}; |
|||
}; |
|||
|
|||
bool ARGUS_Kernel::setStatus( int A ){ |
|||
m_bThreadStatus = (thredStatus)A; |
|||
}; |
|||
|
|||
#undef LOG
|
|||
#undef LOG_ERROR
|
|||
|
|||
@ -0,0 +1,58 @@ |
|||
/******************************************************************* |
|||
* |
|||
* DESCRIPTION: ARGUS Kernel Header File |
|||
* |
|||
* AUTHOR: gagua |
|||
* |
|||
* HISTORY: |
|||
* |
|||
* DATE:5/29/2019 |
|||
* |
|||
*******************************************************************/ |
|||
#ifndef __ARGUS_KERNEL_HEADER__ |
|||
#define __ARGUS_KERNEL_HEADER__ |
|||
|
|||
#include <linux/videodev2.h> |
|||
#include <linux/types.h> |
|||
|
|||
#include "../../alg/generic/md5.h" |
|||
#include "../../components/base/basicThread.h" |
|||
#include "../../components/base/basicEngine.h" |
|||
#include "../../components/base/basicSettingsProvider.h" |
|||
#include "../../components/base/basicEventHeap.h" |
|||
|
|||
#define SLEEP_KERNEL_INTERVAL 10 |
|||
#define ONVIF_DISCOVERY_INTERVAL 300 // 5 min |
|||
#define ONVIF_DISCOVERY_RESULT_TIME 5 |
|||
|
|||
#define ARGUS_KERNEL_TAG_SITE_ID "SITE_ID" |
|||
#define ARGUS_KERNEL_TAG_SERVER_IDENTITY "IDENTITY" |
|||
|
|||
#define ARGUS_NODE_SOCK_TYPE_SERIAL_PORT 1 |
|||
#define ARGUS_NODE_SOCK_TYPE_VIDEO_GRABBER 2 |
|||
#define ARGUS_NODE_SOCK_TYPE_NETWORK 3 |
|||
|
|||
class ARGUS_Kernel: public basicThread { |
|||
private: |
|||
uint32_t m_nSiteID; |
|||
char m_sIdentity[33]; |
|||
time_t m_tTimeTSeconds; |
|||
basicLogCollection * m_pLog; |
|||
basicEventHeap * m_pEventHeap; |
|||
config_setting_t * m_pSettings; |
|||
uint8_t m_bExitCause; |
|||
protected: |
|||
void m_fThreadProc( void ); |
|||
public: |
|||
// Constructor |
|||
explicit ARGUS_Kernel( config_setting_t *Settings = NULL ); |
|||
// Destructor |
|||
virtual ~ARGUS_Kernel(); |
|||
bool create( void ); |
|||
void WaitFinish( bool Force = false ); |
|||
bool setStatus( int ); |
|||
uint8_t getExitCause( void ){ return m_bExitCause;}; |
|||
}; |
|||
|
|||
|
|||
#endif |
|||
@ -0,0 +1,97 @@ |
|||
#include "protocolZLMEDIA.h"
|
|||
#include "../json/json_tool.h"
|
|||
#include <json/value.h>
|
|||
#include <json/writer.h>
|
|||
#include <json/reader.h>
|
|||
|
|||
#define LOG( X ) basicLogCollection::getInstance()->Log( "ZLMEDIA", this, X )
|
|||
#define LOG_ERROR( X ) basicLogCollection::getInstance()->Log( "ZLMEDIA", this, _LOG_ERROR, X )
|
|||
|
|||
protocolZLMEDIA::protocolZLMEDIA( config_setting_t *Settings ): protocolHTTP( basicSettingsProvider::getInstance()->getSubNode(Settings, "ZLMEDIA_CONNECTION") ){ |
|||
m_pLog = basicLogCollection::getInstance(); |
|||
m_pSettings = basicSettingsProvider::getInstance()->getSubNode(Settings, "ZLMEDIA_CONNECTION"); |
|||
/*
|
|||
if( m_pSettings != NULL ){ |
|||
|
|||
config_setting_t *pSetting; |
|||
|
|||
if (!config_setting_lookup_string(m_pSettings, "SCANNER_NAME", (const char**)&m_pScannerName)){ |
|||
strncpy( m_pScannerName, "LRF_2D_001", 64 ); |
|||
LOG( m_pScannerName ); |
|||
pSetting = config_setting_add(m_pSettings, "SCANNER_NAME", CONFIG_TYPE_STRING); |
|||
config_setting_set_string(pSetting, m_pScannerName); |
|||
basicSettingsProvider::getInstance()->compromise(); |
|||
}; |
|||
if (!config_setting_lookup_int(m_pSettings, "SCANNER_DIMENTIONS", &m_nScannerDimentions )){ |
|||
m_nScannerDimentions = 2; |
|||
pSetting = config_setting_add(m_pSettings, "SCANNER_DIMENTIONS", CONFIG_TYPE_INT); |
|||
config_setting_set_int(pSetting, m_nScannerDimentions); |
|||
basicSettingsProvider::getInstance()->compromise(); |
|||
}; |
|||
if (!config_setting_lookup_string(m_pSettings, "LCU_IP_ADDRESS", (const char**)&m_pServerIP)){ |
|||
strncpy( m_pServerIP, "192.168.200.204", 16 ); |
|||
LOG( m_pServerIP ); |
|||
pSetting = config_setting_add(m_pSettings, "LCU_IP_ADDRESS", CONFIG_TYPE_STRING); |
|||
config_setting_set_string(pSetting, m_pServerIP); |
|||
basicSettingsProvider::getInstance()->compromise(); |
|||
}; |
|||
if (!config_setting_lookup_int(m_pSettings, "LCU_IP_PORT", &m_nServerPort)){ |
|||
m_nServerPort = 80; |
|||
pSetting = config_setting_add(m_pSettings, "LCU_IP_PORT", CONFIG_TYPE_INT); |
|||
config_setting_set_int(pSetting, m_nServerPort); |
|||
basicSettingsProvider::getInstance()->compromise(); |
|||
}; |
|||
|
|||
basicSettingsProvider::getInstance()->validate(); |
|||
|
|||
}; //*/
|
|||
}; |
|||
|
|||
protocolZLMEDIA::~protocolZLMEDIA(){ |
|||
}; |
|||
|
|||
bool protocolZLMEDIA::packetHandler( protocolPackage *Package ){ |
|||
if( Package == NULL )return false; |
|||
if( Package->m_nSize == 0 ) return false; |
|||
if( Package->m_pData == NULL ) return false; |
|||
if( Package->m_nCode != 200 ) return false; |
|||
try{ |
|||
Json::Value root; |
|||
Json::Reader reader; |
|||
if( !reader.parse( (char *)Package->m_pData, root ) ){ |
|||
LOG_ERROR( "Error parsing the string" ); |
|||
return false; |
|||
}; |
|||
for( Json::Value::const_iterator outer = root.begin() ; outer != root.end() ; outer++ ){ |
|||
for( Json::Value::const_iterator inner = (*outer).begin() ; inner!= (*outer).end() ; inner++ ){ |
|||
char tBuffer[256]; |
|||
sprintf( tBuffer,"Data: %s: %s ", inner.key().asString().c_str(), (*inner).asString().c_str() ); |
|||
LOG( tBuffer ); |
|||
}; |
|||
}; |
|||
} catch (exception e ){ |
|||
return false; |
|||
}; |
|||
return true; |
|||
}; |
|||
// Issue New Online Check but return current value
|
|||
bool protocolZLMEDIA::isOnline(){ |
|||
if( !m_bSessionOnGo ) { |
|||
char URL[256]; |
|||
uint8_t timeout = 100; // 1 sec.
|
|||
m_bSessionOnGo = true; |
|||
if( m_bUseSSL ) { |
|||
sprintf(URL,"https://%s:%d/%s?secret=%s", m_pIP, m_nPort, m_pAccessPoint, m_pSecret ); |
|||
} else { |
|||
|
|||
}; |
|||
issuePost(CSTR URL, char *Buffer, int &BufferSize ) |
|||
while( m_bSessionOnGo && timeout-- ) SLEEP(10); |
|||
}; |
|||
return m_bServerIsPresent; |
|||
}; |
|||
|
|||
|
|||
#undef LOG
|
|||
#undef LOG_ERROR
|
|||
|
|||
@ -0,0 +1,42 @@ |
|||
#ifndef __PROTOCOL_ZL_MEDIASERVER_REST_HEADER__ |
|||
#define __PROTOCOL_ZL_MEDIASERVER_REST_HEADER__ |
|||
|
|||
#ifdef __linux__ |
|||
#include <features.h> |
|||
#endif |
|||
|
|||
#include "protocolHTTP.h" |
|||
|
|||
#include <time.h> |
|||
#include <stdio.h> |
|||
#include <stdlib.h> |
|||
#include <sys/types.h> |
|||
#include <sys/timeb.h> |
|||
#include <string> |
|||
|
|||
#include "../../components/base/basicFunctionality.h" |
|||
#include "../../components/base/basicLogCollection.h" |
|||
#include "../../components/base/basicSettingsProvider.h" |
|||
|
|||
class protocolZLMEDIA : public protocolHTTP { |
|||
private: |
|||
basicLogCollection * m_pLog; |
|||
config_setting_t * m_pSettings; |
|||
char m_pSecret[256]; |
|||
char m_pAccessPoint[256]; |
|||
char m_pIP[16]; |
|||
bool m_bSessionOnGo; |
|||
bool m_bServerIsPresent; |
|||
bool m_bUseSSL; |
|||
uint16_t m_nPort; |
|||
protected: |
|||
virtual bool packetHandler( protocolPackage *Package ); |
|||
public: |
|||
explicit protocolZLMEDIA( config_setting_t *Settings = NULL ); |
|||
~protocolZLMEDIA(); |
|||
bool isOnline(); |
|||
}; |
|||
|
|||
|
|||
|
|||
#endif |
|||
@ -0,0 +1,174 @@ |
|||
#include "servletChannelWS.h"
|
|||
#include "../../components/base/basicFunctionality.h"
|
|||
#define LOG( X ) m_pLog->Log( "SWCHAN", this, X )
|
|||
#define LOG_ERROR( X ) m_pLog->Log( "SWCHAN", this, _LOG_ERROR, X )
|
|||
|
|||
static bool _FFD_REGISTER_ALL_FLAG; |
|||
|
|||
bool servletChannelWS::initLibAV(void){ |
|||
if (!_FFD_REGISTER_ALL_FLAG){ |
|||
char Buffer[256]; |
|||
_FFD_REGISTER_ALL_FLAG = true; |
|||
LOG("Init LIBAV"); |
|||
sprintf(Buffer, "LibAV Codec: %d.%d.%d", LIBAVCODEC_VERSION_MAJOR, LIBAVCODEC_VERSION_MINOR, LIBAVCODEC_VERSION_MICRO); |
|||
LOG(Buffer); |
|||
sprintf(Buffer, "LibAV Device: %d.%d.%d", LIBAVDEVICE_VERSION_MAJOR, LIBAVDEVICE_VERSION_MINOR, LIBAVDEVICE_VERSION_MICRO); |
|||
LOG(Buffer); |
|||
sprintf(Buffer, "LibAV Format: %d.%d.%d", LIBAVFORMAT_VERSION_MAJOR, LIBAVFORMAT_VERSION_MINOR, LIBAVFORMAT_VERSION_MICRO); |
|||
LOG(Buffer); |
|||
sprintf(Buffer, "LibAV SWScale: %d.%d.%d", LIBSWSCALE_VERSION_MAJOR, LIBSWSCALE_VERSION_MINOR, LIBSWSCALE_VERSION_MICRO); |
|||
LOG(Buffer); |
|||
av_register_all(); |
|||
avcodec_register_all(); |
|||
avdevice_register_all(); |
|||
avformat_network_init(); |
|||
}; |
|||
return _FFD_REGISTER_ALL_FLAG; |
|||
}; |
|||
|
|||
|
|||
|
|||
|
|||
servletChannelWS::servletChannelWS():basicThread(){ |
|||
m_pLog = basicLogCollection::getInstance(); |
|||
pthread_mutex_init( &new_pkt_mutex, NULL); |
|||
pthread_cond_init( &new_pkt_cond, NULL); |
|||
pthread_mutex_init( &fill_buff_mutex, NULL); |
|||
pthread_cond_init( &fill_buff_cond, NULL); |
|||
}; |
|||
|
|||
servletChannelWS::~servletChannelWS(){ |
|||
basicThread::waitThreadEnd(true); |
|||
}; |
|||
//rtsp://gagua:4GetMyID@192.168.0.109:554/Streaming/Channels/101?transportmode=unicast&profile=Profile_1
|
|||
char white_list_proto[] = "file,udp,tcp,rtp,rtsp"; |
|||
bool servletChannelWS::create( CSTR MediaURI ){ |
|||
LOG( MediaURI ); |
|||
if(!initLibAV()) { |
|||
LOG_ERROR("LibAV INIT Error!"); |
|||
return false; |
|||
} |
|||
m_pFormatCtx = avformat_alloc_context(); |
|||
if( m_pFormatCtx == NULL ) return false; |
|||
LOG("Format Context Allocated"); |
|||
m_pFormatCtx->protocol_whitelist = white_list_proto; |
|||
LOG("White List is Set"); |
|||
int ret = avformat_open_input( &m_pFormatCtx, MediaURI , NULL, NULL); |
|||
if ( ret != 0){ |
|||
//char tBuf[CTEXT];
|
|||
//av_strerror( ret, tBuf, CTEXT );
|
|||
LOG_ERROR( "Couldn't open file" ); |
|||
return false; |
|||
}; |
|||
LOG("Media Opened"); |
|||
|
|||
// Retrieve stream information
|
|||
if( avformat_find_stream_info(m_pFormatCtx,NULL) < 0 ){ |
|||
LOG_ERROR( "Couldn't find stream information" ); |
|||
return false; |
|||
}; |
|||
LOG("Stream Info Found"); |
|||
// Find the first video stream
|
|||
m_iVideoStreamID = -1; |
|||
for( unsigned int i = 0; i < m_pFormatCtx->nb_streams; i++ ){ |
|||
AVCodecContext *cc = m_pFormatCtx->streams[i]->codec; |
|||
if( cc->codec_type==AVMEDIA_TYPE_VIDEO ){ |
|||
// don't care FF_DEBUG_VIS_MV_B_BACK
|
|||
cc->debug_mv = 0;//FF_DEBUG_VIS_MV_P_FOR | FF_DEBUG_VIS_MV_B_FOR;
|
|||
m_iVideoStreamID = i; |
|||
break; |
|||
}; |
|||
}; |
|||
if (m_iVideoStreamID == -1){ |
|||
LOG_ERROR("Didn't find a video stream"); |
|||
return false; |
|||
} |
|||
LOG("Video Stream Found"); |
|||
|
|||
// Get a pointer to the codec context for the video stream
|
|||
m_pCodecCtx = m_pFormatCtx->streams[m_iVideoStreamID]->codec; |
|||
m_pCodecCtx->refcounted_frames = 1; |
|||
m_pCodecCtx->thread_count = 0;//NB_DEC_THREADS;
|
|||
//pCodecCtx->thread_type=2;
|
|||
|
|||
// Find the decoder for the video stream
|
|||
m_pCodec = avcodec_find_decoder( m_pCodecCtx->codec_id ); |
|||
if (m_pCodec == NULL){ |
|||
LOG_ERROR("Codec not found"); |
|||
return false; |
|||
}; |
|||
LOG("Codec Found"); |
|||
|
|||
// Inform the codec that we can handle truncated bitstreams -- i.e.,
|
|||
// bitstreams where frame boundaries can fall in the middle of packets
|
|||
if (m_pCodec->capabilities & CODEC_CAP_TRUNCATED) m_pCodecCtx->flags |= CODEC_FLAG_TRUNCATED; |
|||
|
|||
// Open codec
|
|||
if (avcodec_open2(m_pCodecCtx, m_pCodec, NULL)<0) |
|||
return -1; // Could not open codec
|
|||
LOG("Codec Opened"); |
|||
m_fFrameRate = 1*m_pCodecCtx->time_base.den/(m_pCodecCtx->time_base.num*m_pCodecCtx->ticks_per_frame); |
|||
m_nWidth = m_pCodecCtx->width; |
|||
m_nHeight = m_pCodecCtx->height; |
|||
LOG("Starting Decoder Thread"); |
|||
return basicThread::init(); |
|||
}; |
|||
|
|||
|
|||
|
|||
void servletChannelWS::m_fThreadProc( void ){ |
|||
AVPacket *dummy_packet; |
|||
pid_t pid = gettid(); |
|||
char pidBuf[16]; |
|||
sprintf(pidBuf,"pid:%d", pid); |
|||
LOG("Decoder Thread Started"); |
|||
LOG(pidBuf); |
|||
m_bThreadStatus = TH_WORKING; |
|||
while( m_bThreadStatus < TH_ENDED ){ |
|||
AVPacket *packet=(AVPacket*)av_malloc(sizeof(AVPacket)); |
|||
if( packet != NULL ) { |
|||
packet->stream_index = -1; |
|||
do{ |
|||
av_init_packet(packet); |
|||
//av_free_packet(&packet);
|
|||
packet->data = NULL; |
|||
int err = av_read_frame( m_pFormatCtx, packet ); |
|||
if( err < 0 ){ |
|||
//pthread_exit(NULL);
|
|||
//return 0 ;
|
|||
if( b_streaming == false ){ |
|||
av_seek_frame( m_pFormatCtx, -1, 0, AVSEEK_FLAG_BACKWARD ); |
|||
packet->stream_index = -1; |
|||
}; |
|||
//fprintf(stderr, "#################### =======> av_seek_frame");
|
|||
continue; |
|||
}; |
|||
} while( packet->stream_index != m_iVideoStreamID ); |
|||
|
|||
pthread_mutex_lock(&fill_buff_mutex); |
|||
//if(Pkt_buf.size()<PKT_BUF_LEN)
|
|||
b_fill_buf = m_qMediaBus.size() < PKT_BUF_LEN; |
|||
if( b_streaming == false ){ |
|||
while( b_fill_buf == 0 ) pthread_cond_wait(&fill_buff_cond, &fill_buff_mutex); |
|||
} else { |
|||
if( b_fill_buf == 0 ){// if streaming mode is true, the receiving thread is never blocked and some packets can be dropped
|
|||
dummy_packet = m_qMediaBus.front(); |
|||
m_qMediaBus.pop(); |
|||
av_packet_unref( dummy_packet ); |
|||
}; |
|||
}; |
|||
//AVPacket *packet = av_malloc(sizeof(AVPacket));
|
|||
//av_frame_ref (pFrame_ref,decode_th_data->pFrame);
|
|||
m_qMediaBus.push( packet ); |
|||
pthread_mutex_unlock(&fill_buff_mutex); |
|||
pthread_mutex_lock(&new_pkt_mutex); |
|||
b_new_pkt=true; |
|||
pthread_cond_signal( &new_pkt_cond ); |
|||
pthread_mutex_unlock(&new_pkt_mutex); |
|||
}; |
|||
}; |
|||
}; |
|||
|
|||
#undef LOG
|
|||
#undef LOG_ERROR
|
|||
|
|||
@ -0,0 +1,67 @@ |
|||
#ifndef __SERVLET_CHANNEL_WEB_SOCKET_HEADER__ |
|||
#define __SERVLET_CHANNEL_WEB_SOCKET_HEADER__ |
|||
|
|||
#include "../../components/base/basicThread.h" |
|||
|
|||
extern "C" { |
|||
#include <libavdevice/avdevice.h> |
|||
#include <libavcodec/avcodec.h> |
|||
#include <libavformat/avio.h> |
|||
#include <libavformat/avformat.h> |
|||
#include <libswscale/swscale.h> |
|||
#include <libavutil/file.h> |
|||
#include <libavutil/mathematics.h> |
|||
#include <libavutil/error.h> |
|||
#include <libavutil/imgutils.h> |
|||
}; |
|||
|
|||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,28,1) |
|||
#define av_frame_alloc avcodec_alloc_frame |
|||
#define av_frame_free avcodec_free_frame |
|||
#define avcodec_free_context av_free |
|||
#define AV_PIX_FMT_BGR24 PIX_FMT_BGR24 |
|||
#endif |
|||
|
|||
#define CLEAR(x) memset(&(x), 0, sizeof(x)) |
|||
|
|||
#include <vector> |
|||
#include <queue> |
|||
|
|||
typedef std::queue<AVPacket *> pipeAVPacket; |
|||
|
|||
#define PKT_BUF_LEN 1 |
|||
|
|||
class servletChannelWS:basicThread{ |
|||
private: |
|||
basicLogCollection * m_pLog; |
|||
bool b_is_waiting_; |
|||
bool b_new_pkt; |
|||
bool b_fill_buf; |
|||
bool b_streaming; |
|||
pthread_mutex_t new_pkt_mutex; |
|||
pthread_cond_t new_pkt_cond; |
|||
pthread_mutex_t fill_buff_mutex; |
|||
pthread_cond_t fill_buff_cond; |
|||
|
|||
pipeAVPacket m_qMediaBus; |
|||
/* Encoder fields */ |
|||
AVFormatContext * m_pFormatCtx; |
|||
AVCodecContext * m_pCodecCtx; |
|||
AVCodec * m_pCodec; |
|||
uint32_t m_fFrameRate; |
|||
uint32_t m_nWidth; |
|||
uint32_t m_nHeight; |
|||
int m_iVideoStreamID; |
|||
bool initLibAV(void); |
|||
protected: |
|||
virtual void m_fThreadProc( void ); |
|||
public: |
|||
servletChannelWS(); |
|||
virtual ~servletChannelWS(); |
|||
bool create( CSTR MediaURI ); |
|||
pipeAVPacket * getPipe( void ){ return &m_qMediaBus; }; |
|||
}; |
|||
|
|||
typedef std::vector<servletChannelWS *> vectorChannelsWS; |
|||
|
|||
#endif |
|||
@ -0,0 +1,158 @@ |
|||
#include "servletWS.h"
|
|||
#include "../../components/base/basicFunctionality.h"
|
|||
#include <ctype.h>
|
|||
#include <err.h>
|
|||
#include <errno.h>
|
|||
#include <getopt.h>
|
|||
#include <ifaddrs.h>
|
|||
#include <netdb.h>
|
|||
#include <paths.h>
|
|||
#include <poll.h>
|
|||
#include <stdio.h>
|
|||
#include <signal.h>
|
|||
#include <stdint.h>
|
|||
#include <stdlib.h>
|
|||
#include <string.h>
|
|||
#include <time.h>
|
|||
#include <unistd.h>
|
|||
#include <arpa/inet.h>
|
|||
#include <netinet/ip.h>
|
|||
#include <netinet/udp.h>
|
|||
#include <sys/param.h> /* MIN() */
|
|||
#include <sys/socket.h>
|
|||
|
|||
#define LOG( X ) m_pLog->Log( "SWRTC", this, X )
|
|||
#define LOG_ERROR( X ) m_pLog->Log( "SWRTC", this, _LOG_ERROR, X )
|
|||
|
|||
#define ENABLE_SOCKOPT(sd, level, opt) \
|
|||
do { \ |
|||
int val = 1; \ |
|||
if (setsockopt(sd, level, opt, &val, sizeof(val)) < 0) \ |
|||
warn("Failed enabling %s for web service", #opt); \ |
|||
} while (0); |
|||
|
|||
servletWS::servletWS( uint16_t ListenPort ):basicDualThread(){ |
|||
m_pLog = basicLogCollection::getInstance(); |
|||
m_nListenPort = ListenPort; |
|||
m_nSocketDescriptor = -1; |
|||
LOG("Construct"); |
|||
}; |
|||
|
|||
servletWS::~servletWS(){ |
|||
LOG("Destruct"); |
|||
}; |
|||
|
|||
bool servletWS::create( uint16_t ListenPort ){ |
|||
LOG("Create"); |
|||
if( m_nListenPort == 0 && ListenPort == 0 ) return false; |
|||
m_nListenPort = ListenPort; |
|||
struct sockaddr sa; |
|||
struct sockaddr_in *sin; |
|||
|
|||
memset(&sa, 0, sizeof(struct sockaddr)); |
|||
sa.sa_family = AF_INET; |
|||
sin = (struct sockaddr_in *)&sa; |
|||
sin->sin_addr.s_addr = htonl(INADDR_ANY); |
|||
sin->sin_port = htons( m_nListenPort ); |
|||
|
|||
m_nSocketDescriptor = socket( sa.sa_family, SOCK_STREAM | SOCK_NONBLOCK, 0); |
|||
if( m_nSocketDescriptor == -1 ){ |
|||
LOG_ERROR("Failed creating web socket"); |
|||
return false; |
|||
}; |
|||
ENABLE_SOCKOPT( m_nSocketDescriptor, SOL_SOCKET, SO_REUSEADDR); |
|||
#ifdef SO_REUSEPORT
|
|||
ENABLE_SOCKOPT( m_nSocketDescriptor, SOL_SOCKET, SO_REUSEPORT); |
|||
#endif
|
|||
if( bind( m_nSocketDescriptor, &sa, sizeof(sa)) < 0 ){ |
|||
LOG_ERROR("Failed binding Socket"); |
|||
close( m_nSocketDescriptor ); |
|||
return false; |
|||
} else { |
|||
LOG("Bind Socessfull"); |
|||
} |
|||
if( listen( m_nSocketDescriptor, 10) != 0 ){ |
|||
LOG_ERROR("Failed setting web listen backlog"); |
|||
close( m_nSocketDescriptor ); |
|||
return false; |
|||
} else { |
|||
LOG("Listen OK"); |
|||
}; |
|||
return basicDualThread::init(); |
|||
}; |
|||
|
|||
// Listener
|
|||
void servletWS::m_fThreadAProc( void ){ |
|||
struct pollfd pfd[1]; |
|||
pid_t pid = gettid(); |
|||
char pidBuf[16]; |
|||
sprintf(pidBuf,"pid:%d", pid); |
|||
LOG(pidBuf); |
|||
pfd->fd = m_nSocketDescriptor; |
|||
pfd->events = POLLIN | POLLHUP; |
|||
m_bThreadAStatus = TH_WORKING; |
|||
while( m_bThreadAStatus < TH_ENDED ) { |
|||
int RetVal = 0;//, timeout;
|
|||
RetVal = poll( pfd, 1, 1000 ); |
|||
if( RetVal < 0 ){ |
|||
if (EINTR == errno) continue; |
|||
LOG_ERROR("Unrecoverable error"); |
|||
m_bThreadAStatus = TH_ENDED; |
|||
continue; |
|||
}; |
|||
// Handle Connections
|
|||
if( RetVal != 0 ){ |
|||
if ( pfd[0].revents & POLLIN ) { |
|||
servletClientHandlerWS * pClient; |
|||
LOG("Handle New Client"); |
|||
pClient = new servletClientHandlerWS( this, pfd[0].fd ); |
|||
if( pClient != NULL ) { |
|||
m_vWebClients.push_back( pClient ); |
|||
}; |
|||
}; |
|||
}; |
|||
// Handle Dead Clients
|
|||
if( m_vWebClients.size() ) { |
|||
for( vectorClientHandlerWS::iterator index = m_vWebClients.begin(); index < m_vWebClients.end(); index++ ) { |
|||
servletClientHandlerWS * pClient; |
|||
pClient = (*index); |
|||
if( !( pClient->getStatus()< TH_ENDED ) ) { |
|||
// Remove Dead Client
|
|||
m_vWebClients.erase(index); |
|||
LOG("Client Record Erased!"); |
|||
delete( pClient ); |
|||
}; |
|||
}; |
|||
}; |
|||
SLEEP(50); |
|||
}; |
|||
}; |
|||
|
|||
// Worker
|
|||
void servletWS::m_fThreadBProc( void ){ |
|||
pid_t pid = gettid(); |
|||
char pidBuf[16]; |
|||
sprintf(pidBuf,"pid:%d", pid); |
|||
LOG(pidBuf); |
|||
m_bThreadBStatus = TH_WORKING; |
|||
while( m_bThreadBStatus < TH_ENDED ) { |
|||
SLEEP(50); |
|||
}; |
|||
}; |
|||
|
|||
bool servletWS::attachChannel( CSTR MediaURI, bool LocalDevice ){ |
|||
if( MediaURI == NULL ) return false; |
|||
servletChannelWS * tPtr; |
|||
tPtr = new servletChannelWS(); |
|||
if( tPtr == NULL ) return false; |
|||
if( tPtr->create(MediaURI) ){ |
|||
m_vChannels.push_back( tPtr ); |
|||
} else { |
|||
delete( tPtr ); |
|||
}; |
|||
return true; |
|||
}; |
|||
|
|||
#undef LOG
|
|||
#undef LOG_ERROR
|
|||
|
|||
@ -0,0 +1,27 @@ |
|||
#ifndef __SERVLET_WEB_SOCKET_HEADER__ |
|||
#define __SERVLET_WEB_SOCKET_HEADER__ |
|||
|
|||
#include "../../components/base/basicDualThread.h" |
|||
#include "servletChannelWS.h" |
|||
#include "servletClientHandlerWS.h" |
|||
|
|||
class servletWS: public basicDualThread{ |
|||
private: |
|||
basicLogCollection * m_pLog; |
|||
int m_nSocketDescriptor; |
|||
uint16_t m_nListenPort; |
|||
|
|||
|
|||
vectorChannelsWS m_vChannels; |
|||
vectorClientHandlerWS m_vWebClients; |
|||
|
|||
public: |
|||
explicit servletWS( uint16_t ListenPort = 8081 ); |
|||
virtual ~servletWS(); |
|||
bool create( uint16_t ListenPort = 8081 ); |
|||
virtual void m_fThreadAProc( void ); // Listener |
|||
virtual void m_fThreadBProc( void ); // Worker |
|||
bool attachChannel( CSTR MediaURI, bool LocalDevice ); |
|||
}; |
|||
|
|||
#endif |
|||
@ -0,0 +1,451 @@ |
|||
#include "servletClientHandlerWebRTC.h" |
|||
#include "servletWebRTC.h" |
|||
#include "../../components/base/basicFunctionality.h" |
|||
#include "../../alg/generic/base64.h" |
|||
#include <openssl/sha.h> |
|||
#include <websocketpp/http/request.hpp> |
|||
#include <websocketpp/http/response.hpp> |
|||
#include <websocketpp/config/core.hpp> |
|||
#include <websocketpp/processors/hybi13.hpp> |
|||
|
|||
#define LOG( X ) m_pLog->Log( "WRTC", this, X ) |
|||
#define LOG_ERROR( X ) m_pLog->Log( "WRTC", this, _LOG_ERROR, X ) |
|||
|
|||
typedef websocketpp::config::core ws_config; |
|||
typedef websocketpp::processor::hybi13<ws_config> ws_parser; |
|||
typedef ws_config::request_type ws_request; |
|||
typedef ws_config::response_type ws_response; |
|||
typedef ws_config::con_msg_manager_type ws_msg_manager; |
|||
typedef ws_config::rng_type ws_rng; |
|||
|
|||
enum { |
|||
WEBRTC_REQ_SIGNIN = 0, |
|||
WEBRTC_REQ_WAIT = 1, |
|||
WEBRTC_REQ_SIGNOUT = 2, |
|||
WEBRTC_REQ_MESSAGE = 3 |
|||
}; |
|||
static const char* kRequestPaths[] = { |
|||
"/sign_in", |
|||
"/wait", |
|||
"/sign_out", |
|||
"/message" |
|||
}; |
|||
|
|||
servletClientHandlerWebRTC::servletClientHandlerWebRTC( servletWebRTC *pPtr, int Socket ):basicThread(){ |
|||
m_pLog = basicLogCollection::getInstance(); |
|||
m_pParent = NULL; |
|||
if( pPtr == NULL ) return; |
|||
m_iSocketFID = accept( Socket, NULL, NULL); |
|||
if ( m_iSocketFID < 0) { |
|||
char tBuf[CTEXT]; |
|||
sprintf(tBuf, "accept() error: %s", strerror(errno)); |
|||
LOG_ERROR(tBuf); |
|||
return; |
|||
}; |
|||
m_pDeflatener = NULL; |
|||
m_bDeflatePerMessage = false; |
|||
m_pParent = pPtr; |
|||
basicThread::init(); |
|||
}; |
|||
|
|||
servletClientHandlerWebRTC::~servletClientHandlerWebRTC(){ |
|||
basicThread::waitThreadEnd( true ); |
|||
if(m_pDeflatener) { |
|||
delete(m_pDeflatener); |
|||
}; |
|||
LOG("Client Handler Deleted!"); |
|||
}; |
|||
|
|||
void servletClientHandlerWebRTC::m_fThreadProc( void ){ |
|||
char *ws_guid = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; |
|||
char *head = "HTTP/1.1 200 OK\r\n" |
|||
"Content-Type: text/xml\r\n" |
|||
"Connection: close\r\n" |
|||
"\r\n"; |
|||
char *ws_head = "HTTP/1.1 101 Switching Protocols\r\n" |
|||
//Date: Wed, 25 Oct 2017 10:07:34 GMT |
|||
"Connection: Upgrade\r\n" |
|||
"Upgrade: websocket\r\n" |
|||
"Sec-WebSocket-Accept: %s\r\n" |
|||
"\r\n"; |
|||
char mesg[1024]; |
|||
size_t RecvSize; |
|||
char cWSKey[256]; |
|||
char cWSRep[256]; |
|||
char hostname[64]; |
|||
struct pollfd pfd[1]; |
|||
bool bWebSocketMode = false; |
|||
bool bUpgradeMode = false; |
|||
int nWebSocketVersion = 0; |
|||
pid_t pid = gettid(); |
|||
char pidBuf[16]; |
|||
sprintf(pidBuf,"pid:%d", pid); |
|||
LOG(pidBuf); |
|||
pfd->fd = m_iSocketFID; |
|||
pfd->events = POLLIN; |
|||
ws_parser * m_pParser = NULL; |
|||
ws_msg_manager M; |
|||
std::shared_ptr<ws_msg_manager> tPointer( &M ); |
|||
ws_rng A; |
|||
m_pParser = new ws_parser( false, true, tPointer, A ); //No Secure, Server |
|||
if(m_pParser == NULL ) { |
|||
m_bThreadStatus = TH_ENDED; |
|||
return; |
|||
}; |
|||
m_bThreadStatus = TH_WORKING; |
|||
char cGetURI[255]; |
|||
while( m_bThreadStatus < TH_ENDED ) { |
|||
int RetVal, rcvd; |
|||
char * reqline[256]; |
|||
|
|||
RetVal = poll( pfd, 1, 1000 ); |
|||
|
|||
if( RetVal <= 0 ){ |
|||
if (EINTR == errno) continue; |
|||
LOG_ERROR("Unrecoverable error"); |
|||
m_bThreadStatus = TH_ENDED; |
|||
continue; |
|||
}; |
|||
|
|||
memset(mesg, 0, sizeof(mesg)); |
|||
|
|||
rcvd = recv( m_iSocketFID, mesg, sizeof(mesg), 0); |
|||
|
|||
if ( rcvd <= 0 ) { |
|||
sprintf( mesg, "web recv() error: %s", strerror(errno)); |
|||
LOG_ERROR(mesg); |
|||
m_bThreadStatus = TH_ENDED; |
|||
continue; |
|||
}; |
|||
websocketpp::lib::error_code ec; |
|||
ws_request tRequest; |
|||
size_t consumed = tRequest.consume( mesg, rcvd ); |
|||
LOG( "BONG" ); |
|||
char tBuuuf[256]; |
|||
sprintf( tBuuuf, "Consumed %d bytes of %d to parse", consumed, rcvd ); |
|||
LOG( tBuuuf ); |
|||
if( tRequest.ready() ) { |
|||
LOG("Parsed!"); |
|||
}; |
|||
|
|||
|
|||
#ifdef lksdfljkalsdkfj |
|||
|
|||
|
|||
if( !bWebSocketMode ) { |
|||
uint32_t index = 0; |
|||
#ifdef DEBUG |
|||
LOG("HTTP request handler!"); |
|||
#endif |
|||
reqline[index] = strtok( mesg, "\n" ); |
|||
if( strncmp( reqline[index], "GET", 3 ) == 0 ) { |
|||
char * pPartURI; |
|||
char * pPartPROTO; |
|||
pPartURI = strstr( reqline[index], " " ); |
|||
if( pPartURI != NULL ) { |
|||
pPartURI++; |
|||
pPartPROTO = strstr( pPartURI, " " ); |
|||
pPartPROTO++; |
|||
int URILen = pPartPROTO - pPartURI; |
|||
strncpy( cGetURI, pPartURI, URILen ); |
|||
cGetURI[URILen] = (char)0; |
|||
if(strncmp( pPartPROTO, "HTTP/1.0", 8) != 0 && strncmp( pPartPROTO, "HTTP/1.1", 8) != 0) { |
|||
LOG_ERROR("No HTTP version supplied in request!"); |
|||
if( write( m_iSocketFID, "HTTP/1.1 400 Bad Request\r\n", 26) < 0 ){ |
|||
sprintf( mesg, "Failed returning status 400 to client: %s", strerror(errno)); |
|||
LOG_ERROR(mesg); |
|||
}; |
|||
m_bThreadStatus = TH_ENDED; |
|||
continue; |
|||
}; |
|||
}; |
|||
LOG(cGetURI); |
|||
}; |
|||
// parse rest of request |
|||
while( ( reqline[++index] = strtok( NULL, "\n" ) )!= NULL ) { |
|||
|
|||
if( strncmp( reqline[index], "Connection:", 11 ) == 0 ) { |
|||
char * pPart; |
|||
pPart = strcasestr( reqline[index], "Upgrade" ); |
|||
if( pPart != NULL ) { |
|||
LOG("Upgrade Mode ON"); |
|||
bUpgradeMode = true; |
|||
}; |
|||
}; |
|||
if( strncmp( reqline[index], "Upgrade:", 8 ) == 0 ) { |
|||
if( bUpgradeMode ) { |
|||
char * pPart; |
|||
pPart = strcasestr( reqline[index], "websocket" ); |
|||
if( pPart != NULL ) { |
|||
LOG("WebSocket Mode ON"); |
|||
bWebSocketMode = true; |
|||
}; |
|||
}; |
|||
}; |
|||
if( strncmp( reqline[index], "Sec-WebSocket-Version:", 22 ) == 0 ) { |
|||
char * pPart; |
|||
pPart = strstr( reqline[index], " " ); |
|||
if( pPart != NULL ) { |
|||
char tBuf[CTEXT]; |
|||
nWebSocketVersion = atoi(pPart+1); |
|||
sprintf( tBuf,"Web Socket Version: %d", nWebSocketVersion ); |
|||
LOG( tBuf ); |
|||
}; |
|||
}; |
|||
if( strncmp( reqline[index], "Sec-WebSocket-Key:", 18 ) == 0 ) { |
|||
char * pPart; |
|||
pPart = strstr( reqline[index], " " ); |
|||
if( pPart != NULL ) { |
|||
char tGenStr[256]; |
|||
unsigned char * tBase64; |
|||
size_t nBase64; |
|||
int kLen; |
|||
unsigned char hash[SHA_DIGEST_LENGTH]; // == 20 |
|||
pPart++; |
|||
kLen = strstr(pPart,"\r") - pPart; |
|||
strncpy(cWSKey,pPart,kLen); |
|||
cWSKey[kLen]=(char)0; |
|||
LOG( cWSKey ); |
|||
sprintf( tGenStr, "%s%s", cWSKey, ws_guid ); |
|||
SHA1( (const unsigned char*)tGenStr, strlen(tGenStr), hash ); |
|||
tBase64 = base64_encode( hash, SHA_DIGEST_LENGTH, &nBase64 ); |
|||
strncpy( cWSRep, (const char*)tBase64, nBase64 ); |
|||
free( tBase64 ); |
|||
cWSRep[nBase64] = (char)0; |
|||
LOG( cWSRep ); |
|||
}; |
|||
}; |
|||
if( strncmp( reqline[index], "Sec-WebSocket-Protocol:", 23 ) == 0 ) { |
|||
char * pPart; |
|||
pPart = strstr( reqline[index], " " ); |
|||
if( pPart != NULL ) { |
|||
// Check for protos |
|||
}; |
|||
}; |
|||
if( strncmp( reqline[index], "Sec-WebSocket-Extensions:", 25 ) == 0 ) { |
|||
char * pPart; |
|||
pPart = strstr( reqline[index], " " ); |
|||
if( pPart != NULL ) { |
|||
pPart++; |
|||
if(strncmp( pPart, "permessage-deflate", 18 ) == 0 ) { |
|||
//m_bDeflatePerMessage = true; |
|||
LOG("Using Deflate"); |
|||
}; |
|||
}; |
|||
}; |
|||
}; |
|||
|
|||
gethostname( hostname, sizeof(hostname) ); |
|||
#ifdef DEBUG |
|||
LOG("Sending reply ..."); |
|||
#endif |
|||
if( bWebSocketMode ) { |
|||
LOG( "WebSocket Switcher" ); |
|||
sprintf( mesg, ws_head, cWSRep ); |
|||
send(m_iSocketFID, mesg , strlen(mesg), 0); |
|||
uint8_t * buffer = NULL; |
|||
size_t size = 0; |
|||
SLEEP(20); |
|||
if( assembleFrame( 1, 0, 0, 0, WS_OC_TEXT, (uint8_t *)"H264|-|-|", 9, buffer, size ) ){ |
|||
send( m_iSocketFID, buffer, size, 0 ); |
|||
free( buffer ); |
|||
}; |
|||
} else { |
|||
LOG( "HTTP Responce" ); |
|||
send(m_iSocketFID, head, strlen(head), 0); |
|||
if (send(m_iSocketFID, mesg, strlen(mesg), 0) < 0){ |
|||
sprintf( mesg, "Failed sending file to client: %s", strerror(errno)); |
|||
LOG_ERROR(mesg); |
|||
m_bThreadStatus = TH_ENDED; |
|||
}; |
|||
}; |
|||
} else { |
|||
|
|||
uint8_t test_buffer[] = {0x81,0x05,0x48,0x65,0x6c,0x6c,0x6f}; |
|||
uint8_t * buffer = NULL; |
|||
size_t size = 0; |
|||
if( assembleFrame( 1, 0, 0, 0, WS_OC_TEXT, (uint8_t *)"Hello", 5, buffer, size ) ){ |
|||
send( m_iSocketFID, buffer, size, 0 ); |
|||
char tBuf[256]; |
|||
sprintf( tBuf, "Size of Package: %d", size ); |
|||
LOG( tBuf ); |
|||
for(int i = 0; i < size; i++) { |
|||
sprintf( tBuf, "Pac[%d]: 0x%02x", i, buffer[i] ); |
|||
LOG( tBuf ); |
|||
}; |
|||
free( buffer ); |
|||
}; |
|||
}; |
|||
#endif |
|||
|
|||
}; |
|||
LOG("Client Handler Ended!"); |
|||
shutdown(m_iSocketFID, SHUT_RDWR); |
|||
close(m_iSocketFID); |
|||
}; |
|||
|
|||
bool servletClientHandlerWebRTC::assembleFrame( bool FIN, bool RSV1, bool RSV2, bool RSV3, WS_OPCODE code, uint8_t *in_buffer, size_t in_size, uint8_t *&out_buffer, size_t &out_size, bool bmask, uint32_t mask ){ |
|||
if( in_buffer == NULL ) return false; |
|||
if( out_buffer!= NULL ) { |
|||
LOG_ERROR("Output Buffer Must not be allocated!"); |
|||
return false; |
|||
}; |
|||
if( m_bDeflatePerMessage ) { |
|||
if( m_pDeflatener == NULL ) { |
|||
m_pDeflatener = new zipDataPackage(); |
|||
if( m_pDeflatener == NULL ) { |
|||
LOG_ERROR("Error Create Deflate!"); |
|||
return false; |
|||
}; |
|||
}; |
|||
uint8_t *tDeflatBuffer = NULL; |
|||
size_t BufferSize; |
|||
if( m_pDeflatener->zip( in_buffer, in_size, tDeflatBuffer, BufferSize ) ){ |
|||
if( BufferSize < 127 ) { |
|||
if( bmask ) { |
|||
LOG("MDF<127"); |
|||
out_size = BufferSize + 6; |
|||
} else { |
|||
LOG("NDF<127"); |
|||
out_size = BufferSize + 2; |
|||
}; |
|||
out_buffer = (uint8_t *) malloc( out_size ); |
|||
if(out_buffer == NULL) { |
|||
free( tDeflatBuffer ); |
|||
return false; |
|||
}; |
|||
WS_FRAME_HEADER * tHeader; |
|||
tHeader = (WS_FRAME_HEADER *) out_buffer; |
|||
tHeader->word = 0x0000; |
|||
tHeader->bits.MASK = bmask; |
|||
tHeader->bits.FIN = FIN; |
|||
tHeader->bits.RSV1 = RSV1; |
|||
tHeader->bits.RSV2 = RSV2; |
|||
tHeader->bits.RSV3 = RSV3; |
|||
tHeader->bits.OPCODE = code; |
|||
tHeader->bits.PLEN0 = BufferSize & 0x7F; |
|||
if( bmask ) { |
|||
tHeader->PLE_MASK1 = ( mask >> 16 ) & 0xFFFF; |
|||
tHeader->PLE_MASK2 = mask & 0xFFFF; |
|||
memcpy( out_buffer + 6, tDeflatBuffer, BufferSize ); |
|||
} else { |
|||
memcpy( out_buffer + 2, tDeflatBuffer, BufferSize ); |
|||
} |
|||
free( tDeflatBuffer ); |
|||
return true; |
|||
} else { |
|||
if( bmask ) { |
|||
LOG("MDF>127"); |
|||
out_size = BufferSize + 14; |
|||
} else { |
|||
LOG("MDF>127"); |
|||
out_size = BufferSize + 10; |
|||
}; |
|||
out_buffer = (uint8_t *) malloc( out_size ); |
|||
if(out_buffer == NULL) { |
|||
free( tDeflatBuffer ); |
|||
return false; |
|||
}; |
|||
WS_FRAME_HEADER * tHeader; |
|||
tHeader = (WS_FRAME_HEADER *) out_buffer; |
|||
tHeader->word = 0x0000; |
|||
tHeader->bits.MASK = bmask; |
|||
tHeader->bits.FIN = FIN; |
|||
tHeader->bits.RSV1 = RSV1; |
|||
tHeader->bits.RSV2 = RSV2; |
|||
tHeader->bits.RSV3 = RSV3; |
|||
tHeader->bits.OPCODE = code; |
|||
tHeader->bits.PLEN0 = 0x7F; |
|||
tHeader->PLE_MASK1 = ( BufferSize >> 48 ) & 0xFFFF; |
|||
tHeader->PLE_MASK2 = ( BufferSize >> 32 ) & 0xFFFF; |
|||
tHeader->PLE3 = ( BufferSize >> 16 ) & 0xFFFF; |
|||
tHeader->PLE4 = BufferSize & 0xFFFF; |
|||
if( bmask ) { |
|||
tHeader->MASK3 = ( mask >> 16 ) & 0xFFFF; |
|||
tHeader->MASK4 = mask & 0xFFFF; |
|||
memcpy( out_buffer + 14, tDeflatBuffer, BufferSize ); |
|||
} else { |
|||
memcpy( out_buffer + 10, tDeflatBuffer, BufferSize ); |
|||
} |
|||
free( tDeflatBuffer ); |
|||
return true; |
|||
}; |
|||
} else { |
|||
LOG_ERROR( "Deflat Failure!"); |
|||
if( tDeflatBuffer!= NULL) { |
|||
free (tDeflatBuffer); |
|||
}; |
|||
return false; |
|||
}; |
|||
} else { |
|||
if( in_size < 127 ) { |
|||
if( bmask ) { |
|||
LOG("M00<127"); |
|||
out_size = in_size + 6; |
|||
} else { |
|||
LOG("N00<127"); |
|||
out_size = in_size + 2; |
|||
}; |
|||
out_buffer = (uint8_t *) malloc( out_size ); |
|||
if(out_buffer == NULL) { |
|||
return false; |
|||
}; |
|||
WS_FRAME_HEADER * tHeader; |
|||
tHeader = (WS_FRAME_HEADER *) out_buffer; |
|||
tHeader->word = 0x0000; |
|||
tHeader->bits.MASK = bmask; |
|||
tHeader->bits.FIN = FIN; |
|||
tHeader->bits.RSV1 = RSV1; |
|||
tHeader->bits.RSV2 = RSV2; |
|||
tHeader->bits.RSV3 = RSV3; |
|||
tHeader->bits.OPCODE = code; |
|||
tHeader->bits.PLEN0 = in_size & 0x7F; |
|||
if( bmask ) { |
|||
tHeader->PLE_MASK1 = ( mask >> 16 ) & 0xFFFF; |
|||
tHeader->PLE_MASK2 = mask & 0xFFFF; |
|||
memcpy( out_buffer + 6, in_buffer, in_size ); |
|||
} else { |
|||
memcpy( out_buffer + 2, in_buffer, in_size ); |
|||
}; |
|||
return true; |
|||
} else { |
|||
if( bmask ) { |
|||
LOG("M00>127"); |
|||
out_size = in_size + 14; |
|||
} else { |
|||
LOG("N00>127"); |
|||
out_size = in_size + 10; |
|||
}; |
|||
out_buffer = (uint8_t *) malloc( out_size ); |
|||
if(out_buffer == NULL) { |
|||
return false; |
|||
}; |
|||
WS_FRAME_HEADER * tHeader; |
|||
tHeader = (WS_FRAME_HEADER *) out_buffer; |
|||
tHeader->word = 0x0000; |
|||
tHeader->bits.MASK = bmask; |
|||
tHeader->bits.FIN = FIN; |
|||
tHeader->bits.RSV1 = RSV1; |
|||
tHeader->bits.RSV2 = RSV2; |
|||
tHeader->bits.RSV3 = RSV3; |
|||
tHeader->bits.OPCODE = code; |
|||
tHeader->bits.PLEN0 = 0x7F; |
|||
tHeader->PLE_MASK1 = ( in_size >> 48 ) & 0xFFFF; |
|||
tHeader->PLE_MASK2 = ( in_size >> 32 ) & 0xFFFF; |
|||
tHeader->PLE3 = ( in_size >> 16 ) & 0xFFFF; |
|||
tHeader->PLE4 = in_size & 0xFFFF; |
|||
if( bmask ) { |
|||
tHeader->MASK3 = ( mask >> 16 ) & 0xFFFF; |
|||
tHeader->MASK4 = mask & 0xFFFF; |
|||
memcpy( out_buffer + 14, in_buffer, in_size ); |
|||
} else { |
|||
memcpy( out_buffer + 10, in_buffer, in_size ); |
|||
}; |
|||
return true; |
|||
}; |
|||
}; |
|||
}; |
|||
|
|||
#undef LOG |
|||
#undef LOG_ERROR |
|||
|
|||
@ -0,0 +1,192 @@ |
|||
#include "servletClientHandlerWebRTC.h"
|
|||
#include "servletWebRTC.h"
|
|||
#include "../../components/base/basicFunctionality.h"
|
|||
#include "../../alg/generic/base64.h"
|
|||
#include <openssl/sha.h>
|
|||
#include <websocketpp/http/request.hpp>
|
|||
#include <websocketpp/http/response.hpp>
|
|||
#include <websocketpp/config/core.hpp>
|
|||
#include <websocketpp/processors/hybi13.hpp>
|
|||
|
|||
#define LOG( X ) m_pLog->Log( "WRTC", this, X )
|
|||
#define LOG_ERROR( X ) m_pLog->Log( "WRTC", this, _LOG_ERROR, X )
|
|||
|
|||
typedef websocketpp::config::core ws_config; |
|||
typedef websocketpp::processor::hybi13<ws_config> ws_parser; |
|||
typedef ws_config::request_type ws_request; |
|||
typedef ws_config::response_type ws_response; |
|||
typedef ws_config::message_type ws_message; |
|||
typedef ws_config::con_msg_manager_type ws_msg_manager; |
|||
typedef ws_config::rng_type ws_rng; |
|||
|
|||
|
|||
servletClientHandlerWebRTC::servletClientHandlerWebRTC( servletWebRTC *pPtr, int Socket ):basicThread(){ |
|||
m_pLog = basicLogCollection::getInstance(); |
|||
m_pParent = NULL; |
|||
if( pPtr == NULL ) return; |
|||
m_iSocketFID = accept( Socket, NULL, NULL); |
|||
if ( m_iSocketFID < 0) { |
|||
char tBuf[CTEXT]; |
|||
sprintf(tBuf, "accept() error: %s", strerror(errno)); |
|||
LOG_ERROR(tBuf); |
|||
return; |
|||
}; |
|||
m_pParent = pPtr; |
|||
basicThread::init(); |
|||
}; |
|||
|
|||
servletClientHandlerWebRTC::~servletClientHandlerWebRTC(){ |
|||
basicThread::waitThreadEnd( true ); |
|||
LOG("Client Handler Deleted!"); |
|||
}; |
|||
|
|||
void servletClientHandlerWebRTC::m_fThreadProc( void ){ |
|||
char *ws_head = "HTTP/1.1 101 Switching Protocols\r\n"; |
|||
char mesg[1024]; |
|||
uint8_t buffer[1024]; |
|||
bool bSwitched = false; |
|||
size_t mRecvSize = 0; |
|||
size_t nPackShift = 0; |
|||
size_t mParserConsumed = 0; |
|||
struct pollfd pfd[1]; |
|||
|
|||
#ifdef DEBUG
|
|||
pid_t pid = gettid(); |
|||
char pidBuf[16]; |
|||
sprintf(pidBuf,"pid:%d", pid); |
|||
LOG(pidBuf); |
|||
#endif
|
|||
|
|||
pfd->fd = m_iSocketFID; |
|||
pfd->events = POLLIN; |
|||
|
|||
ws_parser * pParser = NULL; |
|||
ws_request * pRequest = NULL; |
|||
ws_response * pResponse = NULL; |
|||
websocketpp::lib::error_code mErrorCode; |
|||
std::vector< std::string > vSubprotocolList; |
|||
ws_msg_manager M; |
|||
std::shared_ptr<ws_msg_manager> pManagerPtr( &M ); |
|||
ws_rng A; |
|||
|
|||
pParser = new ws_parser( false, true, pManagerPtr, A ); //No Secure, Server
|
|||
if( pParser == NULL ) { |
|||
m_bThreadStatus = TH_ENDED; |
|||
return; |
|||
}; |
|||
m_bThreadStatus = TH_WORKING; |
|||
while( m_bThreadStatus < TH_ENDED ) { |
|||
int RetVal = poll( pfd, 1, 1000 ); |
|||
if( RetVal <= 0 ){ |
|||
if (EINTR == errno) continue; |
|||
LOG_ERROR("Unrecoverable pool error"); |
|||
m_bThreadStatus = TH_ENDED; |
|||
continue; |
|||
}; |
|||
if(!bSwitched) { |
|||
if( nPackShift >= sizeof(mesg) ) { |
|||
LOG_ERROR("Package is too lond - drop connection!"); |
|||
m_bThreadStatus = TH_ENDED; |
|||
continue; |
|||
}; |
|||
mRecvSize = recv( m_iSocketFID, mesg + nPackShift, sizeof(mesg) - nPackShift, 0 ); |
|||
if ( mRecvSize <= 0 ) { |
|||
sprintf( mesg, "recv() error: %s[%d]", strerror(errno), errno ); |
|||
LOG_ERROR(mesg); |
|||
m_bThreadStatus = TH_ENDED; |
|||
continue; |
|||
}; |
|||
if( pRequest == NULL ) { |
|||
pRequest = new ws_request(); |
|||
}; |
|||
if( pRequest == NULL ) { |
|||
LOG_ERROR("Request Constructor error - drop connection!"); |
|||
m_bThreadStatus = TH_ENDED; |
|||
continue; |
|||
}; |
|||
mParserConsumed = pRequest->consume( mesg, mRecvSize ); |
|||
if( pRequest->ready() ) { |
|||
nPackShift = 0; |
|||
LOG( "MSG parsed!" ); |
|||
if( websocketpp::processor::is_websocket_handshake( *pRequest ) ){ |
|||
int nVersion = 0; |
|||
LOG( "MSG is handshake" ); |
|||
nVersion = websocketpp::processor::get_websocket_version( *pRequest ); |
|||
mErrorCode = pParser->extract_subprotocols( *pRequest, vSubprotocolList ); |
|||
if( vSubprotocolList.size() ) { |
|||
LOG( "Subprotocols:" ); |
|||
for(int index = 0; index < vSubprotocolList.size(); index++ ) { |
|||
LOG( vSubprotocolList.at(index).c_str() ); |
|||
}; |
|||
} else { |
|||
LOG("No Subprotocols"); |
|||
}; |
|||
if( pResponse == NULL ) pResponse = new ws_response(); |
|||
if( pResponse == NULL ) { |
|||
delete( pRequest ); |
|||
LOG_ERROR("Response Constructor error - drop connection!"); |
|||
m_bThreadStatus = TH_ENDED; |
|||
continue; |
|||
}; |
|||
pResponse->consume(ws_head, strlen(ws_head)); |
|||
mErrorCode = pParser->process_handshake( *pRequest, "", *pResponse ); |
|||
send( m_iSocketFID, pResponse->raw().c_str(), pResponse->raw().size(), 0); |
|||
delete( pResponse ); |
|||
pResponse = NULL; |
|||
bSwitched = true; |
|||
}; |
|||
delete( pRequest ); |
|||
pRequest = NULL; |
|||
} else { |
|||
nPackShift += mRecvSize; |
|||
}; |
|||
} else { |
|||
if( nPackShift >= sizeof(mesg) ) { |
|||
LOG_ERROR("Package is too lond - drop connection!"); |
|||
m_bThreadStatus = TH_ENDED; |
|||
continue; |
|||
}; |
|||
mRecvSize = recv( m_iSocketFID, buffer + nPackShift, sizeof(buffer) - nPackShift, 0 ); |
|||
if ( mRecvSize <= 0 ) { |
|||
sprintf( mesg, "recv() error: %s[%d]", strerror(errno), errno ); |
|||
LOG_ERROR(mesg); |
|||
m_bThreadStatus = TH_ENDED; |
|||
continue; |
|||
}; |
|||
mParserConsumed = pParser->consume( buffer, mRecvSize, mErrorCode ); |
|||
if( pParser->ready() ) { |
|||
std::shared_ptr<ws_message> msg; |
|||
//ws_message * body_out_msg;
|
|||
LOG("In MESSAGE!"); |
|||
mErrorCode = pParser->finalize_message(); |
|||
in_msg = pParser->get_message(); |
|||
LOG(in_msg->get_payload().c_str()); |
|||
body_out_msg = new ws_message( pManagerPtr ); |
|||
if( body_out_msg != NULL ){ |
|||
LOG("OUT allocated"); |
|||
{ |
|||
std::shared_ptr<ws_message> out_msg(body_out_msg); |
|||
out_msg->set_payload( "KOKOBABA" ); |
|||
LOG("SET PAYLOAD"); |
|||
mErrorCode = pParser->prepare_data_frame( out_msg, out_msg ); |
|||
send( m_iSocketFID, out_msg->get_header().c_str(), out_msg->get_header().size(), 0); |
|||
if(out_msg->get_extension_data().size()) { |
|||
send( m_iSocketFID, out_msg->get_extension_data().c_str(), out_msg->get_extension_data().size(), 0); |
|||
}; |
|||
send( m_iSocketFID, out_msg->get_payload().c_str(), out_msg->get_payload().size(), 0); |
|||
out_msg->recycle(); |
|||
} |
|||
//delete( body_out_msg );
|
|||
LOG("OUT deleted!"); |
|||
}; |
|||
}; |
|||
}; |
|||
}; |
|||
LOG("Client Handler Ended!"); |
|||
shutdown(m_iSocketFID, SHUT_RDWR); |
|||
close(m_iSocketFID); |
|||
}; |
|||
|
|||
#undef LOG
|
|||
#undef LOG_ERROR
|
|||
|
|||
@ -0,0 +1,29 @@ |
|||
#ifndef __SERVLET_WEB_RTC_CLIENT_HANDLER_HEADER__ |
|||
#define __SERVLET_WEB_RTC_CLIENT_HANDLER_HEADER__ |
|||
|
|||
#include "../../components/base/basicThread.h" |
|||
#include "../../alg/generic/libzip.h" |
|||
|
|||
|
|||
#include <sys/types.h> /* See NOTES */ |
|||
#include <sys/socket.h> |
|||
#include <poll.h> |
|||
|
|||
#include <vector> |
|||
|
|||
class servletWebRTC; |
|||
|
|||
class servletClientHandlerWebRTC: public basicThread{ |
|||
private: |
|||
basicLogCollection * m_pLog; |
|||
int m_iSocketFID; |
|||
servletWebRTC * m_pParent; |
|||
public: |
|||
explicit servletClientHandlerWebRTC( servletWebRTC *pPtr, int Socket ); |
|||
~servletClientHandlerWebRTC(); |
|||
virtual void m_fThreadProc( void ); |
|||
}; |
|||
|
|||
typedef std::vector<servletClientHandlerWebRTC *> vectorClientHandlerWebRTC; |
|||
|
|||
#endif |
|||
@ -0,0 +1,117 @@ |
|||
# Names should be added to this file like so: |
|||
# Name or Organization <email address> |
|||
|
|||
Adam Fedor <adam.fedor@gmail.com> |
|||
Akshay Shah <meetakshay99@gmail.com> |
|||
Alexander Brauckmann <a.brauckmann@gmail.com> |
|||
Alexandre Gouaillard <agouaillard@gmail.com> |
|||
Andrew MacDonald <andrew@webrtc.org> |
|||
Anil Kumar <an1kumar@gmail.com> |
|||
Ben Strong <bstrong@gmail.com> |
|||
Bob Withers <bwit@pobox.com> |
|||
Bridger Maxwell <bridgeyman@gmail.com> |
|||
Chris Tserng <tserng@amazon.com> |
|||
Christophe Dumez <ch.dumez@samsung.com> |
|||
Cody Barnes <conceptgenesis@gmail.com> |
|||
Colin Plumb |
|||
Cyril Lashkevich <notorca@gmail.com> |
|||
David Porter <david@porter.me> |
|||
Dax Booysen <dax@younow.com> |
|||
Danail Kirov <dkirovbroadsoft@gmail.com> |
|||
Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> |
|||
Dmitry Lizin <sdkdimon@gmail.com> |
|||
Eric Rescorla, RTFM Inc. <ekr@rtfm.com> |
|||
Frederik Riedel, Frogg GmbH <frederik.riedel@frogg.io> |
|||
Giji Gangadharan <giji.g@samsung.com> |
|||
Graham Yoakum <gyoakum@skobalt.com> |
|||
Gustavo Garcia <gustavogb@gmail.com> |
|||
Hugues Ekra <hekra01@gmail.com> |
|||
Jake Hilton <jakehilton@gmail.com> |
|||
James H. Brown <jbrown@burgoyne.com> |
|||
Jan Kalab <pitlicek@gmail.com> |
|||
Jens Nielsen <jens.nielsen@berotec.se> |
|||
Jiawei Ou <jiawei.ou@gmail.com> |
|||
Jie Mao <maojie0924@gmail.com> |
|||
Jose Antonio Olivera Ortega <josea.olivera@gmail.com> |
|||
Luke Weber <luke.weber@gmail.com> |
|||
Maksim Khobat <maksimkhobat@gmail.com> |
|||
Mallikarjuna Rao V <vm.arjun@samsung.com> |
|||
Manish Jethani <manish.jethani@gmail.com> |
|||
Martin Storsjo <martin@martin.st> |
|||
Matthias Liebig <matthias.gcode@gmail.com> |
|||
Maxim Potapov <vopatop.skam@gmail.com> |
|||
Michael Iedema <michael@kapsulate.com> |
|||
Mike Gilbert <floppymaster@gmail.com> |
|||
Mo Zanaty <mzanaty@cisco.com> |
|||
Pali Rohar |
|||
Paul Kapustin <pkapustin@gmail.com> |
|||
Philipp Hancke <philipp.hancke@googlemail.com> |
|||
Peng Yu <yupeng323@gmail.com> |
|||
Rafael Lopez Diez <rafalopezdiez@gmail.com> |
|||
Ralph Giles <giles@ghostscript.com> |
|||
Riku Voipio <riku.voipio@linaro.org> |
|||
Robert Bares <robert@bares.me> |
|||
Robert Nagy <robert.nagy@gmail.com> |
|||
Ryan Yoakum <ryoakum@skobalt.com> |
|||
Satender Saroha <ssaroha@yahoo.com> |
|||
Sarah Thompson <sarah@telergy.com> |
|||
Saul Kravitz <Saul.Kravitz@celera.com> |
|||
Silviu Caragea <silviu.cpp@gmail.com> |
|||
Stefan Gula <steweg@gmail.com> |
|||
Steve Reid <sreid@sea-to-sky.net> |
|||
Tarun Chawla <trnkumarchawla@gmail.com> |
|||
Uladzislau Susha <landby@gmail.com> |
|||
Vladimir Beloborodov <VladimirTechMan@gmail.com> |
|||
Vicken Simonian <vsimon@gmail.com> |
|||
Victor Costan <costan@gmail.com> |
|||
Xiaohong Xu <freemine@yeah.net> |
|||
Xiaolei Yu <dreifachstein@gmail.com> |
|||
Yura Yaroshevich <yura.yaroshevich@gmail.com> |
|||
Yuriy Pavlyshak <yuriy@appear.in> |
|||
Hans Knoechel <hans@hans-knoechel.de> |
|||
Korniltsev Anatoly <korniltsev.anatoly@gmail.com> |
|||
Todd Wong <todd.wong.ndq@gmail.com> |
|||
Sergio Garcia Murillo <sergio.garcia.murillo@gmail.com> |
|||
Maxim Pavlov <pavllovmax@gmail.com> |
|||
Yusuke Suzuki <utatane.tea@gmail.com> |
|||
Piasy Xu <xz4215@gmail.com> |
|||
Tomas Popela <tomas.popela@gmail.com> |
|||
Jan Grulich <grulja@gmail.com> |
|||
Eike Rathke <erathke@redhat.com> |
|||
Michel Promonet <michel.promonet.1@gmail.com> |
|||
Min Wang <mingewang@gmail.com> |
|||
Ramprakash Jelari <ennajelari@gmail.com> |
|||
CZ Theng <cz.theng@gmail.com> |
|||
|
|||
&yet LLC <*@andyet.com> |
|||
Agora IO <*@agora.io> |
|||
ARM Holdings <*@arm.com> |
|||
BroadSoft Inc. <*@broadsoft.com> |
|||
Facebook Inc. <*@fb.com> |
|||
Google Inc. <*@google.com> |
|||
HyperConnect Inc. <*@hpcnt.com> |
|||
Life On Air Inc. <*@lifeonair.com> |
|||
Intel Corporation <*@intel.com> |
|||
Microsoft Corporation <*@microsoft.com> |
|||
MIPS Technologies <*@mips.com> |
|||
Mozilla Foundation <*@mozilla.com> |
|||
NVIDIA Corporation <*@nvidia.com> |
|||
Opera Software ASA <*@opera.com> |
|||
Optical Tone Ltd <*@opticaltone.com> |
|||
Pengutronix e.K. <*@pengutronix.de> |
|||
Sinch AB <*@sinch.com> |
|||
struktur AG <*@struktur.de> |
|||
Telenor Digital AS <*@telenor.com> |
|||
Temasys Communications <*@temasys.io> |
|||
The Chromium Authors <*@chromium.org> |
|||
The WebRTC Authors <*@webrtc.org> |
|||
Videxio AS <*@videxio.com> |
|||
Vidyo, Inc. <*@vidyo.com> |
|||
Vonage Holdings Corp. <*@vonage.com> |
|||
Wire Swiss GmbH <*@wire.com> |
|||
Miguel Paris <mparisdiaz@gmail.com> |
|||
Vewd Software AS <*@vewd.com> |
|||
Highfive, Inc. <*@highfive.com> |
|||
CoSMo Software Consulting, Pte Ltd <*@cosmosoftware.io> |
|||
Tuple, LLC <*@tuple.app> |
|||
Videona Socialmedia <*@videona.com> |
|||
@ -0,0 +1,712 @@ |
|||
# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
|||
# |
|||
# Use of this source code is governed by a BSD-style license |
|||
# that can be found in the LICENSE file in the root of the source |
|||
# tree. An additional intellectual property rights grant can be found |
|||
# in the file PATENTS. All contributing project authors may |
|||
# be found in the AUTHORS file in the root of the source tree. |
|||
|
|||
# This is the root build file for GN. GN will start processing by loading this |
|||
# file, and recursively load all dependencies until all dependencies are either |
|||
# resolved or known not to exist (which will cause the build to fail). So if |
|||
# you add a new build file, there must be some path of dependencies from this |
|||
# file to your new one or GN won't know about it. |
|||
|
|||
import("//build/config/linux/pkg_config.gni") |
|||
import("//build/config/sanitizers/sanitizers.gni") |
|||
import("webrtc.gni") |
|||
if (rtc_enable_protobuf) { |
|||
import("//third_party/protobuf/proto_library.gni") |
|||
} |
|||
if (is_android) { |
|||
import("//build/config/android/config.gni") |
|||
import("//build/config/android/rules.gni") |
|||
} |
|||
|
|||
if (!build_with_chromium) { |
|||
# This target should (transitively) cause everything to be built; if you run |
|||
# 'ninja default' and then 'ninja all', the second build should do no work. |
|||
group("default") { |
|||
testonly = true |
|||
deps = [ |
|||
":webrtc", |
|||
] |
|||
if (rtc_build_examples) { |
|||
deps += [ "examples" ] |
|||
} |
|||
if (rtc_build_tools) { |
|||
deps += [ "rtc_tools" ] |
|||
} |
|||
if (rtc_include_tests) { |
|||
deps += [ |
|||
":rtc_unittests", |
|||
":slow_tests", |
|||
":video_engine_tests", |
|||
":webrtc_lib_link_test", |
|||
":webrtc_nonparallel_tests", |
|||
":webrtc_perf_tests", |
|||
"common_audio:common_audio_unittests", |
|||
"common_video:common_video_unittests", |
|||
"examples:examples_unittests", |
|||
"media:rtc_media_unittests", |
|||
"modules:modules_tests", |
|||
"modules:modules_unittests", |
|||
"modules/audio_coding:audio_coding_tests", |
|||
"modules/audio_processing:audio_processing_tests", |
|||
"modules/remote_bitrate_estimator:rtp_to_text", |
|||
"modules/rtp_rtcp:test_packet_masks_metrics", |
|||
"modules/video_capture:video_capture_internal_impl", |
|||
"pc:peerconnection_unittests", |
|||
"pc:rtc_pc_unittests", |
|||
"rtc_tools:rtp_generator", |
|||
"stats:rtc_stats_unittests", |
|||
"system_wrappers:system_wrappers_unittests", |
|||
"test", |
|||
"video:screenshare_loopback", |
|||
"video:sv_loopback", |
|||
"video:video_loopback", |
|||
] |
|||
if (is_android) { |
|||
deps += [ |
|||
":android_junit_tests", |
|||
"sdk/android:android_instrumentation_test_apk", |
|||
] |
|||
} else { |
|||
deps += [ "modules/video_capture:video_capture_tests" ] |
|||
} |
|||
if (rtc_enable_protobuf) { |
|||
deps += [ |
|||
"audio:low_bandwidth_audio_test", |
|||
"logging:rtc_event_log_rtp_dump", |
|||
] |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
# Abseil Flags by default doesn't register command line flags on mobile |
|||
# platforms, WebRTC tests requires them (e.g. on simualtors) so this |
|||
# config will be applied to testonly targets globally (see webrtc.gni). |
|||
config("absl_flags_configs") { |
|||
defines = [ "ABSL_FLAGS_STRIP_NAMES=0" ] |
|||
} |
|||
|
|||
config("library_impl_config") { |
|||
# Build targets that contain WebRTC implementation need this macro to |
|||
# be defined in order to correctly export symbols when is_component_build |
|||
# is true. |
|||
# For more info see: rtc_base/build/rtc_export.h. |
|||
defines = [ "WEBRTC_LIBRARY_IMPL" ] |
|||
} |
|||
|
|||
# Contains the defines and includes in common.gypi that are duplicated both as |
|||
# target_defaults and direct_dependent_settings. |
|||
config("common_inherited_config") { |
|||
defines = [] |
|||
cflags = [] |
|||
ldflags = [] |
|||
|
|||
if (rtc_enable_symbol_export) { |
|||
defines = [ "WEBRTC_ENABLE_SYMBOL_EXPORT" ] |
|||
} |
|||
|
|||
if (build_with_mozilla) { |
|||
defines += [ "WEBRTC_MOZILLA_BUILD" ] |
|||
} |
|||
|
|||
if (!rtc_builtin_ssl_root_certificates) { |
|||
defines += [ "WEBRTC_EXCLUDE_BUILT_IN_SSL_ROOT_CERTS" ] |
|||
} |
|||
|
|||
# Some tests need to declare their own trace event handlers. If this define is |
|||
# not set, the first time TRACE_EVENT_* is called it will store the return |
|||
# value for the current handler in an static variable, so that subsequent |
|||
# changes to the handler for that TRACE_EVENT_* will be ignored. |
|||
# So when tests are included, we set this define, making it possible to use |
|||
# different event handlers in different tests. |
|||
if (rtc_include_tests) { |
|||
defines += [ "WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=1" ] |
|||
} else { |
|||
defines += [ "WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=0" ] |
|||
} |
|||
if (build_with_chromium) { |
|||
defines += [ "WEBRTC_CHROMIUM_BUILD" ] |
|||
include_dirs = [ |
|||
# The overrides must be included first as that is the mechanism for |
|||
# selecting the override headers in Chromium. |
|||
"../webrtc_overrides", |
|||
|
|||
# Allow includes to be prefixed with webrtc/ in case it is not an |
|||
# immediate subdirectory of the top-level. |
|||
".", |
|||
|
|||
# Just like the root WebRTC directory is added to include path, the |
|||
# corresponding directory tree with generated files needs to be added too. |
|||
# Note: this path does not change depending on the current target, e.g. |
|||
# it is always "//gen/third_party/webrtc" when building with Chromium. |
|||
# See also: http://cs.chromium.org/?q=%5C"default_include_dirs |
|||
# https://gn.googlesource.com/gn/+/master/docs/reference.md#target_gen_dir |
|||
target_gen_dir, |
|||
] |
|||
} |
|||
if (is_posix || is_fuchsia) { |
|||
defines += [ "WEBRTC_POSIX" ] |
|||
} |
|||
if (is_ios) { |
|||
defines += [ |
|||
"WEBRTC_MAC", |
|||
"WEBRTC_IOS", |
|||
] |
|||
} |
|||
if (is_linux) { |
|||
defines += [ "WEBRTC_LINUX" ] |
|||
} |
|||
if (is_mac) { |
|||
defines += [ "WEBRTC_MAC" ] |
|||
} |
|||
if (is_fuchsia) { |
|||
defines += [ "WEBRTC_FUCHSIA" ] |
|||
} |
|||
if (is_win) { |
|||
defines += [ "WEBRTC_WIN" ] |
|||
} |
|||
if (is_android) { |
|||
defines += [ |
|||
"WEBRTC_LINUX", |
|||
"WEBRTC_ANDROID", |
|||
] |
|||
|
|||
if (build_with_mozilla) { |
|||
defines += [ "WEBRTC_ANDROID_OPENSLES" ] |
|||
} |
|||
} |
|||
if (is_chromeos) { |
|||
defines += [ "CHROMEOS" ] |
|||
} |
|||
|
|||
if (rtc_sanitize_coverage != "") { |
|||
assert(is_clang, "sanitizer coverage requires clang") |
|||
cflags += [ "-fsanitize-coverage=${rtc_sanitize_coverage}" ] |
|||
ldflags += [ "-fsanitize-coverage=${rtc_sanitize_coverage}" ] |
|||
} |
|||
|
|||
if (is_ubsan) { |
|||
cflags += [ "-fsanitize=float-cast-overflow" ] |
|||
} |
|||
} |
|||
|
|||
# TODO(bugs.webrtc.org/9693): Remove the possibility to suppress this warning |
|||
# as soon as WebRTC compiles without it. |
|||
config("no_exit_time_destructors") { |
|||
if (is_clang) { |
|||
cflags = [ "-Wno-exit-time-destructors" ] |
|||
} |
|||
} |
|||
|
|||
# TODO(bugs.webrtc.org/9693): Remove the possibility to suppress this warning |
|||
# as soon as WebRTC compiles without it. |
|||
config("no_global_constructors") { |
|||
if (is_clang) { |
|||
cflags = [ "-Wno-global-constructors" ] |
|||
} |
|||
} |
|||
|
|||
config("rtc_prod_config") { |
|||
# Ideally, WebRTC production code (but not test code) should have these flags. |
|||
if (is_clang) { |
|||
cflags = [ |
|||
"-Wexit-time-destructors", |
|||
"-Wglobal-constructors", |
|||
] |
|||
} |
|||
} |
|||
|
|||
config("common_config") { |
|||
cflags = [] |
|||
cflags_c = [] |
|||
cflags_cc = [] |
|||
cflags_objc = [] |
|||
defines = [] |
|||
|
|||
if (rtc_enable_protobuf) { |
|||
defines += [ "WEBRTC_ENABLE_PROTOBUF=1" ] |
|||
} else { |
|||
defines += [ "WEBRTC_ENABLE_PROTOBUF=0" ] |
|||
} |
|||
|
|||
if (rtc_include_internal_audio_device) { |
|||
defines += [ "WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE" ] |
|||
} |
|||
|
|||
if (rtc_libvpx_build_vp9) { |
|||
defines += [ "RTC_ENABLE_VP9" ] |
|||
} |
|||
|
|||
if (rtc_enable_sctp) { |
|||
defines += [ "HAVE_SCTP" ] |
|||
} |
|||
|
|||
if (rtc_enable_external_auth) { |
|||
defines += [ "ENABLE_EXTERNAL_AUTH" ] |
|||
} |
|||
|
|||
if (rtc_use_h264) { |
|||
defines += [ "WEBRTC_USE_H264" ] |
|||
} |
|||
|
|||
if (build_with_chromium) { |
|||
defines += [ |
|||
# NOTICE: Since common_inherited_config is used in public_configs for our |
|||
# targets, there's no point including the defines in that config here. |
|||
# TODO(kjellander): Cleanup unused ones and move defines closer to the |
|||
# source when webrtc:4256 is completed. |
|||
"HAVE_WEBRTC_VIDEO", |
|||
"LOGGING_INSIDE_WEBRTC", |
|||
] |
|||
} else { |
|||
if (is_posix || is_fuchsia) { |
|||
# Enable more warnings: -Wextra is currently disabled in Chromium. |
|||
cflags = [ |
|||
"-Wextra", |
|||
|
|||
# Repeat some flags that get overridden by -Wextra. |
|||
"-Wno-unused-parameter", |
|||
"-Wno-missing-field-initializers", |
|||
] |
|||
cflags_c += [ |
|||
# TODO(bugs.webrtc.org/9029): enable commented compiler flags. |
|||
# Some of these flags should also be added to cflags_objc. |
|||
|
|||
# "-Wextra", (used when building C++ but not when building C) |
|||
# "-Wmissing-prototypes", (C/Obj-C only) |
|||
# "-Wmissing-declarations", (ensure this is always used C/C++, etc..) |
|||
"-Wstrict-prototypes", |
|||
|
|||
# "-Wpointer-arith", (ensure this is always used C/C++, etc..) |
|||
# "-Wbad-function-cast", (C/Obj-C only) |
|||
# "-Wnested-externs", (C/Obj-C only) |
|||
] |
|||
cflags_objc += [ "-Wstrict-prototypes" ] |
|||
cflags_cc = [ |
|||
"-Wnon-virtual-dtor", |
|||
|
|||
# This is enabled for clang; enable for gcc as well. |
|||
"-Woverloaded-virtual", |
|||
] |
|||
} |
|||
|
|||
if (is_clang) { |
|||
cflags += [ |
|||
"-Wc++11-narrowing", |
|||
"-Wimplicit-fallthrough", |
|||
"-Wthread-safety", |
|||
"-Winconsistent-missing-override", |
|||
"-Wundef", |
|||
] |
|||
|
|||
# use_xcode_clang only refers to the iOS toolchain, host binaries use |
|||
# chromium's clang always. |
|||
if (!is_nacl && |
|||
(!use_xcode_clang || current_toolchain == host_toolchain)) { |
|||
# Flags NaCl (Clang 3.7) and Xcode 7.3 (Clang clang-703.0.31) do not |
|||
# recognize. |
|||
cflags += [ "-Wunused-lambda-capture" ] |
|||
} |
|||
} |
|||
|
|||
if (is_win && !is_clang) { |
|||
# MSVC warning suppressions (needed to use Abseil). |
|||
# TODO(bugs.webrtc.org/9274): Remove these warnings as soon as MSVC allows |
|||
# external headers warning suppression (or fix them upstream). |
|||
cflags += [ "/wd4702" ] # unreachable code |
|||
} |
|||
} |
|||
|
|||
if (current_cpu == "arm64") { |
|||
defines += [ "WEBRTC_ARCH_ARM64" ] |
|||
defines += [ "WEBRTC_HAS_NEON" ] |
|||
} |
|||
|
|||
if (current_cpu == "arm") { |
|||
defines += [ "WEBRTC_ARCH_ARM" ] |
|||
if (arm_version >= 7) { |
|||
defines += [ "WEBRTC_ARCH_ARM_V7" ] |
|||
if (arm_use_neon) { |
|||
defines += [ "WEBRTC_HAS_NEON" ] |
|||
} |
|||
} |
|||
} |
|||
|
|||
if (current_cpu == "mipsel") { |
|||
defines += [ "MIPS32_LE" ] |
|||
if (mips_float_abi == "hard") { |
|||
defines += [ "MIPS_FPU_LE" ] |
|||
} |
|||
if (mips_arch_variant == "r2") { |
|||
defines += [ "MIPS32_R2_LE" ] |
|||
} |
|||
if (mips_dsp_rev == 1) { |
|||
defines += [ "MIPS_DSP_R1_LE" ] |
|||
} else if (mips_dsp_rev == 2) { |
|||
defines += [ |
|||
"MIPS_DSP_R1_LE", |
|||
"MIPS_DSP_R2_LE", |
|||
] |
|||
} |
|||
} |
|||
|
|||
if (is_android && !is_clang) { |
|||
# The Android NDK doesn"t provide optimized versions of these |
|||
# functions. Ensure they are disabled for all compilers. |
|||
cflags += [ |
|||
"-fno-builtin-cos", |
|||
"-fno-builtin-sin", |
|||
"-fno-builtin-cosf", |
|||
"-fno-builtin-sinf", |
|||
] |
|||
} |
|||
|
|||
if (use_fuzzing_engine && optimize_for_fuzzing) { |
|||
# Used in Chromium's overrides to disable logging |
|||
defines += [ "WEBRTC_UNSAFE_FUZZER_MODE" ] |
|||
} |
|||
|
|||
if (!build_with_chromium && rtc_win_undef_unicode) { |
|||
cflags += [ |
|||
"/UUNICODE", |
|||
"/U_UNICODE", |
|||
] |
|||
} |
|||
} |
|||
|
|||
config("common_objc") { |
|||
libs = [ "Foundation.framework" ] |
|||
|
|||
if (rtc_use_metal_rendering) { |
|||
defines = [ "RTC_SUPPORTS_METAL" ] |
|||
} |
|||
} |
|||
|
|||
if (!build_with_chromium) { |
|||
# Target to build all the WebRTC production code. |
|||
rtc_static_library("webrtc") { |
|||
# Only the root target and the test should depend on this. |
|||
visibility = [ |
|||
"//:default", |
|||
"//:webrtc_lib_link_test", |
|||
] |
|||
|
|||
sources = [] |
|||
complete_static_lib = true |
|||
suppressed_configs += [ "//build/config/compiler:thin_archive" ] |
|||
defines = [] |
|||
|
|||
deps = [ |
|||
":webrtc_common", |
|||
"api:create_peerconnection_factory", |
|||
"api:libjingle_peerconnection_api", |
|||
"api:rtc_error", |
|||
"api:transport_api", |
|||
"api/crypto", |
|||
"api/rtc_event_log:rtc_event_log_factory", |
|||
"api/task_queue", |
|||
"api/task_queue:default_task_queue_factory", |
|||
"audio", |
|||
"call", |
|||
"common_audio", |
|||
"common_video", |
|||
"logging:rtc_event_log_api", |
|||
"media", |
|||
"modules", |
|||
"modules/video_capture:video_capture_internal_impl", |
|||
"p2p:rtc_p2p", |
|||
"pc:libjingle_peerconnection", |
|||
"pc:peerconnection", |
|||
"pc:rtc_pc", |
|||
"pc:rtc_pc_base", |
|||
"rtc_base", |
|||
"sdk", |
|||
"video", |
|||
] |
|||
|
|||
if (rtc_include_builtin_audio_codecs) { |
|||
deps += [ |
|||
"api/audio_codecs:builtin_audio_decoder_factory", |
|||
"api/audio_codecs:builtin_audio_encoder_factory", |
|||
] |
|||
} |
|||
|
|||
if (rtc_include_builtin_video_codecs) { |
|||
deps += [ |
|||
"api/video_codecs:builtin_video_decoder_factory", |
|||
"api/video_codecs:builtin_video_encoder_factory", |
|||
] |
|||
} |
|||
|
|||
if (build_with_mozilla) { |
|||
deps += [ |
|||
"api/video:video_frame", |
|||
"api/video:video_rtp_headers", |
|||
] |
|||
} else { |
|||
deps += [ |
|||
"api", |
|||
"logging", |
|||
"p2p", |
|||
"pc", |
|||
"stats", |
|||
] |
|||
} |
|||
|
|||
if (rtc_enable_protobuf) { |
|||
defines += [ "ENABLE_RTC_EVENT_LOG" ] |
|||
deps += [ "logging:rtc_event_log_proto" ] |
|||
} |
|||
} |
|||
|
|||
if (rtc_include_tests) { |
|||
rtc_executable("webrtc_lib_link_test") { |
|||
testonly = true |
|||
|
|||
sources = [ |
|||
"webrtc_lib_link_test.cc", |
|||
] |
|||
deps = [ |
|||
# NOTE: Don't add deps here. If this test fails to link, it means you |
|||
# need to add stuff to the webrtc static lib target above. |
|||
":webrtc", |
|||
] |
|||
} |
|||
} |
|||
} |
|||
|
|||
rtc_source_set("webrtc_common") { |
|||
# Client code SHOULD NOT USE THIS TARGET, but for now it needs to be public |
|||
# because there exists client code that uses it. |
|||
# TODO(bugs.webrtc.org/9808): Move to private visibility as soon as that |
|||
# client code gets updated. |
|||
visibility = [ "*" ] |
|||
sources = [ |
|||
"common_types.h", |
|||
] |
|||
} |
|||
|
|||
if (use_libfuzzer || use_afl) { |
|||
# This target is only here for gn to discover fuzzer build targets under |
|||
# webrtc/test/fuzzers/. |
|||
group("webrtc_fuzzers_dummy") { |
|||
testonly = true |
|||
deps = [ |
|||
"test/fuzzers:webrtc_fuzzer_main", |
|||
] |
|||
} |
|||
} |
|||
|
|||
if (rtc_include_tests) { |
|||
rtc_test("rtc_unittests") { |
|||
testonly = true |
|||
|
|||
deps = [ |
|||
":webrtc_common", |
|||
"api:compile_all_headers", |
|||
"api:rtc_api_unittests", |
|||
"api/audio/test:audio_api_unittests", |
|||
"api/audio_codecs/test:audio_codecs_api_unittests", |
|||
"api/video/test:rtc_api_video_unittests", |
|||
"api/video_codecs/test:video_codecs_api_unittests", |
|||
"call:fake_network_pipe_unittests", |
|||
"p2p:libstunprober_unittests", |
|||
"p2p:rtc_p2p_unittests", |
|||
"rtc_base:rtc_base_approved_unittests", |
|||
"rtc_base:rtc_base_unittests", |
|||
"rtc_base:rtc_json_unittests", |
|||
"rtc_base:rtc_numerics_unittests", |
|||
"rtc_base:rtc_task_queue_unittests", |
|||
"rtc_base:sigslot_unittest", |
|||
"rtc_base:weak_ptr_unittests", |
|||
"rtc_base/experiments:experiments_unittests", |
|||
"rtc_base/synchronization:sequence_checker_unittests", |
|||
"rtc_base/task_utils:to_queued_task_unittests", |
|||
"sdk:sdk_tests", |
|||
"test:rtp_test_utils", |
|||
"test:test_main", |
|||
"test/network:network_emulation_unittests", |
|||
] |
|||
|
|||
if (rtc_enable_protobuf) { |
|||
deps += [ "logging:rtc_event_log_tests" ] |
|||
} |
|||
|
|||
if (is_android) { |
|||
# Do not use Chromium's launcher. native_unittests defines its own JNI_OnLoad. |
|||
use_default_launcher = false |
|||
|
|||
deps += [ |
|||
"sdk/android:native_unittests", |
|||
"sdk/android:native_unittests_java", |
|||
"//testing/android/native_test:native_test_support", |
|||
] |
|||
shard_timeout = 900 |
|||
} |
|||
|
|||
if (is_ios || is_mac) { |
|||
deps += [ "sdk:rtc_unittests_objc" ] |
|||
} |
|||
} |
|||
|
|||
# This runs tests that must run in real time and therefore can take some |
|||
# time to execute. They are in a separate executable to avoid making the |
|||
# regular unittest suite too slow to run frequently. |
|||
rtc_test("slow_tests") { |
|||
testonly = true |
|||
deps = [ |
|||
"rtc_base/task_utils:repeating_task_unittests", |
|||
"test:test_main", |
|||
] |
|||
} |
|||
|
|||
# TODO(pbos): Rename test suite, this is no longer "just" for video targets. |
|||
video_engine_tests_resources = [ |
|||
"resources/foreman_cif_short.yuv", |
|||
"resources/voice_engine/audio_long16.pcm", |
|||
] |
|||
|
|||
if (is_ios) { |
|||
bundle_data("video_engine_tests_bundle_data") { |
|||
testonly = true |
|||
sources = video_engine_tests_resources |
|||
outputs = [ |
|||
"{{bundle_resources_dir}}/{{source_file_part}}", |
|||
] |
|||
} |
|||
} |
|||
|
|||
rtc_test("video_engine_tests") { |
|||
testonly = true |
|||
deps = [ |
|||
"audio:audio_tests", |
|||
|
|||
# TODO(eladalon): call_tests aren't actually video-specific, so we |
|||
# should move them to a more appropriate test suite. |
|||
"call:call_tests", |
|||
"test:test_common", |
|||
"test:test_main", |
|||
"test:video_test_common", |
|||
"video:video_tests", |
|||
] |
|||
data = video_engine_tests_resources |
|||
if (is_android) { |
|||
deps += [ "//testing/android/native_test:native_test_native_code" ] |
|||
shard_timeout = 900 |
|||
} |
|||
if (is_ios) { |
|||
deps += [ ":video_engine_tests_bundle_data" ] |
|||
} |
|||
} |
|||
|
|||
webrtc_perf_tests_resources = [ |
|||
"resources/audio_coding/speech_mono_16kHz.pcm", |
|||
"resources/audio_coding/speech_mono_32_48kHz.pcm", |
|||
"resources/audio_coding/testfile32kHz.pcm", |
|||
"resources/ConferenceMotion_1280_720_50.yuv", |
|||
"resources/difficult_photo_1850_1110.yuv", |
|||
"resources/foreman_cif.yuv", |
|||
"resources/paris_qcif.yuv", |
|||
"resources/photo_1850_1110.yuv", |
|||
"resources/presentation_1850_1110.yuv", |
|||
"resources/voice_engine/audio_long16.pcm", |
|||
"resources/web_screenshot_1850_1110.yuv", |
|||
] |
|||
|
|||
if (is_ios) { |
|||
bundle_data("webrtc_perf_tests_bundle_data") { |
|||
testonly = true |
|||
sources = webrtc_perf_tests_resources |
|||
outputs = [ |
|||
"{{bundle_resources_dir}}/{{source_file_part}}", |
|||
] |
|||
} |
|||
} |
|||
|
|||
rtc_test("webrtc_perf_tests") { |
|||
testonly = true |
|||
deps = [ |
|||
"audio:audio_perf_tests", |
|||
"call:call_perf_tests", |
|||
"modules/audio_coding:audio_coding_perf_tests", |
|||
"modules/audio_processing:audio_processing_perf_tests", |
|||
"pc:peerconnection_perf_tests", |
|||
"test:test_main", |
|||
"video:video_full_stack_tests", |
|||
"video:video_pc_full_stack_tests", |
|||
] |
|||
|
|||
data = webrtc_perf_tests_resources |
|||
if (is_android) { |
|||
deps += [ "//testing/android/native_test:native_test_native_code" ] |
|||
shard_timeout = 4500 |
|||
} |
|||
if (is_ios) { |
|||
deps += [ ":webrtc_perf_tests_bundle_data" ] |
|||
} |
|||
} |
|||
|
|||
rtc_test("webrtc_nonparallel_tests") { |
|||
testonly = true |
|||
deps = [ |
|||
"rtc_base:rtc_base_nonparallel_tests", |
|||
] |
|||
if (is_android) { |
|||
deps += [ "//testing/android/native_test:native_test_support" ] |
|||
shard_timeout = 900 |
|||
} |
|||
} |
|||
|
|||
if (is_android) { |
|||
junit_binary("android_junit_tests") { |
|||
java_files = [ |
|||
"examples/androidjunit/src/org/appspot/apprtc/BluetoothManagerTest.java", |
|||
"examples/androidjunit/src/org/appspot/apprtc/DirectRTCClientTest.java", |
|||
"examples/androidjunit/src/org/appspot/apprtc/TCPChannelClientTest.java", |
|||
"sdk/android/tests/src/org/webrtc/AndroidVideoDecoderTest.java", |
|||
"sdk/android/tests/src/org/webrtc/CameraEnumerationTest.java", |
|||
"sdk/android/tests/src/org/webrtc/CodecTestHelper.java", |
|||
"sdk/android/tests/src/org/webrtc/FakeMediaCodecWrapper.java", |
|||
"sdk/android/tests/src/org/webrtc/GlGenericDrawerTest.java", |
|||
"sdk/android/tests/src/org/webrtc/HardwareVideoEncoderTest.java", |
|||
"sdk/android/tests/src/org/webrtc/ScalingSettingsTest.java", |
|||
"sdk/android/tests/src/org/webrtc/CryptoOptionsTest.java", |
|||
] |
|||
|
|||
deps = [ |
|||
"examples:AppRTCMobile_javalib", |
|||
"sdk/android:libjingle_peerconnection_java", |
|||
"//base:base_java_test_support", |
|||
"//third_party/google-truth:google_truth_java", |
|||
] |
|||
|
|||
additional_jar_files = [ [ |
|||
"sdk/android/tests/resources/robolectric.properties", |
|||
"robolectric.properties", |
|||
] ] |
|||
} |
|||
} |
|||
} |
|||
|
|||
# ---- Poisons ---- |
|||
# |
|||
# Here is one empty dummy target for each poison type (needed because |
|||
# "being poisonous with poison type foo" is implemented as "depends on |
|||
# //:poison_foo"). |
|||
# |
|||
# The set of poison_* targets needs to be kept in sync with the |
|||
# `all_poison_types` list in webrtc.gni. |
|||
# |
|||
group("poison_audio_codecs") { |
|||
} |
|||
|
|||
group("poison_software_video_codecs") { |
|||
} |
|||
|
|||
group("poison_default_task_queue") { |
|||
} |
|||
@ -0,0 +1,68 @@ |
|||
# Contributors Code of Conduct |
|||
|
|||
Google and the WebRTC team are committed to preserving and fostering a diverse, welcoming and open |
|||
community. The WebRTC project is open to contributors from all walks of life and should be a |
|||
harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender |
|||
identity and expression, level of experience, nationality, personal appearance, race, religion, or |
|||
sexual identity and orientation. |
|||
|
|||
## Scope |
|||
This Code of Conduct applies to our repos and organizations, mailing lists, blog content, and any |
|||
other WebRTC-supported communication group, as well as any private communication initiated in the |
|||
context of these spaces. |
|||
|
|||
## Standards |
|||
Examples of behavior that contributes to creating a positive environment include: |
|||
|
|||
* Using welcoming and inclusive language |
|||
* Being respectful of differing viewpoints and experiences |
|||
* Gracefully accepting constructive criticism |
|||
* Focusing on what is best for the community |
|||
* Showing empathy towards other community members |
|||
|
|||
Examples of unacceptable behavior by participants include: |
|||
|
|||
* The use of sexualized language or imagery and unwelcome sexual attention or advances |
|||
* Trolling, insulting/derogatory comments, and personal or political attacks |
|||
* Public or private harassment |
|||
* Publishing others' private information, such as a physical or electronic address, without explicit |
|||
permission |
|||
* Other conduct which could reasonably be considered inappropriate in a professional setting |
|||
|
|||
## Responsibilities |
|||
|
|||
You are empowered to politely engage when you feel that you or others are disrespected. The person |
|||
making you feel uncomfortable may not be aware of what they are doing - politely bringing their |
|||
behavior to their attention is encouraged. |
|||
|
|||
If you are uncomfortable speaking up, or feel that your concerns are not being duly considered, you |
|||
can email community@webrtc.org to request involvement from a community manager. All concerns shared |
|||
with community managers will be kept confidential. While all reports will be taken seriously, the |
|||
WebRTC community managers may not act on complaints that they feel are not violations of this code |
|||
of conduct. |
|||
|
|||
## Enforcement |
|||
|
|||
Consequences for failing to comply with this policy may include, at the sole discretion of the |
|||
WebRTC community managers: |
|||
|
|||
* a request for an apology; |
|||
* a private or public warning or reprimand; |
|||
* a temporary ban from the mailing list, blog, WebRTC repository or organization, or other |
|||
WebRTC-supported communication group, including loss of committer status; |
|||
* a permanent ban from any of the above, or from all current and future WebRTC-supported or |
|||
Google-supported communities, including loss of committer status. |
|||
|
|||
Participants warned to stop any harassing behavior are expected to comply immediately; failure to do |
|||
so will result in an escalation of consequences. |
|||
|
|||
The decisions of the WebRTC community managers may be appealed via community-appeals@webrtc.org. |
|||
|
|||
## Acknowledgements |
|||
|
|||
This Code of Conduct is based on Contributor Covenant, version 1.4, |
|||
available [here](http://contributor-covenant.org/version/1/4) and [Chromium](https://chromium.googlesource.com/chromium/src/+/master/CODE_OF_CONDUCT.md) |
|||
|
|||
## License |
|||
|
|||
This Code of Conduct is available for reuse under the Creative Commons Zero (CC0) license. |
|||
2290
lib/data/webrtc/DEPS
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,11 @@ |
|||
# Current list of eng reviewers mostly for the purpose of reviewing |
|||
# dependencies on third-party directories (because //ENG_REVIEW_OWNERS is |
|||
# included by //third_party/OWNERS). |
|||
|
|||
# People listed in this file will only have to coordinate with chromium's eng |
|||
# review owners to ensure that the added dependency was OK. |
|||
|
|||
danilchap@webrtc.org |
|||
kwiberg@webrtc.org |
|||
mbonadei@webrtc.org |
|||
phoglund@webrtc.org |
|||
@ -0,0 +1,29 @@ |
|||
Copyright (c) 2011, The WebRTC project authors. All rights reserved. |
|||
|
|||
Redistribution and use in source and binary forms, with or without |
|||
modification, are permitted provided that the following conditions are |
|||
met: |
|||
|
|||
* Redistributions of source code must retain the above copyright |
|||
notice, this list of conditions and the following disclaimer. |
|||
|
|||
* Redistributions in binary form must reproduce the above copyright |
|||
notice, this list of conditions and the following disclaimer in |
|||
the documentation and/or other materials provided with the |
|||
distribution. |
|||
|
|||
* Neither the name of Google nor the names of its contributors may |
|||
be used to endorse or promote products derived from this software |
|||
without specific prior written permission. |
|||
|
|||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|||
@ -0,0 +1,23 @@ |
|||
henrika@webrtc.org |
|||
juberti@webrtc.org |
|||
kwiberg@webrtc.org |
|||
mflodman@webrtc.org |
|||
phoglund@webrtc.org |
|||
stefan@webrtc.org |
|||
tommi@webrtc.org |
|||
per-file .gitignore=* |
|||
per-file .gn=mbonadei@webrtc.org |
|||
per-file *.gn=mbonadei@webrtc.org |
|||
per-file *.gni=mbonadei@webrtc.org |
|||
per-file AUTHORS=* |
|||
per-file DEPS=* |
|||
per-file pylintrc=phoglund@webrtc.org |
|||
per-file WATCHLISTS=* |
|||
per-file abseil-in-webrtc.md=danilchap@webrtc.org |
|||
per-file abseil-in-webrtc.md=kwiberg@webrtc.org |
|||
per-file abseil-in-webrtc.md=mbonadei@webrtc.org |
|||
per-file style-guide.md=danilchap@webrtc.org |
|||
per-file style-guide.md=kwiberg@webrtc.org |
|||
per-file native-api.md=kwiberg@webrtc.org |
|||
|
|||
# COMPONENT: Internals>WebRTC |
|||
@ -0,0 +1,24 @@ |
|||
Additional IP Rights Grant (Patents) |
|||
|
|||
"This implementation" means the copyrightable works distributed by |
|||
Google as part of the WebRTC code package. |
|||
|
|||
Google hereby grants to you a perpetual, worldwide, non-exclusive, |
|||
no-charge, irrevocable (except as stated in this section) patent |
|||
license to make, have made, use, offer to sell, sell, import, |
|||
transfer, and otherwise run, modify and propagate the contents of this |
|||
implementation of the WebRTC code package, where such license applies |
|||
only to those patent claims, both currently owned by Google and |
|||
acquired in the future, licensable by Google that are necessarily |
|||
infringed by this implementation of the WebRTC code package. This |
|||
grant does not include claims that would be infringed only as a |
|||
consequence of further modification of this implementation. If you or |
|||
your agent or exclusive licensee institute or order or agree to the |
|||
institution of patent litigation against any entity (including a |
|||
cross-claim or counterclaim in a lawsuit) alleging that this |
|||
implementation of the WebRTC code package or any code incorporated |
|||
within this implementation of the WebRTC code package constitutes |
|||
direct or contributory patent infringement, or inducement of patent |
|||
infringement, then any patent rights granted to you under this License |
|||
for this implementation of the WebRTC code package shall terminate as |
|||
of the date such litigation is filed. |
|||
1212
lib/data/webrtc/PRESUBMIT.py
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,13 @@ |
|||
Name: WebRTC |
|||
URL: http://www.webrtc.org |
|||
Version: 90 |
|||
License: BSD |
|||
License File: LICENSE |
|||
|
|||
Description: |
|||
WebRTC provides real time voice and video processing |
|||
functionality to enable the implementation of |
|||
PeerConnection/MediaStream. |
|||
|
|||
Third party code used in this project is described |
|||
in the file LICENSE_THIRD_PARTY. |
|||
@ -0,0 +1,28 @@ |
|||
**WebRTC is a free, open software project** that provides browsers and mobile |
|||
applications with Real-Time Communications (RTC) capabilities via simple APIs. |
|||
The WebRTC components have been optimized to best serve this purpose. |
|||
|
|||
**Our mission:** To enable rich, high-quality RTC applications to be |
|||
developed for the browser, mobile platforms, and IoT devices, and allow them |
|||
all to communicate via a common set of protocols. |
|||
|
|||
The WebRTC initiative is a project supported by Google, Mozilla and Opera, |
|||
amongst others. |
|||
|
|||
### Development |
|||
|
|||
See http://www.webrtc.org/native-code/development for instructions on how to get |
|||
started developing with the native code. |
|||
|
|||
[Authoritative list](native-api.md) of directories that contain the |
|||
native API header files. |
|||
|
|||
### More info |
|||
|
|||
* Official web site: http://www.webrtc.org |
|||
* Master source code repo: https://webrtc.googlesource.com/src |
|||
* Samples and reference apps: https://github.com/webrtc |
|||
* Mailing list: http://groups.google.com/group/discuss-webrtc |
|||
* Continuous build: http://build.chromium.org/p/client.webrtc |
|||
* [Coding style guide](style-guide.md) |
|||
* [Code of conduct](CODE_OF_CONDUCT.md) |
|||
@ -0,0 +1,190 @@ |
|||
# Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. |
|||
# |
|||
# Use of this source code is governed by a BSD-style license |
|||
# that can be found in the LICENSE file in the root of the source |
|||
# tree. An additional intellectual property rights grant can be found |
|||
# in the file PATENTS. All contributing project authors may |
|||
# be found in the AUTHORS file in the root of the source tree. |
|||
|
|||
# Inspired by chromium.org: |
|||
# http://dev.chromium.org/developers/contributing-code/watchlists |
|||
|
|||
{ |
|||
'WATCHLIST_DEFINITIONS': { |
|||
'this_file': { |
|||
'filepath': '^WATCHLISTS$', |
|||
}, |
|||
'all_webrtc': { |
|||
# NOTE: if you like this you might like webrtc-reviews@webrtc.org! |
|||
'filepath': '^.*', |
|||
}, |
|||
'root_files': { |
|||
# Non-recursive contents of ./ |
|||
'filepath': '^[^/]*$', |
|||
}, |
|||
'build_files': { |
|||
'filepath': '\.gni$|\.gn$', |
|||
}, |
|||
'java_files': { |
|||
'filepath': '\.java$|\.xml$', |
|||
}, |
|||
'api': { |
|||
'filepath': 'api/.*', |
|||
}, |
|||
'audio': { |
|||
'filepath': 'audio/.*', |
|||
}, |
|||
'base': { |
|||
'filepath': 'rtc_base/.*', |
|||
}, |
|||
'call': { |
|||
'filepath': 'call/.*', |
|||
}, |
|||
'media_engine': { |
|||
'filepath': 'media/engine/.*', |
|||
}, |
|||
'video': { |
|||
'filepath': 'video/.*', |
|||
}, |
|||
'common_audio': { |
|||
'filepath': 'common_audio/.*', |
|||
}, |
|||
'common_video': { |
|||
'filepath': 'common_video/.*', |
|||
}, |
|||
'video_capture': { |
|||
'filepath': 'modules/video_capture/.*', |
|||
}, |
|||
'audio_device': { |
|||
'filepath': 'modules/audio_device/.*', |
|||
}, |
|||
'audio_coding': { |
|||
'filepath': 'modules/audio_coding/.*', |
|||
}, |
|||
'neteq': { |
|||
'filepath': 'modules/audio_coding/neteq/.*', |
|||
}, |
|||
'audio_mixer': { |
|||
'filepath': 'modules/audio_mixer/.*', |
|||
}, |
|||
'audio_processing': { |
|||
'filepath': 'modules/audio_processing/.*', |
|||
}, |
|||
'video_coding': { |
|||
'filepath': 'modules/video_coding/.*', |
|||
}, |
|||
'video_processing': { |
|||
'filepath': 'modules/video_processing/.*', |
|||
}, |
|||
'bitrate_controller': { |
|||
'filepath': 'modules/bitrate_controller/.*' |
|||
}, |
|||
'congestion_controller': { |
|||
'filepath': 'modules/congestion_controller/.*' |
|||
}, |
|||
'remote_bitrate_estimator': { |
|||
'filepath': 'modules/remote_bitrate_estimator/.*' |
|||
}, |
|||
'pacing': { |
|||
'filepath': 'modules/pacing/.*' |
|||
}, |
|||
'rtp_rtcp': { |
|||
'filepath': 'modules/rtp_rtcp/.*' |
|||
}, |
|||
'system_wrappers': { |
|||
'filepath': 'system_wrappers/.*', |
|||
}, |
|||
'pc': { |
|||
'filepath': '^pc/.*', |
|||
}, |
|||
}, |
|||
|
|||
'WATCHLISTS': { |
|||
'this_file': [], |
|||
'all_webrtc': [], |
|||
'root_files': ['peah@webrtc.org', |
|||
'qiang.lu@intel.com', |
|||
'yujie.mao@webrtc.org'], |
|||
'build_files': ['mbonadei@webrtc.org'], |
|||
'common_audio': ['alessiob@webrtc.org', |
|||
'aluebs@webrtc.org', |
|||
'audio-team@agora.io', |
|||
'minyue@webrtc.org', |
|||
'peah@webrtc.org', |
|||
'saza@webrtc.org'], |
|||
'audio': ['peah@webrtc.org'], |
|||
'api': ['kwiberg@webrtc.org','peah@webrtc.org'], |
|||
'base': ['kwiberg@webrtc.org', |
|||
'benwright@webrtc.org'], |
|||
'call': ['mflodman@webrtc.org', |
|||
'stefan@webrtc.org'], |
|||
'video': ['mflodman@webrtc.org', |
|||
'stefan@webrtc.org', |
|||
'video-team@agora.io', |
|||
'yujie.mao@webrtc.org', |
|||
'zhengzhonghou@agora.io'], |
|||
'video_capture': ['mflodman@webrtc.org', |
|||
'perkj@webrtc.org', |
|||
'sdk-team@agora.io', |
|||
'zhengzhonghou@agora.io'], |
|||
'audio_device': ['audio-team@agora.io', |
|||
'henrika@webrtc.org', |
|||
'peah@webrtc.org', |
|||
'saza@webrtc.org', |
|||
'sdk-team@agora.io'], |
|||
'audio_coding': ['alessiob@webrtc.org', |
|||
'audio-team@agora.io', |
|||
'henrik.lundin@webrtc.org', |
|||
'kwiberg@webrtc.org', |
|||
'minyue@webrtc.org', |
|||
'peah@webrtc.org', |
|||
'saza@webrtc.org'], |
|||
'neteq': ['alessiob@webrtc.org', |
|||
'audio-team@agora.io', |
|||
'henrik.lundin@webrtc.org', |
|||
'minyue@webrtc.org', |
|||
'saza@webrtc.org'], |
|||
'audio_mixer': ['aleloi@webrtc.org', |
|||
'henrik.lundin@webrtc.org', |
|||
'peah@webrtc.org', |
|||
'saza@webrtc.org'], |
|||
'audio_processing': ['alessiob@webrtc.org', |
|||
'aluebs@webrtc.org', |
|||
'audio-team@agora.io', |
|||
'fhernqvist@webrtc.org', |
|||
'henrik.lundin@webrtc.org', |
|||
'kwiberg@webrtc.org', |
|||
'minyue@webrtc.org', |
|||
'peah@webrtc.org', |
|||
'saza@webrtc.org'], |
|||
'video_coding': ['mflodman@webrtc.org', |
|||
'stefan@webrtc.org', |
|||
'video-team@agora.io', |
|||
'zhengzhonghou@agora.io'], |
|||
'video_processing': ['stefan@webrtc.org', |
|||
'video-team@agora.io', |
|||
'zhengzhonghou@agora.io'], |
|||
'bitrate_controller': ['mflodman@webrtc.org', |
|||
'stefan@webrtc.org', |
|||
'srte@webrtc.org', |
|||
'zhuangzesen@agora.io'], |
|||
'congestion_controller': ['srte@webrtc.org'], |
|||
'remote_bitrate_estimator': ['mflodman@webrtc.org', |
|||
'stefan@webrtc.org', |
|||
'zhuangzesen@agora.io'], |
|||
'pacing': ['mflodman@webrtc.org', |
|||
'srte@webrtc.org', |
|||
'stefan@webrtc.org', |
|||
'zhuangzesen@agora.io'], |
|||
'rtp_rtcp': ['mflodman@webrtc.org', |
|||
'stefan@webrtc.org', |
|||
'danilchap@webrtc.org', |
|||
'zhuangzesen@agora.io'], |
|||
'system_wrappers': ['fengyue@agora.io', |
|||
'henrika@webrtc.org', |
|||
'mflodman@webrtc.org', |
|||
'peah@webrtc.org', |
|||
'zhengzhonghou@agora.io'], |
|||
'pc': ['steveanton+watch@webrtc.org'], |
|||
}, |
|||
} |
|||
@ -0,0 +1,63 @@ |
|||
# Using Abseil in WebRTC |
|||
|
|||
You may use a subset of the utilities provided by the [Abseil][abseil] |
|||
library when writing WebRTC C++ code. Below, we list the explicitly |
|||
*allowed* and the explicitly *disallowed* subsets of Abseil; if you |
|||
find yourself in need of something that isn’t in either subset, |
|||
please add it to the *allowed* subset in this doc in the same CL that |
|||
adds the first use. |
|||
|
|||
[abseil]: https://abseil.io/about/ |
|||
|
|||
## **Allowed** |
|||
|
|||
* `absl::InlinedVector` |
|||
* `absl::WrapUnique` |
|||
* `absl::optional` and related stuff from `absl/types/optional.h`. |
|||
* `absl::string_view` |
|||
* The functions in `absl/strings/ascii.h`, `absl/strings/match.h`, |
|||
and `absl/strings/str_replace.h`. |
|||
* `absl::is_trivially_copy_constructible`, |
|||
`absl::is_trivially_copy_assignable`, and |
|||
`absl::is_trivially_destructible` from `absl/meta/type_traits.h`. |
|||
* `absl::variant` and related stuff from `absl/types/variant.h`. |
|||
* The functions in `absl/algorithm/algorithm.h` and |
|||
`absl/algorithm/container.h`. |
|||
* The macros in `absl/base/attributes.h`, `absl/base/config.h` and |
|||
`absl/base/macros.h`. |
|||
|
|||
## **Disallowed** |
|||
|
|||
### `absl::make_unique` |
|||
|
|||
*Use `std::make_unique` instead.* |
|||
|
|||
### `absl::Mutex` |
|||
|
|||
*Use `rtc::CriticalSection` instead.* |
|||
|
|||
Chromium has a ban on new static initializers, and `absl::Mutex` uses |
|||
one. To make `absl::Mutex` available, we would need to nicely ask the |
|||
Abseil team to remove that initializer (like they already did for a |
|||
spinlock initializer). Additionally, `absl::Mutex` handles time in a |
|||
way that may not be compaible with the rest of WebRTC. |
|||
|
|||
### `absl::Span` |
|||
|
|||
*Use `rtc::ArrayView` instead.* |
|||
|
|||
`absl::Span` differs from `rtc::ArrayView` on several points, and both |
|||
of them differ from the `std::span` that was voted into |
|||
C++20—and `std::span` is likely to undergo further changes |
|||
before C++20 is finalized. We should just keep using `rtc::ArrayView` |
|||
and avoid `absl::Span` until C++20 is finalized and the Abseil team |
|||
has decided if they will change `absl::Span` to match. |
|||
[Bug](https://bugs.webrtc.org/9214). |
|||
|
|||
### `absl::StrCat`, `absl::StrAppend`, `absl::StrJoin`, `absl::StrSplit` |
|||
|
|||
*Use `rtc::SimpleStringBuilder` to build strings.* |
|||
|
|||
These are optimized for speed, not binary size. Even `StrCat` calls |
|||
with a modest number of arguments can easily add several hundred bytes |
|||
to the binary. |
|||
Some files were not shown because too many files changed in this diff
Write
Preview
Loading…
Cancel
Save
Reference in new issue