Browse Source

stuff

master
Martin Dørum 3 years ago
parent
commit
fc0572fe8e
3 changed files with 24 additions and 23 deletions
  1. 17
    20
      Makefile
  2. 2
    2
      include/rtcutil/Conductor.h
  3. 5
    1
      util/Conductor.cc

+ 17
- 20
Makefile View File

@@ -7,13 +7,13 @@ WEBRTC_GN_ARGS ?= \
use_sysroot=false \
rtc_include_tests=false \
rtc_use_h264=true \
rtc_use_x11=false \
treat_warnings_as_errors=false \
is_clang=false \
use_custom_libcxx=false \
use_rtti=true \
$(WEBRTC_GN_ARGS_EXTRA)
WEBRTC_TARGETS ?= default $(WEBRTC_TARGETS_EXTRA)
WEBRTC_LIBS ?= libwebrtc.a $(WEBRTC_LIBS_EXTRA)
WEBRTC_INCLUDES = \
api audio base call common_audio common_video logging media modules p2p pc \
system_wrappers rtc_base rtc_tools video third_party common_types.h \
@@ -22,8 +22,9 @@ WEBRTC_INCLUDES = \
WEBRTC_PLATFORM ?= POSIX

WEBRTC_FLAGS ?= \
-I$(WEBRTC_BASE)/include -I$(WEBRTC_BASE)/include/webrtc \
-I$(WEBRTC_BASE)/include/webrtc/third_party/abseil-cpp \
-I$(WEBRTC_BASE)/include \
-I$(WEBRTC_DIR)/include -I$(WEBRTC_DIR)/include/webrtc \
-I$(WEBRTC_DIR)/include/webrtc/third_party/abseil-cpp \
-DWEBRTC_$(WEBRTC_PLATFORM)

WEBRTC_SETPATH = PATH=$(WEBRTC_DIR)/depot_tools:"$$PATH"
@@ -31,13 +32,12 @@ RTC_STAMP_DEPOT = $(WEBRTC_DIR)/depot_tools/.stamp
RTC_STAMP_REPO = $(WEBRTC_DIR)/webrtc-checkout/.stamp
RTC_STAMP_VERSION = $(WEBRTC_DIR)/webrtc-checkout/.stamps/stamp-$(WEBRTC_VERSION)
RTC_STAMP_COMPILE = $(WEBRTC_DIR)/webrtc-checkout/src/out/$(WEBRTC_OUT)/.stamp
RTC_STAMP_INCLUDES = $(WEBRTC_BASE)/include/webrtc/.stamp
RTC_STAMP_INCLUDES = $(WEBRTC_DIR)/include/webrtc/.stamp

.PHONY: rtcall
rtc-all: \
$(WEBRTC_BASE)/include/webrtc/.stamp \
$(patsubst %,$(WEBRTC_BASE)/libs/%,$(WEBRTC_LIBS)) \
$(WEBRTC_BASE)/libs/libutil.a
$(WEBRTC_DIR)/include/webrtc/.stamp \
$(WEBRTC_DIR)/lib/libwebrtc.a

# Get depot_tools, which contains all the tools required to work with Google software
$(RTC_STAMP_DEPOT):
@@ -70,30 +70,23 @@ $(RTC_STAMP_COMPILE):

# Includes
$(RTC_STAMP_INCLUDES): $(RTC_STAMP_VERSION)
rm -rf include/webrtc && mkdir -p include/webrtc
rm -rf $(WEBRTC_DIR)/include/webrtc && mkdir -p $(WEBRTC_DIR)/include/webrtc
rsync -m --recursive --include='*/' --include='*.h' --exclude='*' \
$(patsubst %,$(WEBRTC_DIR)/webrtc-checkout/src/%,$(WEBRTC_INCLUDES)) \
include/webrtc
$(WEBRTC_DIR)/include/webrtc
touch $@

# Libraries
.PRECIOUS: $(WEBRTC_DIR)/webrtc-checkout/src/out/$(WEBRTC_OUT)/obj/%.a
$(WEBRTC_DIR)/webrtc-checkout/src/out/$(WEBRTC_OUT)/obj/%.a: $(RTC_STAMP_COMPILE)
touch $@ # Make doesn't believe us unless there's a recipe body
$(WEBRTC_BASE)/libs/%.a: $(WEBRTC_DIR)/webrtc-checkout/src/out/$(WEBRTC_OUT)/obj/%.a
touch $@
$(WEBRTC_DIR)/lib/%.a: $(WEBRTC_DIR)/webrtc-checkout/src/out/$(WEBRTC_OUT)/obj/%.a
@mkdir -p $(@D)
cp $< $@

# Util
$(WEBRTC_BASE)/libs/libutil.a: $(WEBRTC_BASE)/build/util/Conductor.cc.o
@mkdir -p $(@D)
ar cr $@ $^
$(WEBRTC_BASE)/build/%.cc.o: $(WEBRTC_BASE)/%.cc $(RTC_STAMP_INCLUDES) $(wildcard $(WEBRTC_BASE)/util/*.h)
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) -I$(WEBRTC_BASE)/include/rtcutil $(WEBRTC_FLAGS) -c $< -o $@

.PHONY: rtc-clean
rtc-clean:
rm -rf include/webrtc libs build
rm -rf $(WEBRTC_DIR)/include/webrtc $(WEBRTC_DIR)/lib

.PHONY: rtc-gn-clean
rtc-gn-clean: rtc-clean
@@ -104,6 +97,10 @@ rtc-gn-clean: rtc-clean
rtc-clean-all: rtc-clean
rm -rf $(WEBRTC_DIR)/depot_tools $(WEBRTC_DIR)/webrtc-checkout

.PHONY: rtc-redo
rtc-redo:
rm -f $(RTC_STAMP_COMPILE)

.PHONY: rtc-mock-stamps
rtc-mock-stamps:
mkdir -p $(dir $(RTC_STAMP_DEPOT)) && touch $(RTC_STAMP_DEPOT)

+ 2
- 2
include/rtcutil/Conductor.h View File

@@ -16,8 +16,8 @@ public:

virtual void onIceCandidate(std::string mid, int index, std::string sdp) = 0;
virtual void onAnswer(std::string sdp) = 0;
virtual void onRemoteTrack(rtc::scoped_refptr<webrtc::MediaStreamTrackInterface> track);
virtual void removeRemoteTrack(rtc::scoped_refptr<webrtc::MediaStreamTrackInterface> track);
virtual void onRemoteTrack(rtc::scoped_refptr<webrtc::MediaStreamTrackInterface> track) = 0;
virtual void removeRemoteTrack(rtc::scoped_refptr<webrtc::MediaStreamTrackInterface> track) = 0;
};

class Conductor:

+ 5
- 1
util/Conductor.cc View File

@@ -1,4 +1,4 @@
#include "Conductor.h"
#include <rtcutil/Conductor.h>

#include <webrtc/api/create_peerconnection_factory.h>
#include <webrtc/api/audio_codecs/builtin_audio_encoder_factory.h>
@@ -39,6 +39,7 @@ private:
};

void Conductor::receiveOffer(const std::string &sdp) {
printf("receive offer 1\n");
webrtc::SdpParseError error;
std::unique_ptr<webrtc::SessionDescriptionInterface> desc =
webrtc::CreateSessionDescription(webrtc::SdpType::kOffer, sdp, &error);
@@ -52,6 +53,7 @@ void Conductor::receiveOffer(const std::string &sdp) {
}

void Conductor::receiveOffer(std::unique_ptr<webrtc::SessionDescriptionInterface> offer) {
printf("receive offer 2\n");
ensurePeerConnection();

peer_conn_->SetRemoteDescription(
@@ -63,6 +65,7 @@ void Conductor::receiveOffer(std::unique_ptr<webrtc::SessionDescriptionInterface
}

void Conductor::receiveIceCandidate(std::string mid, int index, std::string sdp) {
printf("receive ice candidate\n");
webrtc::SdpParseError error;
std::unique_ptr<webrtc::IceCandidateInterface> candidate(
webrtc::CreateIceCandidate(mid, index, sdp, &error));
@@ -148,6 +151,7 @@ Conductor::doCreatePeerConnection(webrtc::PeerConnectionFactoryInterface &factor
}

void Conductor::OnSuccess(webrtc::SessionDescriptionInterface *desc) {
fprintf(stderr, "on success; got answer\n");
peer_conn_->SetLocalDescription(
SetSessionDescriptionObserver::Create(observer_), desc);


Loading…
Cancel
Save