Skip to content

Commit

Permalink
Fix tests and make them act compatible (#11)
Browse files Browse the repository at this point in the history
* Fix tests and make them act compatible

* Fix workflow syntax issue
  • Loading branch information
widgetii authored May 13, 2023
1 parent 750fa54 commit 0327ad3
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 35 deletions.
36 changes: 14 additions & 22 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Install CMake and Clang
run: sudo apt update && sudo apt install -y cmake

- name: Install Clang
if: matrix.compiler == 'clang'
run: sudo apt install -y clang

- name: Tests
run: bash scripts/test.sh

Expand All @@ -28,27 +35,8 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Install libevent, NASM
run: sudo apt install libevent-dev nasm

- name: Install FFmpeg
run: |
wget https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
tar -xf ffmpeg-snapshot.tar.bz2
cd ffmpeg
./configure --disable-everything --disable-doc \
--disable-ffplay --disable-ffprobe \
--enable-protocol=udp \
--enable-protocol=tcp \
--enable-protocol=rtp \
--enable-protocol=file \
--enable-demuxer=rtp \
--enable-demuxer=rtsp \
--enable-muxer=h264 \
--enable-muxer=pcm_mulaw \
--enable-decoder=h264 \
--enable-parser=h264
sudo make install -j $(nproc)
- name: Install libevent, CMake, FFMpeg
run: sudo apt update && sudo apt install -y libevent-dev cmake ffmpeg xxd

- name: Test the example server
run: sudo bash scripts/test-server.sh
Expand All @@ -59,6 +47,9 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Install libevent
run: sudo apt update && sudo apt install -y clang-format

- name: Download run-clang-format
run: git submodule update --init run-clang-format

Expand All @@ -72,12 +63,13 @@ jobs:
- uses: actions/checkout@v2

- name: Install Doxygen
run: sudo apt install doxygen graphviz
run: sudo apt update && sudo apt install -y doxygen graphviz

- name: Build the docs
run: bash scripts/docs.sh

- name: Deploy the docs
if: ${{ !env.ACT && github.event_name != 'pull_request' }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
3 changes: 2 additions & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ include(FetchContent)

FetchContent_Declare(
smolrtsp-libevent
URL https://github.com/OpenIPC/smolrtsp-libevent/archive/refs/tags/v0.1.0.tar.gz
GIT_REPOSITORY https://github.com/OpenIPC/smolrtsp-libevent
GIT_TAG 7451e74
)

FetchContent_MakeAvailable(smolrtsp-libevent)
Expand Down
2 changes: 1 addition & 1 deletion examples/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ static int setup_tcp(
SmolRTSP_TransportConfig config) {
ifLet(config.interleaved, SmolRTSP_ChannelPair_Some, interleaved) {
*t = smolrtsp_transport_tcp(
SmolRTSP_Context_get_writer(ctx), interleaved->rtp_channel);
SmolRTSP_Context_get_writer(ctx), interleaved->rtp_channel, 0);

smolrtsp_header(
ctx, SMOLRTSP_HEADER_TRANSPORT,
Expand Down
3 changes: 1 addition & 2 deletions include/smolrtsp/nal_transport.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,4 @@ int SmolRTSP_NalTransport_send_packet(
*/
declImplExtern99(SmolRTSP_Droppable, SmolRTSP_NalTransport);

bool
SmolRTSP_NalTransport_is_full(SmolRTSP_NalTransport *self);
bool SmolRTSP_NalTransport_is_full(SmolRTSP_NalTransport *self);
3 changes: 1 addition & 2 deletions include/smolrtsp/rtp_transport.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,4 @@ int SmolRTSP_RtpTransport_send_packet(
*/
declImplExtern99(SmolRTSP_Droppable, SmolRTSP_RtpTransport);

bool
SmolRTSP_RtpTransport_is_full(SmolRTSP_RtpTransport *self);
bool SmolRTSP_RtpTransport_is_full(SmolRTSP_RtpTransport *self);
2 changes: 1 addition & 1 deletion include/smolrtsp/transport.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* on success. \
*/ \
vfunc99(int, transmit, VSelf99, SmolRTSP_IoVecSlice bufs) \
vfunc99(bool, is_full, VSelf99)
vfunc99(bool, is_full, VSelf99)

/**
* The superinterfaces of #SmolRTSP_Transport_IFACE.
Expand Down
5 changes: 2 additions & 3 deletions src/nal_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ static void SmolRTSP_NalTransport_drop(VSelf) {

implExtern(SmolRTSP_Droppable, SmolRTSP_NalTransport);

bool
SmolRTSP_NalTransport_is_full(SmolRTSP_NalTransport *self) {
return SmolRTSP_RtpTransport_is_full(self->transport);
bool SmolRTSP_NalTransport_is_full(SmolRTSP_NalTransport *self) {
return SmolRTSP_RtpTransport_is_full(self->transport);
}

int SmolRTSP_NalTransport_send_packet(
Expand Down
4 changes: 2 additions & 2 deletions src/transport/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ typedef struct {

declImpl(SmolRTSP_Transport, SmolRTSP_TcpTransport);

SmolRTSP_Transport
smolrtsp_transport_tcp(SmolRTSP_Writer w, uint8_t channel_id, size_t max_buffer) {
SmolRTSP_Transport smolrtsp_transport_tcp(
SmolRTSP_Writer w, uint8_t channel_id, size_t max_buffer) {
assert(w.self && w.vptr);

SmolRTSP_TcpTransport *self = malloc(sizeof *self);
Expand Down
2 changes: 1 addition & 1 deletion tests/transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ TEST check_tcp(void) {
const uint8_t chn_id = 123;

SmolRTSP_Transport tcp =
smolrtsp_transport_tcp(smolrtsp_fd_writer(&fds[0]), chn_id);
smolrtsp_transport_tcp(smolrtsp_fd_writer(&fds[0]), chn_id, 0);

const char total_len = strlen(DATA_0) + strlen(DATA_1);
const char expected[] = {'$', chn_id, 0, total_len, 'a', 'b', 'c',
Expand Down

0 comments on commit 0327ad3

Please sign in to comment.