Skip to content

Commit

Permalink
Feat: docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
SighingSnow committed Jul 10, 2022
1 parent d5aaffb commit ef9eac5
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ COPY . /app
WORKDIR /app

# Build and make ors
RUN rm -r build && cmake clean . && cmake -B build && cd build && make -j${JOBS}
RUN rm -rf build && cmake clean . && cmake -B build && cd build && make -j${JOBS}

# Update work dir
WORKDIR build
Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Pixel Streaming
## Opengl-webrtc-streamer

The proj is based on cloud rendering.(云渲染)

Expand Down Expand Up @@ -28,14 +28,12 @@ Lots of work still need to be done.
- [x] Record OpenGL app screen and encode to H.264
- [x] Rtmp Streamer, which can push the H.264 raw frame in buffer to server
- [x] Webrtc
- [ ] HEVC
- [x] Multi-thread
- [ ] Parallel
- [ ] Terminal controls transfer to server

### 3 Next Steps
2021.11.8
- [x] Use librtc(libdatachannel is the origin name) to send memory video.
- [ ] Implement with HEVC
- [ ] Enable browser control.
- [ ] Integrate with webgl rendering.

**Please note: the repo's license is MIT, but the 3rd_party/librtc is GPL.**

42 changes: 37 additions & 5 deletions docs/setup.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,51 @@
## SetUp Instructions
## SetUp

### 0 Local
On your local pc, please set up the signaling server first.
```shell
git submodule update --init --recursive
cd server
python3 signaling-server.py
python3 -m http.server --bind 127.0.0.1 8080
```
And in your browser,type `127.0.0.1:8080`. After you have successfully run the program, press start button.

### 1 Ubuntu
Requires g++>=9.0.0 (any version which supports c++17 will be okay)
Requires g++>=9.0.0 (any version which supports c++17 will be okay),and cmake>=3.15
```shell
sudo apt install libfreetype6-dev libavcodec-dev libavformat-dev libswscale-dev libavutil-dev libavdevice-dev libxxf86vm-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libssl-dev
```

In the project root directory.

```
cmake -B build
cd build
make -j2
./ors
```

### 2 MacOS

Any issue is welcome(I cannot remember the details on macos).
```shell
brew install ffmpeg
cmake -B build
make -j2
./ors
```

### 3 Docker
Switch to docker branch first.
Switch to docker branch first. The image maybe large(up to 2GB) because of ffmpeg and some other libraries. Please build in the root directory of this project.

```shell
docker build -t ors-image
docker run --rm --name my-ors -p 8080:8080 -p 8000:8000/udp ors-image xvfb-run ./ors
docker run --rm --name my-ors -p 8080:8080 -p 8000:8000/udp ors-image
```
Then in docker termianl, run
```shell
xvfb-run ./ors
```

### 4 Windows
Windows currently has not been tested.
Windows currently has not been supported yet.
2 changes: 1 addition & 1 deletion src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const unsigned int screen_height = 600;
const unsigned int SCR_WIDTH = screen_width * scale;
const unsigned int SCR_HEIGHT = screen_height * scale;
// webrtc
const std::string DEFAULT_IP_ADDRESS = "127.0.0.1";
const std::string DEFAULT_IP_ADDRESS = "host.docker.internal";
const uint16_t defaultPort = 8000;
// FFMPEG parameters
const int inlinesize[2] = {SCR_WIDTH*3,0}; // For sws_scale convert function
Expand Down
4 changes: 2 additions & 2 deletions src/scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Scene::Scene()
VAO = 0;
VBO = 0;
shader = nullptr;
camera = new Camera(glm::vec3(0.0f,0.0f,3.0f));
camera = new Camera(glm::vec3(0.0f,0.0f,30.0f));
lightPos = glm::vec3(1.2f, 1.0f, 2.0f);
prev_time = 0.0;
frame_count = 0;
Expand Down Expand Up @@ -390,4 +390,4 @@ void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
void* data = glfwGetWindowUserPointer(window);
Scene* scene = static_cast<Scene*>(data);
scene->get_camera()->ProcessMouseScroll(yoffset);
}
}

0 comments on commit ef9eac5

Please sign in to comment.