Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building using docker #74

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Defining environment
ARG ARCH=armv7
ARG RPI=pi@raspberrypi.local

FROM ubuntu:18.04 AS osbase

ENV DEBIAN_FRONTEND=noninteractive
ENV HOME /root/
RUN apt update && apt install -y git \
wget \
xz-utils \
python \
openssh-client \
sshpass \
pkg-config \
rsync \
cmake \
unzip \
gawk

RUN mkdir -p /root/tools
WORKDIR /root/tools
RUN git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
ENV PATH="${PATH}:/root/tools/depot_tools"

RUN mkdir -p /root/Workspace
WORKDIR /root/Workspace
RUN git clone https://github.com/kclyu/rpi_rootfs

RUN mkdir /root/Workspace/rpi_rootfs/tools
WORKDIR /root/Workspace/rpi_rootfs/tools

RUN wget -O gcc-linaro-6.4.1-2018.10-x86_64_arm-linux-gnueabihf.tar.xz https://www.dropbox.com/s/qf6c68eia8478zk/gcc-linaro-6.4.1-2018.10-x86_64_arm-linux-gnueabihf.tar.xz?dl=1
RUN xz -dc gcc-linaro-6.4.1-2018.10-x86_64_arm-linux-gnueabihf.tar.xz | tar xvf -
RUN ln -sf gcc-linaro-6.4.1-2018.10-x86_64_arm-linux-gnueabihf arm-linux-gnueabihf && \
cd /opt && ln -sf /root/Workspace/rpi_rootfs
ENV PATH="${PATH}:/opt/rpi_rootfs/tools/arm-linux-gnueabihf/bin"

RUN mkdir -p /root/Workspace/webrtc
WORKDIR /root/Workspace/webrtc
RUN fetch --nohooks webrtc && \
gclient sync && \
cd /root/Workspace/webrtc/src && \
git config branch.autosetupmerge always && \
git config branch.autosetuprebase always && \
git checkout master


# Installing ssh client to connect to raspberry pi
RUN echo -e "\n\n\n\n" | ssh-keygen -t rsa -N '' -f /root/.ssh/id_rsa && \
sshpass -p raspberry ssh-copy-id -oStrictHostKeyChecking=no pi@raspberrypi.local && \
ssh -t pi@raspberrypi.local 'sudo apt-get update && sudo apt-get upgrade -y && \
sudo apt-get install -y rsync libasound2-dev libcairo2-dev libffi-dev libglib2.0-dev \
libgtk2.0-dev libpam0g-dev libpulse-dev libudev-dev libxtst-dev \
ttf-dejavu-core libatk1.0-0 libc6 libasound2 libcairo2 libcap2 libcups2 \
libexpat1 libffi6 libfontconfig1 libfreetype6 libglib2.0-0 libgnome-keyring0 \
libgtk2.0-0 libpam0g libpango1.0-0 libpcre3 libpixman-1-0 libpng12-0 libstdc++6 \
libx11-6 libx11-xcb1 libxau6 libxcb1 libxcomposite1 libxcursor1 libxdamage1 \
libxdmcp6 libxext6 libxfixes3 libxi6 libxinerama1 libxrandr2 libxrender1 \
libxtst6 zlib1g gtk+-3.0 libavahi-client-dev'

#hacks to ./install-build-deps.sh work
#we haven't set up sudo so we will remove it
#lsb_release is not available in ubuntu docker images
RUN cd /root/Workspace/webrtc/src/build && \
sed 's/sudo//g' install-build-deps.sh > install-build-deps.sh && \
sed 's/$(lsb_release --codename --short)/bionic/g' install-build-deps.sh > install-build-deps.sh && \
sed 's/$(lsb_release --id --short)/Ubuntu/g' install-build-deps.sh > install-build-deps.sh && \
chmod +x install-build-deps.sh && \
./install-build-deps.sh

RUN cd /root/Workspace/rpi_rootfs && \
./rpi_rootfs.py pi@raspberrypi.local ./

FROM osbase AS Prod
WORKDIR /root/Workspace/webrtc/src
RUN mkdir arm_build
COPY ./misc/webrtc_arm_build_args.gn arm_build/args.gn
RUN gn gen arm_build && ninja -C arm_build

#FROM Prod AS rws-install
#WORKDIR /root/Workspace
#ADD . ./rpi-webrtc-streamer
#WORKDIR /root/Workspace/rpi-webrtc-streamer/src
#RUN sh ../mk/config_libwebsockets.sh
#RUN make

# Deploy
#WORKDIR /root/Workspace/rpi-webrtc-streamer/src
#RUN ssh pi@raspberrypi.local mkdir -p /home/pi/Workspace/rws
#RUN scp -r etc tools log web-root webrtc-streamer pi@raspberrypi.local:/home/pi/Workspace/rws
3 changes: 0 additions & 3 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#
#
#
include ../mk/cross_arm_build.mk
include ../mk/cross_mmal.mk
include ../mk/libwebsocket_arm_build.mk
Expand Down
2 changes: 1 addition & 1 deletion src/app_ws_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ bool AppWsClient::OnMessage(int sockid, const std::string& message) {
return true;
}
else {
// save successufl,
// save successful,
// and sends the entire media_config to the client.
std::string media_config;
config_media_->ConfigToJson(media_config);
Expand Down
3 changes: 3 additions & 0 deletions src/compat/optionsfile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ bool OptionsFile::Load(bool verbose) {


bool OptionsFile::Save() {
/*
6cab98e Delete unused class FileStream by Niels Möller · 6 days ago
// Open file.
FileStream stream;
int err;
Expand Down Expand Up @@ -118,6 +120,7 @@ bool OptionsFile::Save() {
} else {
return true;
}
*/
}

bool OptionsFile::IsLegalName(const std::string& name) {
Expand Down
2 changes: 0 additions & 2 deletions src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
#include "mdns_publish.h"


//
//
class StreamingSocketServer : public rtc::PhysicalSocketServer {
public:
explicit StreamingSocketServer()
Expand Down
5 changes: 0 additions & 5 deletions src/raspi_decoder_dummy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ int32_t RaspiDecoderDummy::RegisterDecodeCompleteCallback(

int32_t RaspiDecoderDummy::Decode(const EncodedImage& input_image,
bool /*missing_frames*/,
const CodecSpecificInfo* codec_specific_info,
int64_t render_time_ms) {
if (!IsInitialized()) {
return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
Expand All @@ -80,10 +79,6 @@ int32_t RaspiDecoderDummy::Decode(const EncodedImage& input_image,
if (!input_image.data() || !input_image.size()) {
return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
}
if (codec_specific_info &&
codec_specific_info->codecType != kVideoCodecH264) {
return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
}

VideoFrame frame(I420Buffer::Create(decoder_config_.width, decoder_config_.height),
kVideoRotation_0, render_time_ms * rtc::kNumMicrosecsPerMillisec);
Expand Down
1 change: 0 additions & 1 deletion src/raspi_decoder_dummy.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class RaspiDecoderDummy : public RaspiDecoder {

int32_t Decode(const EncodedImage& input_image,
bool /*missing_frames*/,
const CodecSpecificInfo* codec_specific_info = nullptr,
int64_t render_time_ms = -1) override;

const char* ImplementationName() const override;
Expand Down
2 changes: 1 addition & 1 deletion src/raspi_encoder_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ int32_t RaspiEncoderImpl::SetRateAllocation(


int32_t RaspiEncoderImpl::Encode(
const VideoFrame& frame, const CodecSpecificInfo* codec_specific_info,
const VideoFrame& frame,
const std::vector<VideoFrameType>* frame_types) {


Expand Down
14 changes: 13 additions & 1 deletion src/raspi_encoder_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,20 @@ class RaspiEncoderImpl : public RaspiEncoder {

// The result of encoding - an EncodedImage and RTPFragmentationHeader - are
// passed to the encode complete callback.
// Encode an I420 image (as a part of a video stream). The encoded image
// will be returned to the user through the encode complete callback.
//
// Input:
// - frame : Image to be encoded
// - frame_types : Frame type to be generated by the encoder.
//
// Return value : WEBRTC_VIDEO_CODEC_OK if OK
// <0 - Errors:
// WEBRTC_VIDEO_CODEC_ERR_PARAMETER
// WEBRTC_VIDEO_CODEC_MEMORY
// WEBRTC_VIDEO_CODEC_ERROR
int32_t Encode(const VideoFrame& frame,
const CodecSpecificInfo* codec_specific_info,
//const CodecSpecificInfo* codec_specific_info,
const std::vector<VideoFrameType>* frame_types) override;

VideoEncoder::EncoderInfo GetEncoderInfo() const override;
Expand Down
2 changes: 0 additions & 2 deletions src/websocket_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ LibWebSocketServer::LibWebSocketServer() {
memset(&webroot_http_mount_, 0x00, sizeof(webroot_http_mount_));
memset(&motion_http_mount_, 0x00, sizeof(motion_http_mount_));
debug_level_ = LibWebSocketServer::DEBUG_LEVEL_NONE;

motion_mount_enabled_ = false;

context_ = nullptr;
vhost_ = nullptr;
}
Expand Down