mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-03-13 21:12:55 -04:00
better debugging when unable to insert VSE
I saw this error once: Apr 27 21:01:33 nuc moonfire-nvr[188570]: s-reolink-sub moonfire_nvr::streamer] reolink-sub: sleeping for Duration { secs: 1, nanos: 0 } after error: CHECK constraint failed: video_sample_entry and would like to understand it better.
This commit is contained in:
parent
d99e18d17e
commit
a1e78ea48b
7
server/Cargo.lock
generated
7
server/Cargo.lock
generated
@ -1192,6 +1192,7 @@ dependencies = [
|
|||||||
"nix",
|
"nix",
|
||||||
"odds",
|
"odds",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
|
"pretty-hex",
|
||||||
"prettydiff",
|
"prettydiff",
|
||||||
"protobuf",
|
"protobuf",
|
||||||
"protobuf-codegen-pure",
|
"protobuf-codegen-pure",
|
||||||
@ -1550,6 +1551,12 @@ version = "0.2.10"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
|
checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pretty-hex"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bc5c99d529f0d30937f6f4b8a86d988047327bb88d04d2c4afc356de74722131"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "prettydiff"
|
name = "prettydiff"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
|
@ -30,6 +30,7 @@ mylog = { git = "https://github.com/scottlamb/mylog" }
|
|||||||
nix = "0.19.0"
|
nix = "0.19.0"
|
||||||
odds = { version = "0.4.0", features = ["std-vec"] }
|
odds = { version = "0.4.0", features = ["std-vec"] }
|
||||||
parking_lot = { version = "0.11.1", features = [] }
|
parking_lot = { version = "0.11.1", features = [] }
|
||||||
|
pretty-hex = "0.2.1"
|
||||||
prettydiff = "0.4.0"
|
prettydiff = "0.4.0"
|
||||||
protobuf = { git = "https://github.com/stepancheg/rust-protobuf" }
|
protobuf = { git = "https://github.com/stepancheg/rust-protobuf" }
|
||||||
ring = "0.16.2"
|
ring = "0.16.2"
|
||||||
|
@ -135,7 +135,7 @@ pub struct VideoSampleEntry {
|
|||||||
pub pasp_v_spacing: u16,
|
pub pasp_v_spacing: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(PartialEq, Eq)]
|
||||||
pub struct VideoSampleEntryToInsert {
|
pub struct VideoSampleEntryToInsert {
|
||||||
pub data: Vec<u8>,
|
pub data: Vec<u8>,
|
||||||
pub rfc6381_codec: String,
|
pub rfc6381_codec: String,
|
||||||
@ -145,6 +145,20 @@ pub struct VideoSampleEntryToInsert {
|
|||||||
pub pasp_v_spacing: u16,
|
pub pasp_v_spacing: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl std::fmt::Debug for VideoSampleEntryToInsert {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||||
|
use pretty_hex::PrettyHex;
|
||||||
|
f.debug_struct("VideoSampleEntryToInsert")
|
||||||
|
.field("data", &self.data.hex_dump())
|
||||||
|
.field("rfc6381_codec", &self.rfc6381_codec)
|
||||||
|
.field("width", &self.width)
|
||||||
|
.field("height", &self.height)
|
||||||
|
.field("pasp_h_spacing", &self.pasp_h_spacing)
|
||||||
|
.field("pasp_v_spacing", &self.pasp_v_spacing)
|
||||||
|
.finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// A row used in `list_recordings_by_time` and `list_recordings_by_id`.
|
/// A row used in `list_recordings_by_time` and `list_recordings_by_id`.
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
pub struct ListRecordingsRow {
|
pub struct ListRecordingsRow {
|
||||||
@ -1708,7 +1722,8 @@ impl LockedDatabase {
|
|||||||
":pasp_v_spacing": i32::from(entry.pasp_v_spacing),
|
":pasp_v_spacing": i32::from(entry.pasp_v_spacing),
|
||||||
":rfc6381_codec": &entry.rfc6381_codec,
|
":rfc6381_codec": &entry.rfc6381_codec,
|
||||||
":data": &entry.data,
|
":data": &entry.data,
|
||||||
})?;
|
})
|
||||||
|
.map_err(|e| Error::from(e).context(format!("Unable to insert {:#?}", &entry)))?;
|
||||||
|
|
||||||
let id = self.conn.last_insert_rowid() as i32;
|
let id = self.conn.last_insert_rowid() as i32;
|
||||||
self.video_sample_entries_by_id.insert(
|
self.video_sample_entries_by_id.insert(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user