Skip to content

Commit a658b3f

Browse files
fixup! Implement a decoder
1 parent 90d63b9 commit a658b3f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/decoder.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,14 @@ impl Decoder {
9999
(*pkt).buf = buf;
100100
(*pkt).data = data_ptr.cast();
101101
(*pkt).pts = packet.pts();
102-
103-
pkt
104102
// This should be the size of the data without the padding
105103
(*pkt).size = (len as i32) - sys::AV_INPUT_BUFFER_PADDING_SIZE as i32;
104+
105+
pkt
106106
};
107107
self.pts_map.set(packet.pts(), packet.rotation());
108-
109108
let ret = unsafe { sys::avcodec_send_packet(self.ctx, pkt) };
109+
// Regardless of errors we are done with this packet, parts of the packet might have been
110110
// retained in the decoder.
111111
unsafe {
112112
sys::av_packet_free(&mut pkt);
@@ -295,7 +295,7 @@ impl Default for DecodedFrame {
295295

296296
impl Drop for DecodedFrame {
297297
fn drop(&mut self) {
298-
if !self.0.is_null() {
298+
if self.0.is_null() {
299299
return;
300300
}
301301

@@ -308,7 +308,7 @@ impl Drop for DecodedFrame {
308308
impl Default for PtsMap {
309309
fn default() -> Self {
310310
Self {
311-
if self.0.is_null() {
311+
map: [(-1, 0); 16],
312312
cur: 0,
313313
}
314314
}

0 commit comments

Comments
 (0)