Skip to content

Commit 8c466c4

Browse files
committed
Add rate limiting and realtime PTS calculation to media capture
Fix mediaserver demo
1 parent 37cb156 commit 8c466c4

20 files changed

+1150
-1133
lines changed

BUILD.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ cmake .. -DCMAKE_BUILD_TYPE=DEBUG -DBUILD_SHARED_LIBS=OFF \
6969
-DWEBRTC_ROOT_DIR=/home/kam/sourcey/webrtcbuilds/out/src
7070

7171
## WebRTC selective module build
72-
cmake .. -DCMAKE_BUILD_TYPE=DEBUG -DBUILD_SHARED_LIBS=OFF \
72+
cmake .. -DCMAKE_BUILD_TYPE=RELEASE -DBUILD_SHARED_LIBS=OFF \
7373
-DBUILD_MODULES=ON -DBUILD_APPLICATIONS=ON \
74-
-DBUILD_TESTS=OFF -DBUILD_SAMPLES=OFF -DBUILD_SAMPLES_webrtc=ON \
74+
-DBUILD_TESTS=OFF -DBUILD_SAMPLES=OFF -DBUILD_SAMPLES_av=ON -DBUILD_SAMPLES_webrtc=ON \
7575
-DWITH_FFMPEG=ON -DWITH_WEBRTC=ON -DENABLE_LOGGING=ON \
7676
-DBUILD_MODULE_base=ON -DBUILD_MODULE_av=ON \
7777
-DBUILD_MODULE_crypto=ON -DBUILD_MODULE_http=ON \
@@ -106,7 +106,8 @@ cmake .. -DCMAKE_BUILD_TYPE=DEBUG -DBUILD_SHARED_LIBS=OFF \
106106
-DBUILD_MODULE_crypto=ON -DBUILD_MODULE_http=ON \
107107
-DBUILD_MODULE_json=ON -DBUILD_MODULE_av=ON \
108108
-DBUILD_MODULE_net=ON -DBUILD_MODULE_socketio=ON \
109-
-DBUILD_MODULE_symple=ON -DBUILD_MODULE_util=ON
109+
-DBUILD_MODULE_symple=ON -DBUILD_MODULE_util=ON \
110+
-DBUILD_MODULE_webrtc=OFF
110111

111112
## Net build
112113
cmake .. -DCMAKE_BUILD_TYPE=DEBUG -DBUILD_SHARED_LIBS=OFF \

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1+
# This file automates the release process adhering to semantic versioning.
2+
# Tasks supported are git tagging and docker image building and pushing.
3+
# Before calling `make release` update the version number in the VERSION file.
4+
15
NAME := sourcey/libsourcey
26
VERSION := $$(cat VERSION)
37

4-
git_release:
8+
release: | git_tag docker_build docker_push
9+
10+
git_tag:
511
git add VERSION
612
git add . --update
713
git commit --message="Release ${VERSION}"

src/av/include/scy/av/codec.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,18 +118,18 @@ struct AV_API VideoCodec : public Codec
118118

119119
VideoCodec();
120120
VideoCodec(int width, int height, double fps = 0.0,
121-
const std::string& pixelFmt = "", // = DEFAULT_VIDEO_PIXEL_FMT
121+
const std::string& pixelFmt = DEFAULT_VIDEO_PIXEL_FMT,
122122
int bitRate = 0, // = DEFAULT_VIDEO_BIT_RATE
123123
int sampleRate = 0); // = DEFAULT_VIDEO_SAMPLE_RATE
124124
VideoCodec(const std::string& name, int width = 0, int height = 0, double fps = 0.0,
125125
int bitRate = 0,
126126
int sampleRate = 0,
127-
const std::string& pixelFmt = "");
127+
const std::string& pixelFmt = DEFAULT_VIDEO_PIXEL_FMT);
128128
VideoCodec(const std::string& name, const std::string& encoder,
129129
int width = 0, int height = 0, double fps = 0.0,
130130
int bitRate = 0,
131131
int sampleRatee = 0,
132-
const std::string& pixelFmt = "");
132+
const std::string& pixelFmt = DEFAULT_VIDEO_PIXEL_FMT);
133133
VideoCodec(const VideoCodec& r);
134134
virtual ~VideoCodec();
135135

src/av/include/scy/av/mediacapture.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,16 @@ class AV_API MediaCapture : public ICapture, public basic::Runnable
5656
virtual void getEncoderAudioCodec(AudioCodec& params);
5757
virtual void getEncoderVideoCodec(VideoCodec& params);
5858

59-
/// Continuously loop the input file when set
59+
/// Continuously loop the input file when set.
6060
void setLoopInput(bool flag);
6161

62-
/// Playback video in real time when set
63-
void setRealtimePlayback(bool flag);
62+
/// Limit playback to video FPS.
63+
void setLimitFramerate(bool flag);
64+
65+
/// Set to use realtime PTS calculation.
66+
/// This is preferred when sing live captures as FFmpeg provided values are
67+
/// not always reliable.
68+
void setRealtimePTS(bool flag);
6469

6570
AVFormatContext* formatCtx() const;
6671
VideoDecoder* video() const;
@@ -87,6 +92,7 @@ class AV_API MediaCapture : public ICapture, public basic::Runnable
8792
bool _stopping;
8893
bool _looping;
8994
bool _realtime;
95+
bool _ratelimit;
9096
};
9197

9298

0 commit comments

Comments
 (0)