mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 00:26:39 +00:00 
			
		
		
		
	More fixes for the audio clock
The audio_clock for the decoder represents the end of the current packet, so it needs to be adjusted back to match the position that's actually going to be read next.
This commit is contained in:
		
							parent
							
								
									1a771ae671
								
							
						
					
					
						commit
						4561c22e2b
					
				
					 1 changed files with 4 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -416,7 +416,7 @@ public:
 | 
			
		|||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                mFramePos = std::min(static_cast<int>(mFrameSize), sample_skip);
 | 
			
		||||
                mFramePos = std::min<ssize_t>(mFrameSize, sample_skip);
 | 
			
		||||
                sample_skip -= mFramePos;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -471,7 +471,9 @@ public:
 | 
			
		|||
 | 
			
		||||
    size_t getSampleOffset()
 | 
			
		||||
    {
 | 
			
		||||
        return (size_t)(is->audio_clock*is->audio_st->codec->sample_rate);
 | 
			
		||||
        ssize_t clock_delay = (mFrameSize-mFramePos) / is->audio_st->codec->channels /
 | 
			
		||||
                              av_get_bytes_per_sample(is->audio_st->codec->sample_fmt);
 | 
			
		||||
        return (size_t)(is->audio_clock*is->audio_st->codec->sample_rate) - clock_delay;
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue