mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	Modify smoothing code to make cubic interpolation optional and allow 'quick fixups' on resuming
The primary reason for this change is to allow time graphs that do not go through the origin and hence smoothing starting from the origin is not desired. This change will allow passing time data into the smoother while paused and then abruptly use that data without smoothing using the 'quick fixup' flag when resuming. Primary use case is allowing recording time graphs where the data recorded originates from a time before the stream was created. The resulting graft will be shifted and should not be smoothened to go through the origin.
This commit is contained in:
		
							parent
							
								
									1c26d7e174
								
							
						
					
					
						commit
						d035f4a3f3
					
				
					 12 changed files with 136 additions and 43 deletions
				
			
		| 
						 | 
				
			
			@ -393,7 +393,8 @@ static void check_smoother_status(pa_stream *s, pa_bool_t aposteriori, pa_bool_t
 | 
			
		|||
    if (s->suspended || s->corked || force_stop)
 | 
			
		||||
        pa_smoother_pause(s->smoother, x);
 | 
			
		||||
    else if (force_start || s->buffer_attr.prebuf == 0)
 | 
			
		||||
        pa_smoother_resume(s->smoother, x);
 | 
			
		||||
        pa_smoother_resume(s->smoother, x, TRUE);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /* Please note that we have no idea if playback actually started
 | 
			
		||||
     * if prebuf is non-zero! */
 | 
			
		||||
| 
						 | 
				
			
			@ -1064,14 +1065,17 @@ static int create_stream(
 | 
			
		|||
    if (flags & PA_STREAM_INTERPOLATE_TIMING) {
 | 
			
		||||
        pa_usec_t x;
 | 
			
		||||
 | 
			
		||||
        if (s->smoother)
 | 
			
		||||
            pa_smoother_free(s->smoother);
 | 
			
		||||
 | 
			
		||||
        s->smoother = pa_smoother_new(SMOOTHER_ADJUST_TIME, SMOOTHER_HISTORY_TIME, !(flags & PA_STREAM_NOT_MONOTONIC), SMOOTHER_MIN_HISTORY);
 | 
			
		||||
 | 
			
		||||
        x = pa_rtclock_usec();
 | 
			
		||||
        pa_smoother_set_time_offset(s->smoother, x);
 | 
			
		||||
        pa_smoother_pause(s->smoother, x);
 | 
			
		||||
 | 
			
		||||
        pa_assert(!s->smoother);
 | 
			
		||||
        s->smoother = pa_smoother_new(
 | 
			
		||||
                SMOOTHER_ADJUST_TIME,
 | 
			
		||||
                SMOOTHER_HISTORY_TIME,
 | 
			
		||||
                !(flags & PA_STREAM_NOT_MONOTONIC),
 | 
			
		||||
                TRUE,
 | 
			
		||||
                SMOOTHER_MIN_HISTORY,
 | 
			
		||||
                x,
 | 
			
		||||
                TRUE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (!dev)
 | 
			
		||||
| 
						 | 
				
			
			@ -1623,7 +1627,7 @@ static void stream_get_timing_info_callback(pa_pdispatch *pd, uint32_t command,
 | 
			
		|||
                pa_smoother_put(o->stream->smoother, u, calc_time(o->stream, TRUE));
 | 
			
		||||
 | 
			
		||||
            if (i->playing)
 | 
			
		||||
                pa_smoother_resume(o->stream->smoother, x);
 | 
			
		||||
                pa_smoother_resume(o->stream->smoother, x, TRUE);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue