ignore empty frames
authorKostya Shishkov <kostya.shishkov@gmail.com>
Fri, 19 Nov 2021 17:27:48 +0000 (18:27 +0100)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Fri, 19 Nov 2021 17:27:48 +0000 (18:27 +0100)
sndplay/src/main.rs

index c8e75a420731439355bad5c45ef1e7f432485aa7..275826ff9f7db9d425b5efc9a3c37a12179ba3ef 100644 (file)
@@ -153,6 +153,9 @@ impl<'a> Decoder<'a> {
                                 if let Some(pts) = frm.ts.get_pts() {
                                     self.samplepos = NATimeInfo::ts_to_time(pts, u64::from(self.arate), frm.ts.tb_num, frm.ts.tb_den);
                                 }
                                 if let Some(pts) = frm.ts.get_pts() {
                                     self.samplepos = NATimeInfo::ts_to_time(pts, u64::from(self.arate), frm.ts.tb_num, frm.ts.tb_den);
                                 }
+                                if buf.get_audio_length() == 0 {
+                                    return false;
+                                }
                                 let out_buf = convert_audio_frame(&buf, &self.dst_info, &self.dst_chmap).unwrap();
                                 match out_buf {
                                     NABufferType::AudioI16(abuf) => {
                                 let out_buf = convert_audio_frame(&buf, &self.dst_info, &self.dst_chmap).unwrap();
                                 match out_buf {
                                     NABufferType::AudioI16(abuf) => {