Skip to content

Commit

Permalink
Fix: ensure we respect quality related feature options when propogati…
Browse files Browse the repository at this point in the history
…ng across controllers and devices.
  • Loading branch information
hjdhjd committed Apr 30, 2023
1 parent 0a95775 commit ccc13f6
Showing 1 changed file with 45 additions and 3 deletions.
48 changes: 45 additions & 3 deletions src/protect-camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,19 +599,61 @@ export class ProtectCamera extends ProtectDevice {
}
}

// Check for explicit RTSP profile preferences.
// Canary to ensure we stop once we find.
let onlyStreamFound = false;
let onlyRecordFound = false;

// Check for explicit RTSP profile preferences at the device level.
for(const rtspProfile of [ "LOW", "MEDIUM", "HIGH" ]) {

// Check to see if the user has requested a specific streaming profile for this camera.
if(this.nvr.optionEnabled(this.ufp, "Video.Stream.Only." + rtspProfile + "." + this.ufp.mac, false)) {

this.rtspQuality.StreamingDefault = rtspProfile;
onlyStreamFound = true;
}

// Check to see if the user has requested a specific recording profile for this camera.
if(this.nvr.optionEnabled(this.ufp, "Video.HKSV.Record.Only." + rtspProfile + "." + this.ufp.mac, false)) {

this.rtspQuality.RecordingDefault = rtspProfile;
onlyRecordFound = true;
}
}

// Check for explicit RTSP profile preferences at the controller level.
for(const rtspProfile of [ "LOW", "MEDIUM", "HIGH" ]) {

// Check to see if the user has requested a specific streaming profile for this camera.
if(!onlyStreamFound && this.nvr.optionEnabled(this.ufp, "Video.Stream.Only." + rtspProfile + "." + this.nvr.ufp.mac, false)) {

this.rtspQuality.StreamingDefault = rtspProfile;
onlyStreamFound = true;
}

// Check to see if the user has requested a specific recording profile for this camera.
if(!onlyRecordFound && this.nvr.optionEnabled(this.ufp, "Video.HKSV.Record.Only." + rtspProfile + "." + this.nvr.ufp.mac, false)) {

this.rtspQuality.RecordingDefault = rtspProfile;
onlyRecordFound = true;
}
}

// Check for explicit RTSP profile preferences globally.
for(const rtspProfile of [ "LOW", "MEDIUM", "HIGH" ]) {

// Check to see if the user has requested a specific streaming profile for this camera.
if(this.nvr.optionEnabled(this.ufp, "Video.Stream.Only." + rtspProfile, false)) {
if(!onlyStreamFound && this.nvr.optionEnabled(this.ufp, "Video.Stream.Only." + rtspProfile, false)) {

this.rtspQuality.StreamingDefault = rtspProfile;
onlyStreamFound = true;
}

// Check to see if the user has requested a specific recording profile for this camera.
if(this.nvr.optionEnabled(this.ufp, "Video.HKSV.Record.Only." + rtspProfile, false)) {
if(!onlyRecordFound && this.nvr.optionEnabled(this.ufp, "Video.HKSV.Record.Only." + rtspProfile, false)) {

this.rtspQuality.RecordingDefault = rtspProfile;
onlyRecordFound = true;
}
}

Expand Down

0 comments on commit ccc13f6

Please sign in to comment.