mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-03-25 22:21:01 +03:00
update hwcodec, use ms as pts like vpx (#8422)
Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
@@ -99,15 +99,18 @@ impl EncoderApi for VRamEncoder {
|
||||
fn encode_to_message(
|
||||
&mut self,
|
||||
frame: EncodeInput,
|
||||
_ms: i64,
|
||||
ms: i64,
|
||||
) -> ResultType<hbb_common::message_proto::VideoFrame> {
|
||||
let texture = frame.texture()?;
|
||||
let mut vf = VideoFrame::new();
|
||||
let mut frames = Vec::new();
|
||||
for frame in self.encode(texture).with_context(|| "Failed to encode")? {
|
||||
for frame in self
|
||||
.encode(texture, ms)
|
||||
.with_context(|| "Failed to encode")?
|
||||
{
|
||||
frames.push(EncodedVideoFrame {
|
||||
data: Bytes::from(frame.data),
|
||||
pts: frame.pts as _,
|
||||
pts: frame.pts,
|
||||
key: frame.key == 1,
|
||||
..Default::default()
|
||||
});
|
||||
@@ -266,8 +269,8 @@ impl VRamEncoder {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn encode(&mut self, texture: *mut c_void) -> ResultType<Vec<EncodeFrame>> {
|
||||
match self.encoder.encode(texture) {
|
||||
pub fn encode(&mut self, texture: *mut c_void, ms: i64) -> ResultType<Vec<EncodeFrame>> {
|
||||
match self.encoder.encode(texture, ms) {
|
||||
Ok(v) => {
|
||||
let mut data = Vec::<EncodeFrame>::new();
|
||||
data.append(v);
|
||||
|
||||
Reference in New Issue
Block a user