Skip to content

The execution time jumped after the capture returned 0 bytes of data, increasing by 4-5 times. #159

@nooly1998

Description

@nooly1998

scap = "0.0.8"
platform = macOS M2

[START] Executing function: get_capture...
[END] function: get_capture executed in 19.526167ms
捕获第 1 帧,数据大小: 20736000 字节
[h264_videotoolbox @ 0x13b7060e0] Color range not set for yuv420p. Using MPEG range.
send packets: 0
[START] Executing function: get_capture...
[END] function: get_capture executed in 7.063042ms
捕获第 2 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 5.411959ms
捕获第 3 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 4.476167ms
捕获第 4 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 5.603042ms
捕获第 5 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 5.211417ms
捕获第 6 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 5.164375ms
捕获第 7 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 5.1005ms
捕获第 8 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 5.536541ms
捕获第 9 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.4045ms
捕获第 10 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 4.548ms
捕获第 11 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 4.940709ms
捕获第 12 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 5.11225ms
捕获第 13 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 6.784125ms
捕获第 14 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 7.987875ms
捕获第 15 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 5.67175ms
捕获第 16 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 4.948792ms
捕获第 17 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.402875ms
捕获第 18 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.295417ms
捕获第 19 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.208459ms
捕获第 20 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.201334ms
捕获第 21 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.419667ms
捕获第 22 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 4.061541ms
捕获第 23 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.868458ms
捕获第 24 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.495917ms
捕获第 25 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.950208ms
捕获第 26 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 6.986791ms
捕获第 27 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 7.831875ms
捕获第 28 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.728625ms
捕获第 29 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.297458ms
捕获第 30 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 5.291958ms
捕获第 31 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.736958ms
捕获第 32 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.315917ms
捕获第 33 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.127042ms
捕获第 34 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.778875ms
捕获第 35 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.595791ms
捕获第 36 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.284334ms
捕获第 37 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.152ms
捕获第 38 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.226458ms
捕获第 39 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.207333ms
捕获第 40 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.396125ms
捕获第 41 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.504042ms
捕获第 42 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.609375ms
捕获第 43 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.203875ms
捕获第 44 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.564292ms
捕获第 45 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 4.233292ms
捕获第 46 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.388417ms
捕获第 47 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.042083ms
捕获第 48 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 2.167µs
捕获第 49 帧,数据大小: 0 字节
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.891667ms
捕获第 50 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.689541ms
捕获第 51 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.744709ms
捕获第 52 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 1.75µs
捕获第 53 帧,数据大小: 0 字节
[START] Executing function: get_capture...
[END] function: get_capture executed in 4.064167ms
捕获第 54 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.203667ms
捕获第 55 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.447708ms
捕获第 56 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.272625ms
捕获第 57 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.16975ms
捕获第 58 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.2265ms
捕获第 59 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.11125ms
捕获第 60 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.444333ms
捕获第 61 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 4.340458ms
捕获第 62 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.77875ms
捕获第 63 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.189417ms
捕获第 64 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.279208ms
捕获第 65 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.095333ms
捕获第 66 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.361959ms
捕获第 67 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.506208ms
捕获第 68 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.459084ms
捕获第 69 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.989333ms
捕获第 70 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.190792ms
捕获第 71 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 4.263084ms
捕获第 72 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 6.540041ms
捕获第 73 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 5.5575ms
捕获第 74 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 6.97075ms
捕获第 75 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 4.243583ms
捕获第 76 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 5.640875ms
捕获第 77 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 4.069541ms
捕获第 78 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 4.661292ms
捕获第 79 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 6.516875ms
捕获第 80 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.3965ms
捕获第 81 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 17.175917ms
捕获第 82 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 5.116625ms
捕获第 83 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.701333ms
捕获第 84 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 12.626625ms
捕获第 85 帧,数据大小: 0 字节
[START] Executing function: get_capture...
[END] function: get_capture executed in 21.645292ms
捕获第 86 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.76725ms
捕获第 87 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 8.427542ms
捕获第 88 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 4.270042ms
捕获第 89 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.241708ms
捕获第 90 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 12.270792ms
捕获第 91 帧,数据大小: 0 字节
[START] Executing function: get_capture...
[END] function: get_capture executed in 21.891792ms
捕获第 92 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 3.523167ms
捕获第 93 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 5.595333ms
捕获第 94 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 4.942167ms
捕获第 95 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 4.779209ms
捕获第 96 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 22.359583ms
捕获第 97 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 4.595708ms
捕获第 98 帧,数据大小: 20736000 字节
send packets: 1
[START] Executing function: get_capture...
[END] function: get_capture executed in 13.304417ms
捕获第 99 帧,数据大小: 0 字节
[START] Executing function: get_capture...
[END] function: get_capture executed in 24.253583ms
捕获第 100 帧,数据大小: 20736000 字节
send packets: 1

#[instrument]
fn get_capture(&mut self) -> Result<Vec<u8>, Box<dyn std::error::Error>> {
    let frame = self.capture.get_next_frame()?;
    match frame {
        Frame::BGRA(frame) => {
            let buffer = frame.data;
            let width = frame.width;
            let height = frame.height;
            self.width = width as f64;
            self.height = height as f64;
            self.bytes_per_row = (width * 4) as u32;
            Ok(buffer)
        }
        _ => Err(Box::from("can not match frame type!")),
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions