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

use_sysroot=false \ use_sysroot=false \
rtc_include_tests=false \ rtc_include_tests=false \
rtc_use_h264=true \ rtc_use_h264=true \
rtc_use_x11=false \
treat_warnings_as_errors=false \ treat_warnings_as_errors=false \
is_clang=false \ is_clang=false \
use_custom_libcxx=false \ use_custom_libcxx=false \
use_rtti=true \ use_rtti=true \
$(WEBRTC_GN_ARGS_EXTRA) $(WEBRTC_GN_ARGS_EXTRA)
WEBRTC_TARGETS ?= default $(WEBRTC_TARGETS_EXTRA) WEBRTC_TARGETS ?= default $(WEBRTC_TARGETS_EXTRA)
WEBRTC_LIBS ?= libwebrtc.a $(WEBRTC_LIBS_EXTRA)
WEBRTC_INCLUDES = \ WEBRTC_INCLUDES = \
api audio base call common_audio common_video logging media modules p2p pc \ 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 \ system_wrappers rtc_base rtc_tools video third_party common_types.h \
WEBRTC_PLATFORM ?= POSIX WEBRTC_PLATFORM ?= POSIX


WEBRTC_FLAGS ?= \ 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) -DWEBRTC_$(WEBRTC_PLATFORM)


WEBRTC_SETPATH = PATH=$(WEBRTC_DIR)/depot_tools:"$$PATH" WEBRTC_SETPATH = PATH=$(WEBRTC_DIR)/depot_tools:"$$PATH"
RTC_STAMP_REPO = $(WEBRTC_DIR)/webrtc-checkout/.stamp RTC_STAMP_REPO = $(WEBRTC_DIR)/webrtc-checkout/.stamp
RTC_STAMP_VERSION = $(WEBRTC_DIR)/webrtc-checkout/.stamps/stamp-$(WEBRTC_VERSION) 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_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 .PHONY: rtcall
rtc-all: \ 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 # Get depot_tools, which contains all the tools required to work with Google software
$(RTC_STAMP_DEPOT): $(RTC_STAMP_DEPOT):


# Includes # Includes
$(RTC_STAMP_INCLUDES): $(RTC_STAMP_VERSION) $(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='*' \ rsync -m --recursive --include='*/' --include='*.h' --exclude='*' \
$(patsubst %,$(WEBRTC_DIR)/webrtc-checkout/src/%,$(WEBRTC_INCLUDES)) \ $(patsubst %,$(WEBRTC_DIR)/webrtc-checkout/src/%,$(WEBRTC_INCLUDES)) \
include/webrtc
$(WEBRTC_DIR)/include/webrtc
touch $@ touch $@


# Libraries # 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) $(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) @mkdir -p $(@D)
cp $< $@ 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 .PHONY: rtc-clean
rtc-clean: rtc-clean:
rm -rf include/webrtc libs build
rm -rf $(WEBRTC_DIR)/include/webrtc $(WEBRTC_DIR)/lib


.PHONY: rtc-gn-clean .PHONY: rtc-gn-clean
rtc-gn-clean: rtc-clean rtc-gn-clean: rtc-clean
rtc-clean-all: rtc-clean rtc-clean-all: rtc-clean
rm -rf $(WEBRTC_DIR)/depot_tools $(WEBRTC_DIR)/webrtc-checkout rm -rf $(WEBRTC_DIR)/depot_tools $(WEBRTC_DIR)/webrtc-checkout


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

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

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



virtual void onIceCandidate(std::string mid, int index, std::string sdp) = 0; virtual void onIceCandidate(std::string mid, int index, std::string sdp) = 0;
virtual void onAnswer(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: class Conductor:

+ 5
- 1
util/Conductor.cc View File

#include "Conductor.h"
#include <rtcutil/Conductor.h>


#include <webrtc/api/create_peerconnection_factory.h> #include <webrtc/api/create_peerconnection_factory.h>
#include <webrtc/api/audio_codecs/builtin_audio_encoder_factory.h> #include <webrtc/api/audio_codecs/builtin_audio_encoder_factory.h>
}; };


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


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


peer_conn_->SetRemoteDescription( peer_conn_->SetRemoteDescription(
} }


void Conductor::receiveIceCandidate(std::string mid, int index, std::string sdp) { void Conductor::receiveIceCandidate(std::string mid, int index, std::string sdp) {
printf("receive ice candidate\n");
webrtc::SdpParseError error; webrtc::SdpParseError error;
std::unique_ptr<webrtc::IceCandidateInterface> candidate( std::unique_ptr<webrtc::IceCandidateInterface> candidate(
webrtc::CreateIceCandidate(mid, index, sdp, &error)); webrtc::CreateIceCandidate(mid, index, sdp, &error));
} }


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



Loading…
Cancel
Save