mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	alsa: Open iec958 device with NONAUDIO bit set in passthrough mode
This is required for E-AC3 streams, as well as to let receivers we're sending non-PCM data (which avoids playing noise if the data is incorrect for some reason).
This commit is contained in:
		
							parent
							
								
									adbdb6259b
								
							
						
					
					
						commit
						814c0371a4
					
				
					 1 changed files with 13 additions and 1 deletions
				
			
		| 
						 | 
					@ -990,13 +990,22 @@ static int unsuspend(struct userdata *u) {
 | 
				
			||||||
    int err;
 | 
					    int err;
 | 
				
			||||||
    pa_bool_t b, d;
 | 
					    pa_bool_t b, d;
 | 
				
			||||||
    snd_pcm_uframes_t period_size, buffer_size;
 | 
					    snd_pcm_uframes_t period_size, buffer_size;
 | 
				
			||||||
 | 
					    char *device_name = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_assert(u);
 | 
					    pa_assert(u);
 | 
				
			||||||
    pa_assert(!u->pcm_handle);
 | 
					    pa_assert(!u->pcm_handle);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_log_info("Trying resume...");
 | 
					    pa_log_info("Trying resume...");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ((err = snd_pcm_open(&u->pcm_handle, u->device_name, SND_PCM_STREAM_PLAYBACK,
 | 
					    if ((is_spdif(u) || is_hdmi(u)) && pa_sink_is_passthrough(u->sink)) {
 | 
				
			||||||
 | 
					        /* Need to open device in NONAUDIO mode */
 | 
				
			||||||
 | 
					        int len = strlen(u->device_name) + 8;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        device_name = pa_xmalloc(len);
 | 
				
			||||||
 | 
					        pa_snprintf(device_name, len, "%s,AES0=6", u->device_name);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if ((err = snd_pcm_open(&u->pcm_handle, device_name ? device_name : u->device_name, SND_PCM_STREAM_PLAYBACK,
 | 
				
			||||||
                            SND_PCM_NONBLOCK|
 | 
					                            SND_PCM_NONBLOCK|
 | 
				
			||||||
                            SND_PCM_NO_AUTO_RESAMPLE|
 | 
					                            SND_PCM_NO_AUTO_RESAMPLE|
 | 
				
			||||||
                            SND_PCM_NO_AUTO_CHANNELS|
 | 
					                            SND_PCM_NO_AUTO_CHANNELS|
 | 
				
			||||||
| 
						 | 
					@ -1050,6 +1059,7 @@ static int unsuspend(struct userdata *u) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_log_info("Resumed successfully...");
 | 
					    pa_log_info("Resumed successfully...");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    pa_xfree(device_name);
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fail:
 | 
					fail:
 | 
				
			||||||
| 
						 | 
					@ -1058,6 +1068,8 @@ fail:
 | 
				
			||||||
        u->pcm_handle = NULL;
 | 
					        u->pcm_handle = NULL;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    pa_xfree(device_name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return -PA_ERR_IO;
 | 
					    return -PA_ERR_IO;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue