Skip to content

Commit

Permalink
rollback building with g++
Browse files Browse the repository at this point in the history
  • Loading branch information
mpromonet committed Nov 1, 2024
1 parent aa2cb82 commit 88274c9
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cpp-cross-linux-arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
- name: build
run: |
export PATH=$(pwd)/webrtc/src/third_party/llvm-build/Release+Asserts/bin:$PATH
cmake -DWEBRTCROOT=$(pwd)/webrtc -DCMAKE_BUILD_TYPE=${{ matrix.buildtype }} -DCMAKE_SYSTEM_PROCESSOR=${{ matrix.arch }} -DCMAKE_LIBRARY_ARCHITECTURE=${{ matrix.prefix }} -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY -DWEBRTCDESKTOPCAPTURE=OFF .
cmake -DWEBRTCROOT=$(pwd)/webrtc -DCMAKE_BUILD_TYPE=${{ matrix.buildtype }} -DCMAKE_SYSTEM_PROCESSOR=${{ matrix.arch }} -DCMAKE_LIBRARY_ARCHITECTURE=${{ matrix.prefix }} -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_C_COMPILER=${{ matrix.prefix }}-gcc -DCMAKE_CXX_COMPILER=${{ matrix.prefix }}-g++ -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY -DWEBRTCDESKTOPCAPTURE=OFF .
make
- name: cpack
Expand Down
75 changes: 74 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,79 @@
"string_view": "cpp",
"ranges": "cpp",
"span": "cpp",
"vector": "cpp"
"vector": "cpp",
"cstdint": "cpp",
"bitset": "cpp",
"format": "cpp",
"initializer_list": "cpp",
"regex": "cpp",
"valarray": "cpp",
"chrono": "cpp",
"any": "cpp",
"atomic": "cpp",
"strstream": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"cctype": "cpp",
"cfenv": "cpp",
"charconv": "cpp",
"cinttypes": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"codecvt": "cpp",
"compare": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"forward_list": "cpp",
"list": "cpp",
"map": "cpp",
"set": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"future": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"numbers": "cpp",
"ostream": "cpp",
"scoped_allocator": "cpp",
"semaphore": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"typeindex": "cpp",
"typeinfo": "cpp",
"variant": "cpp"
}
}
6 changes: 3 additions & 3 deletions inc/V4l2AlsaMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#ifdef HAVE_V4L2
#include <string>
#include <format>
#include <cstring>
#include <map>
#include <filesystem>
Expand Down Expand Up @@ -38,13 +39,12 @@ std::string getDeviceId(const std::string& devicePath) {
std::map<int,int> videoDev2Idx() {
std::map<int,int> dev2idx;
uint32_t count = 0;
char device[20];
int fd = -1;
struct v4l2_capability cap;

for (int devId = 0; devId < 64; devId++) {
snprintf(device, sizeof(device), "/dev/video%d", devId);
if ((fd = open(device, O_RDONLY)) != -1) {
std::string device = std::format("/dev/video{}", devId);
if ((fd = open(device.c_str(), O_RDONLY)) != -1) {
if (ioctl(fd, VIDIOC_QUERYCAP, &cap) < 0 ||
!(cap.device_caps & V4L2_CAP_VIDEO_CAPTURE)) {
close(fd);
Expand Down
11 changes: 8 additions & 3 deletions inc/VideoDecoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,17 @@ class VideoDecoder : public rtc::VideoSourceInterface<webrtc::VideoFrame>, publi
int64_t ts = std::chrono::high_resolution_clock::now().time_since_epoch().count()/1000/1000;

RTC_LOG(LS_VERBOSE) << "VideoDecoder::Decoded size:" << decodedImage.size()
<< " decode ts:" << decodedImage.ntp_time_ms()
<< " decode rtptime:" << decodedImage.rtp_timestamp()
<< " decode ts:" << decodedImage.timestamp_us()/1000
<< " source ts:" << ts;

if (decodedImage.timestamp_us() == 0) {
decodedImage.set_timestamp_us(decodedImage.rtp_timestamp()*1000);
}

// waiting
if ( (m_wait) && (m_prevts != 0) ) {
int64_t periodSource = decodedImage.ntp_time_ms() - m_previmagets;
int64_t periodSource = decodedImage.timestamp_us()/1000 - m_previmagets;
int64_t periodDecode = ts-m_prevts;

RTC_LOG(LS_VERBOSE) << "VideoDecoder::Decoded interframe decode:" << periodDecode << " source:" << periodSource;
Expand All @@ -172,7 +177,7 @@ class VideoDecoder : public rtc::VideoSourceInterface<webrtc::VideoFrame>, publi

m_scaler.OnFrame(decodedImage);

m_previmagets = decodedImage.ntp_time_ms();
m_previmagets = decodedImage.timestamp_us()/1000;
m_prevts = std::chrono::high_resolution_clock::now().time_since_epoch().count()/1000/1000;

return 1;
Expand Down
2 changes: 1 addition & 1 deletion inc/VideoScaler.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class VideoScaler : public rtc::VideoSinkInterface<webrtc::VideoFrame>, public
.set_video_frame_buffer(scaled_buffer)
.set_rotation(m_rotation)
.set_timestamp_rtp(frame.rtp_timestamp())
.set_timestamp_ms(frame.render_time_ms())
.set_timestamp_us(frame.timestamp_us())
.set_id(frame.timestamp_us())
.build();

Expand Down

0 comments on commit 88274c9

Please sign in to comment.