Support H264 transport streams in validated playback caches

This commit is contained in:
firestar5683
2026-09-19 17:50:07 -07:00
parent 875ec2ebd0
commit 01efd58031
3 changed files with 8 additions and 2 deletions
+1 -1
View File
@@ -39,7 +39,7 @@ def validated_playback(parent,route):
if source==target:
if before.st_size!=after.st_size:return None
else:
if source.suffix!='.hevc' or target.suffix!='.h264' or source.stem!=target.stem:return None
if source.name!='fcamera.hevc' or target.name not in ('fcamera.h264','fcamera.ts'):return None
if (derived/source).exists():return None
video=entry['video_validation']
if (type(video['source_frames']) is not int or video['source_frames']<=0
@@ -25,6 +25,12 @@ class PlaybackCacheTests(unittest.TestCase):
(self.parent/'playback/playback_manifest.json').write_text(json.dumps(self.manifest))
def test_normal_path_selects_complete_derived_cache(self):
self.assertEqual(local_source(ROUTE,self.root),self.parent/'playback')
def test_transport_stream_container_is_selected(self):
for entry in self.manifest['files']:
if entry['path'].endswith('.h264'):
original=self.parent/'playback'/entry['path'];entry['path']=entry['path'].replace('.h264','.ts')
original.rename(self.parent/'playback'/entry['path'])
self.save();self.assertEqual(local_source(ROUTE,self.root),self.parent/'playback')
def test_stale_source_falls_back(self):
(self.parent/self.manifest['files'][0]['source']).write_bytes(b'changed!')
self.assertEqual(local_source(ROUTE,self.root),self.parent)
+1 -1
View File
@@ -188,7 +188,7 @@ void Route::addFileToSegment(int n, const std::string &file) {
segments_[n].qlog = file;
} else if (name == "fcamera.hevc") {
segments_[n].road_cam = file;
} else if (name == "fcamera.h264" && segments_[n].road_cam.empty()) {
} else if ((name == "fcamera.h264" || name == "fcamera.ts") && segments_[n].road_cam.empty()) {
segments_[n].road_cam = file;
} else if (name == "dcamera.hevc") {
segments_[n].driver_cam = file;