Don't try to write an audio frame if there aren't any planes
This commit is contained in:
		
							parent
							
								
									3beb1a8519
								
							
						
					
					
						commit
						3cad3b1e29
					
				
					 1 changed files with 29 additions and 28 deletions
				
			
		| 
						 | 
				
			
			@ -308,12 +308,12 @@ static bool ffmpeg_init_config(struct ff_config_param *params,
 | 
			
		|||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                
 | 
			
		||||
                // Assumption: if there is a video frame, there is an audio frame.
 | 
			
		||||
                let mut aframe = frame::Audio::new(
 | 
			
		||||
                    format::Sample::I16(format::sample::Type::Packed),
 | 
			
		||||
                    self.audio_buf.len(),
 | 
			
		||||
                    ChannelLayout::STEREO
 | 
			
		||||
                );
 | 
			
		||||
                if aframe.planes() > 0 {
 | 
			
		||||
                    aframe.set_channels(2);
 | 
			
		||||
                    aframe.set_rate(44100);
 | 
			
		||||
                    aframe.set_pts(Some(frame));
 | 
			
		||||
| 
						 | 
				
			
			@ -348,6 +348,7 @@ static bool ffmpeg_init_config(struct ff_config_param *params,
 | 
			
		|||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            None => println!("Video not ready during frame {}", self.frame)
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue