mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	alsa-seq: improve midi encode some more
snd_midi_event_encode() will reset the encoder when it returns an encoded event. It is possible that the function returns with an encoded event when the internal buffer is full, in that case we need to push the event and continue encoding without reseting the encoder. 0 is not a snd_midi_event_encode() error, so don't handle it like one.
This commit is contained in:
		
							parent
							
								
									1c056661b6
								
							
						
					
					
						commit
						7dcfe81690
					
				
					 1 changed files with 4 additions and 4 deletions
				
			
		| 
						 | 
					@ -649,16 +649,16 @@ static int process_write(struct seq_state *state)
 | 
				
			||||||
			if (c->type != SPA_CONTROL_Midi)
 | 
								if (c->type != SPA_CONTROL_Midi)
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (size == 0) {
 | 
								if (size == 0)
 | 
				
			||||||
				/* only reset when we start decoding a new message */
 | 
									/* only reset when we start decoding a new message */
 | 
				
			||||||
				snd_seq_ev_clear(&ev);
 | 
									snd_seq_ev_clear(&ev);
 | 
				
			||||||
				snd_midi_event_reset_encode(stream->codec);
 | 
					
 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			if ((s = snd_midi_event_encode(stream->codec,
 | 
								if ((s = snd_midi_event_encode(stream->codec,
 | 
				
			||||||
						SPA_POD_BODY(&c->value),
 | 
											SPA_POD_BODY(&c->value),
 | 
				
			||||||
						SPA_POD_BODY_SIZE(&c->value), &ev)) <= 0) {
 | 
											SPA_POD_BODY_SIZE(&c->value), &ev)) < 0) {
 | 
				
			||||||
				spa_log_warn(state->log, "failed to encode event: %s",
 | 
									spa_log_warn(state->log, "failed to encode event: %s",
 | 
				
			||||||
						snd_strerror(s));
 | 
											snd_strerror(s));
 | 
				
			||||||
 | 
									snd_midi_event_reset_encode(stream->codec);
 | 
				
			||||||
				size = 0;
 | 
									size = 0;
 | 
				
			||||||
	                        continue;
 | 
						                        continue;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue