Changeset 57346 in vbox for trunk/src/VBox/Devices/Audio
- Timestamp:
- Aug 14, 2015 1:10:44 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvHostALSAAudio.cpp
r56649 r57346 148 148 } DRVHOSTALSAAUDIO, *PDRVHOSTALSAAUDIO; 149 149 150 /** Maximum number of tries to recover a broken pipe. */ 151 #define ALSA_RECOVERY_TRIES_MAX 5 152 150 153 typedef struct ALSAAUDIOSTREAMCFG 151 154 { … … 957 960 AssertBreak(cbRead); 958 961 959 cWritten = snd_pcm_writei(pThisStrmOut->phPCM, pThisStrmOut->pvBuf, cRead); 960 if (cWritten <= 0) 962 /* Don't try infinitely on recoverable errors. */ 963 unsigned iTry; 964 for (iTry = 0; iTry < ALSA_RECOVERY_TRIES_MAX; iTry++) 961 965 { 962 switch (cWritten) 966 cWritten = snd_pcm_writei(pThisStrmOut->phPCM, pThisStrmOut->pvBuf, cRead); 967 if (cWritten <= 0) 963 968 { 964 case 0:969 switch (cWritten) 965 970 { 966 LogFunc(("Failed to write %RI32 frames\n", cRead)); 967 rc = VERR_ACCESS_DENIED; 968 break; 969 } 970 971 case -EPIPE: 972 { 973 rc = drvHostALSAAudioRecover(pThisStrmOut->phPCM); 974 if (RT_FAILURE(rc)) 975 break; 976 977 LogFlowFunc(("Recovered from playback\n")); 978 continue; 979 } 980 981 case -ESTRPIPE: 982 { 983 /* Stream was suspended and waiting for a recovery. */ 984 rc = drvHostALSAAudioResume(pThisStrmOut->phPCM); 985 if (RT_FAILURE(rc)) 971 case 0: 986 972 { 987 LogRel(("ALSA: Failed to resume output stream\n")); 973 LogFunc(("Failed to write %RI32 frames\n", cRead)); 974 rc = VERR_ACCESS_DENIED; 988 975 break; 989 976 } 990 977 991 LogFlowFunc(("Resumed suspended output stream\n")); 992 continue; 978 case -EPIPE: 979 { 980 rc = drvHostALSAAudioRecover(pThisStrmOut->phPCM); 981 if (RT_FAILURE(rc)) 982 break; 983 984 LogFlowFunc(("Recovered from playback\n")); 985 continue; 986 } 987 988 case -ESTRPIPE: 989 { 990 /* Stream was suspended and waiting for a recovery. */ 991 rc = drvHostALSAAudioResume(pThisStrmOut->phPCM); 992 if (RT_FAILURE(rc)) 993 { 994 LogRel(("ALSA: Failed to resume output stream\n")); 995 break; 996 } 997 998 LogFlowFunc(("Resumed suspended output stream\n")); 999 continue; 1000 } 1001 1002 default: 1003 LogFlowFunc(("Failed to write %RI32 output frames, rc=%Rrc\n", 1004 cRead, rc)); 1005 rc = VERR_GENERAL_FAILURE; /** @todo */ 1006 break; 993 1007 } 994 995 default:996 LogFlowFunc(("Failed to write %RI32 output frames, rc=%Rrc\n",997 cRead, rc));998 rc = VERR_GENERAL_FAILURE; /** @todo */999 break;1000 1008 } 1001 } 1009 else 1010 break; 1011 } /* For number of tries. */ 1012 1013 if ( iTry == ALSA_RECOVERY_TRIES_MAX 1014 && cWritten <= 0) 1015 rc = VERR_BROKEN_PIPE; 1002 1016 1003 1017 if (RT_FAILURE(rc))
Note:
See TracChangeset
for help on using the changeset viewer.