update hwcodec, use ms as pts like vpx (#8422)

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages
2024-06-20 13:57:56 +08:00
committed by GitHub
parent 7956953669
commit 30bd4e1cef
5 changed files with 24 additions and 17 deletions

View File

@@ -287,13 +287,17 @@ mod hw {
let mut mid_data = Vec::new();
let mut counter = 0;
let mut time_sum = Duration::ZERO;
let start = std::time::Instant::now();
loop {
match c.frame(std::time::Duration::from_millis(30)) {
Ok(frame) => {
let tmp_timer = Instant::now();
let frame = frame.to(encoder.yuvfmt(), &mut yuv, &mut mid_data).unwrap();
let yuv = frame.yuv().unwrap();
for ref frame in encoder.encode(&yuv).unwrap() {
for ref frame in encoder
.encode(&yuv, start.elapsed().as_millis() as _)
.unwrap()
{
size += frame.data.len();
h26xs.push(frame.data.to_vec());