Skip to content

Commit 3d7c912

Browse files
committed
Processes can no longer select tracks that they created themselves
1 parent f1f9503 commit 3d7c912

File tree

7 files changed

+19
-4
lines changed

7 files changed

+19
-4
lines changed

lib/defines.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ static inline void show_stackframe(){}
181181
#define META_META_RECORDSIZE 548
182182

183183
#define META_TRACK_OFFSET 148
184-
#define META_TRACK_RECORDSIZE 1893
184+
#define META_TRACK_RECORDSIZE 1897
185185

186186
#define TRACK_TRACK_OFFSET 200
187187
#define TRACK_TRACK_RECORDSIZE 1049068

lib/dtsc.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,7 @@ namespace DTSC{
915915

916916
/// Initialize metadata from referenced DTSC::Scan object in master mode.
917917
Meta::Meta(const std::string &_streamName, const DTSC::Scan &src){
918+
ignoredPid = 0;
918919
version = DTSH_VERSION;
919920
streamMemBuf = 0;
920921
isMemBuf = false;
@@ -926,6 +927,7 @@ namespace DTSC{
926927
/// Initialize empty metadata, in master or slave mode.
927928
/// If stream name is empty, slave mode is enforced.
928929
Meta::Meta(const std::string &_streamName, bool master, bool autoBackOff){
930+
ignoredPid = 0;
929931
if (!_streamName.size()){master = false;}
930932
version = DTSH_VERSION;
931933
streamMemBuf = 0;
@@ -937,6 +939,7 @@ namespace DTSC{
937939

938940
/// Initialize metadata from given DTSH file in master mode.
939941
Meta::Meta(const std::string &_streamName, const std::string &fileName){
942+
ignoredPid = 0;
940943
version = DTSH_VERSION;
941944
streamMemBuf = 0;
942945
isMemBuf = false;
@@ -1215,7 +1218,7 @@ namespace DTSC{
12151218
trackList.addField("codec", RAX_32STRING);
12161219
trackList.addField("page", RAX_256STRING);
12171220
trackList.addField("lastupdate", RAX_64UINT);
1218-
trackList.addField("pid", RAX_32UINT);
1221+
trackList.addField("pid", RAX_64UINT);
12191222
trackList.addField("minkeepaway", RAX_64UINT);
12201223
trackList.addField("sourcetid", RAX_32UINT);
12211224
trackList.addField("encryption", RAX_256STRING);
@@ -2449,6 +2452,7 @@ namespace DTSC{
24492452
if (t.frames.isReady() && !t.frames.getPresent()){continue;}
24502453
if (t.parts.isReady() && !t.parts.getPresent()){continue;}
24512454
}
2455+
if (ignoredPid && trackList.getInt(trackPidField, i) == ignoredPid) { continue; }
24522456
// Remove track this is based on, if this track is encrypted
24532457
if (trackList.getInt(trackSourceTidField, i) != INVALID_TRACK_ID &&
24542458
std::string(trackList.getPointer(trackEncryptionField, i)) != ""){
@@ -3675,6 +3679,10 @@ namespace DTSC{
36753679
INFO_MSG("Applied limiter from %" PRIu64 " to %" PRIu64, min, max);
36763680
}
36773681

3682+
void Meta::ignorePid(uint64_t ignPid) {
3683+
ignoredPid = ignPid;
3684+
}
3685+
36783686
/// Returns true if the tracks idx1 and idx2 are keyframe aligned
36793687
bool Meta::keyTimingsMatch(size_t idx1, size_t idx2) const {
36803688
const DTSC::Track &t1 = tracks.at(idx1);

lib/dtsc.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,10 @@ namespace DTSC{
539539
void removeLimiter();
540540
void applyLimiter(uint64_t min, uint64_t max);
541541

542+
void ignorePid(uint64_t ignPid);
543+
542544
protected:
545+
uint64_t ignoredPid;
543546
void sBufMem(size_t trackCount = DEFAULT_TRACK_COUNT);
544547
void sBufShm(const std::string &_streamName, size_t trackCount = DEFAULT_TRACK_COUNT, bool master = true, bool autoBackOff = true);
545548
void streamInit(size_t trackCount = DEFAULT_TRACK_COUNT);

src/process/process_av.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,7 @@ namespace Mist{
442442
bool isRecording(){return false;}
443443

444444
ProcessSource(Socket::Connection & c) : Output(c) {
445+
meta.ignorePid(getpid());
445446
targetParams["keeptimes"] = true;
446447
realTime = 0;
447448
convertCtx = NULL;

src/process/process_exec.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ namespace Mist{
9292
public:
9393
bool isRecording(){return false;}
9494
ProcessSource(Socket::Connection &c) : OutEBML(c){
95+
meta.ignorePid(getpid());
9596
capa["name"] = "MKVExec";
9697
targetParams["keeptimes"] = true;
9798
realTime = 0;

src/process/process_ffmpeg.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ namespace Mist{
111111
public:
112112
bool isRecording(){return false;}
113113
ProcessSource(Socket::Connection &c) : OutEBML(c){
114+
meta.ignorePid(getpid());
114115
capa["name"] = "FFMPEG";
115116
targetParams["keeptimes"] = true;
116117
realTime = 0;

src/process/process_livepeer.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ namespace Mist{
6666
bool isRecording(){return false;}
6767
bool isReadyForPlay() { return true; }
6868
ProcessSource(Socket::Connection &c) : TSOutput(c){
69+
meta.ignorePid(getpid());
6970
capa["name"] = "Livepeer";
7071
capa["codecs"][0u][0u].append("+H264");
7172
capa["codecs"][0u][0u].append("+HEVC");
@@ -150,7 +151,7 @@ namespace Mist{
150151
case 0x07: // sps
151152
case 0x08: // pps
152153
shouldSplit = true;
153-
INFO_MSG("Switching to new segment since the current keyframe contains new init data");
154+
HIGH_MSG("Switching to new segment since the current keyframe contains new init data");
154155
default: break;
155156
}
156157
} else if (codec == "HEVC" && dataLen > 3) {
@@ -160,7 +161,7 @@ namespace Mist{
160161
case 33: // sps
161162
case 34: // pps
162163
shouldSplit = true;
163-
INFO_MSG("Switching to new segment since the current keyframe contains new init data");
164+
HIGH_MSG("Switching to new segment since the current keyframe contains new init data");
164165
default: break;
165166
}
166167
}

0 commit comments

Comments
 (0)