mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	stream: expose the lazy flag with pw_stream_is_lazy()
Together with the is_driver() status, this can be used to check if the stream is using lazy scheduling or not.
This commit is contained in:
		
							parent
							
								
									75e54ddc4f
								
							
						
					
					
						commit
						61f15734e1
					
				
					 4 changed files with 45 additions and 5 deletions
				
			
		| 
						 | 
					@ -2064,6 +2064,12 @@ bool pw_filter_is_driving(struct pw_filter *filter)
 | 
				
			||||||
	return filter->node->driving;
 | 
						return filter->node->driving;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SPA_EXPORT
 | 
				
			||||||
 | 
					bool pw_filter_is_lazy(struct pw_filter *filter)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return filter->node->lazy;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int
 | 
					static int
 | 
				
			||||||
do_trigger_process(struct spa_loop *loop,
 | 
					do_trigger_process(struct spa_loop *loop,
 | 
				
			||||||
                 bool async, uint32_t seq, const void *data, size_t size, void *user_data)
 | 
					                 bool async, uint32_t seq, const void *data, size_t size, void *user_data)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -249,6 +249,10 @@ int pw_filter_flush(struct pw_filter *filter, bool drain);
 | 
				
			||||||
 * available (output) or needed (input). Since 0.3.66 */
 | 
					 * available (output) or needed (input). Since 0.3.66 */
 | 
				
			||||||
bool pw_filter_is_driving(struct pw_filter *filter);
 | 
					bool pw_filter_is_driving(struct pw_filter *filter);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** Check if the graph is using lazy scheduling.
 | 
				
			||||||
 | 
					 * Since 1.2.7 */
 | 
				
			||||||
 | 
					bool pw_filter_is_lazy(struct pw_filter *filter);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Trigger a push/pull on the filter. One iteration of the graph will
 | 
					/** Trigger a push/pull on the filter. One iteration of the graph will
 | 
				
			||||||
 * be scheduled and process() will be called. Since 0.3.66 */
 | 
					 * be scheduled and process() will be called. Since 0.3.66 */
 | 
				
			||||||
int pw_filter_trigger_process(struct pw_filter *filter);
 | 
					int pw_filter_trigger_process(struct pw_filter *filter);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2523,6 +2523,12 @@ bool pw_stream_is_driving(struct pw_stream *stream)
 | 
				
			||||||
	return stream->node->driving;
 | 
						return stream->node->driving;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SPA_EXPORT
 | 
				
			||||||
 | 
					bool pw_stream_is_lazy(struct pw_stream *stream)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return stream->node->lazy;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int
 | 
					static int
 | 
				
			||||||
do_trigger_driver(struct spa_loop *loop,
 | 
					do_trigger_driver(struct spa_loop *loop,
 | 
				
			||||||
                 bool async, uint32_t seq, const void *data, size_t size, void *user_data)
 | 
					                 bool async, uint32_t seq, const void *data, size_t size, void *user_data)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -569,16 +569,33 @@ int pw_stream_flush(struct pw_stream *stream, bool drain);
 | 
				
			||||||
 * available (output) or needed (input). Since 0.3.34 */
 | 
					 * available (output) or needed (input). Since 0.3.34 */
 | 
				
			||||||
bool pw_stream_is_driving(struct pw_stream *stream);
 | 
					bool pw_stream_is_driving(struct pw_stream *stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** Check if the graph is using lazy scheduling. If the stream is
 | 
				
			||||||
 | 
					 * driving according to \ref pw_stream_is_driving(), then it should
 | 
				
			||||||
 | 
					 * consider taking into account the RequestProcess commands when
 | 
				
			||||||
 | 
					 * driving the graph.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * If the stream is not driving, it should send out RequestProcess
 | 
				
			||||||
 | 
					 * events with \ref pw_stream_emit_event() or indirectly with
 | 
				
			||||||
 | 
					 * \ref pw_stream_trigger_process() to suggest a new graph cycle
 | 
				
			||||||
 | 
					 * to the driver.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * It is not a requirement that all RequestProcess events/commands
 | 
				
			||||||
 | 
					 * need to start a graph cycle.
 | 
				
			||||||
 | 
					 * Since 1.2.7 */
 | 
				
			||||||
 | 
					bool pw_stream_is_lazy(struct pw_stream *stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Trigger a push/pull on the stream. One iteration of the graph will
 | 
					/** Trigger a push/pull on the stream. One iteration of the graph will
 | 
				
			||||||
 * be scheduled. If it successfully finishes, process() will be called.
 | 
					 * be scheduled when the stream is driving according to
 | 
				
			||||||
 * It is possible for the graph iteration to not finish, so
 | 
					 * \ref pw_stream_is_driving(). If it successfully finishes, process()
 | 
				
			||||||
 | 
					 * will be called and the trigger_done event will be emitted. It is
 | 
				
			||||||
 | 
					 * possible for the graph iteration to not finish, so
 | 
				
			||||||
 * pw_stream_trigger_process() needs to be called again even if process()
 | 
					 * pw_stream_trigger_process() needs to be called again even if process()
 | 
				
			||||||
 * is not called.
 | 
					 * and trigger_done is not called.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * If there is a deadline after which the stream will have xrun,
 | 
					 * If there is a deadline after which the stream will have xrun,
 | 
				
			||||||
 * pw_stream_trigger_process() should be called then, whether or not
 | 
					 * pw_stream_trigger_process() should be called then, whether or not
 | 
				
			||||||
 * process() has been called. Sound hardware will xrun if there is
 | 
					 * process()/trigger_done has been called. Sound hardware will xrun if
 | 
				
			||||||
 * any delay in audio processing, so the ALSA plugin triggers the
 | 
					 * there is any delay in audio processing, so the ALSA plugin triggers the
 | 
				
			||||||
 * graph every quantum to ensure audio keeps flowing. Drivers that
 | 
					 * graph every quantum to ensure audio keeps flowing. Drivers that
 | 
				
			||||||
 * do not have a deadline, such as the freewheel driver, should
 | 
					 * do not have a deadline, such as the freewheel driver, should
 | 
				
			||||||
 * use a timeout to ensure that forward progress keeps being made.
 | 
					 * use a timeout to ensure that forward progress keeps being made.
 | 
				
			||||||
| 
						 | 
					@ -586,6 +603,13 @@ bool pw_stream_is_driving(struct pw_stream *stream);
 | 
				
			||||||
 * the graph is taking 3x longer than normal, it is likely that it
 | 
					 * the graph is taking 3x longer than normal, it is likely that it
 | 
				
			||||||
 * is hung and should be retriggered.
 | 
					 * is hung and should be retriggered.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 | 
					 * Streams that are not drivers according to \ref pw_stream_is_driving()
 | 
				
			||||||
 | 
					 * can also call this method. The result is that a RequestProcess event
 | 
				
			||||||
 | 
					 * is sent to the driver. If the graph is lazy scheduling according to
 | 
				
			||||||
 | 
					 * \ref pw_stream_is_lazy(), this might result in a graph cycle by the
 | 
				
			||||||
 | 
					 * driver. If the graph is not lazy scheduling and the stream is not a
 | 
				
			||||||
 | 
					 * driver, this method will have no effect.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 * Since 0.3.34 */
 | 
					 * Since 0.3.34 */
 | 
				
			||||||
int pw_stream_trigger_process(struct pw_stream *stream);
 | 
					int pw_stream_trigger_process(struct pw_stream *stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue