Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Side by Side Diff: webrtc/modules/audio_device/win/audio_device_wave_win.cc

Issue 1593713013: Roll chromium_revision 7a4fb8d..f527e86 (370025:370073) (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Fix/disable Win Clang warnings Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 2719 matching lines...) Expand 10 before | Expand all | Expand 10 after
2730 // Avoid adjusting when there is 32-bit wrap-around since that is 2730 // Avoid adjusting when there is 32-bit wrap-around since that is
2731 // something neccessary. 2731 // something neccessary.
2732 // 2732 //
2733 WEBRTC_TRACE(kTraceDebug, kTraceUtility, _id, "msecleft() => wrap ar ound occured: %d bits used by sound card)", (i+1)); 2733 WEBRTC_TRACE(kTraceDebug, kTraceUtility, _id, "msecleft() => wrap ar ound occured: %d bits used by sound card)", (i+1));
2734 2734
2735 _writtenSamples = _writtenSamples - POW2(i + 1); 2735 _writtenSamples = _writtenSamples - POW2(i + 1);
2736 writtenSamples = _writtenSamples; 2736 writtenSamples = _writtenSamples;
2737 msecInPlayoutBuffer = ((writtenSamples - playedSamples)/nSamplesPerM s); 2737 msecInPlayoutBuffer = ((writtenSamples - playedSamples)/nSamplesPerM s);
2738 } 2738 }
2739 } 2739 }
2740 else if ((_writtenSamplesOld > POW2(31)) && (writtenSamples < 96000)) 2740 else if ((_writtenSamplesOld > (unsigned long)POW2(31)) && (writtenSamples < 96000))
2741 { 2741 {
2742 // Wrap around as expected after having used all 32 bits. (But we still 2742 // Wrap around as expected after having used all 32 bits. (But we still
2743 // test if the wrap around happened earlier which it should not) 2743 // test if the wrap around happened earlier which it should not)
2744 2744
2745 i = 31; 2745 i = 31;
2746 while (_writtenSamplesOld <= (unsigned long)POW2(i)) { 2746 while (_writtenSamplesOld <= (unsigned long)POW2(i)) {
2747 i--; 2747 i--;
2748 } 2748 }
2749 2749
2750 WEBRTC_TRACE(kTraceDebug, kTraceUtility, _id, " msecleft() (wrap around occured after having used all 32 bits)"); 2750 WEBRTC_TRACE(kTraceDebug, kTraceUtility, _id, " msecleft() (wrap around occured after having used all 32 bits)");
2751 2751
2752 _writtenSamplesOld = writtenSamples; 2752 _writtenSamplesOld = writtenSamples;
2753 _playedSamplesOld = playedSamples; 2753 _playedSamplesOld = playedSamples;
2754 msecInPlayoutBuffer = (int)((writtenSamples + POW2(i + 1) - playedSample s)/nSamplesPerMs); 2754 msecInPlayoutBuffer = (int)((writtenSamples + POW2(i + 1) - playedSample s)/nSamplesPerMs);
2755 2755
2756 } 2756 }
2757 else if ((writtenSamples < 96000) && (playedSamples > POW2(31))) 2757 else if ((writtenSamples < 96000) && (playedSamples > (unsigned long)POW2(31 )))
2758 { 2758 {
2759 // Wrap around has, as expected, happened for written_sampels before 2759 // Wrap around has, as expected, happened for written_sampels before
2760 // playedSampels so we have to adjust for this until also playedSampels 2760 // playedSampels so we have to adjust for this until also playedSampels
2761 // has had wrap around. 2761 // has had wrap around.
2762 2762
2763 WEBRTC_TRACE(kTraceDebug, kTraceUtility, _id, " msecleft() (wrap around occured: correction of output is done)"); 2763 WEBRTC_TRACE(kTraceDebug, kTraceUtility, _id, " msecleft() (wrap around occured: correction of output is done)");
2764 2764
2765 _writtenSamplesOld = writtenSamples; 2765 _writtenSamplesOld = writtenSamples;
2766 _playedSamplesOld = playedSamples; 2766 _playedSamplesOld = playedSamples;
2767 msecInPlayoutBuffer = (int)((writtenSamples + POW2(32) - playedSamples)/ nSamplesPerMs); 2767 msecInPlayoutBuffer = (int)((writtenSamples + POW2(32) - playedSamples)/ nSamplesPerMs);
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
2946 readSamples = _read_samples; 2946 readSamples = _read_samples;
2947 _wrapCounter++; 2947 _wrapCounter++;
2948 } else { 2948 } else {
2949 WEBRTC_TRACE (kTraceWarning, kTraceUtility, -1,"AEC (_rec_samples_ol d %d recSamples %d)",_rec_samples_old, recSamples); 2949 WEBRTC_TRACE (kTraceWarning, kTraceUtility, -1,"AEC (_rec_samples_ol d %d recSamples %d)",_rec_samples_old, recSamples);
2950 } 2950 }
2951 } 2951 }
2952 2952
2953 if((_wrapCounter>200)){ 2953 if((_wrapCounter>200)){
2954 // Do nothing, handled later 2954 // Do nothing, handled later
2955 } 2955 }
2956 else if((_rec_samples_old > POW2(31)) && (recSamples < 96000)) { 2956 else if((_rec_samples_old > (unsigned long)POW2(31)) && (recSamples < 96000) ) {
2957 WEBRTC_TRACE (kTraceDebug, kTraceUtility, -1,"WRAP 2 (_rec_samples_old % d recSamples %d)",_rec_samples_old, recSamples); 2957 WEBRTC_TRACE (kTraceDebug, kTraceUtility, -1,"WRAP 2 (_rec_samples_old % d recSamples %d)",_rec_samples_old, recSamples);
2958 // Wrap around as expected after having used all 32 bits. 2958 // Wrap around as expected after having used all 32 bits.
2959 _read_samples_old = readSamples; 2959 _read_samples_old = readSamples;
2960 _rec_samples_old = recSamples; 2960 _rec_samples_old = recSamples;
2961 _wrapCounter++; 2961 _wrapCounter++;
2962 return (int)((recSamples + POW2(32) - readSamples)/nSamplesPerMs); 2962 return (int)((recSamples + POW2(32) - readSamples)/nSamplesPerMs);
2963 2963
2964 2964
2965 } else if((recSamples < 96000) && (readSamples > POW2(31))) { 2965 } else if((recSamples < 96000) && (readSamples > (unsigned long)POW2(31))) {
2966 WEBRTC_TRACE (kTraceDebug, kTraceUtility, -1,"WRAP 3 (readSamples %d rec Samples %d)",readSamples, recSamples); 2966 WEBRTC_TRACE (kTraceDebug, kTraceUtility, -1,"WRAP 3 (readSamples %d rec Samples %d)",readSamples, recSamples);
2967 // Wrap around has, as expected, happened for rec_sampels before 2967 // Wrap around has, as expected, happened for rec_sampels before
2968 // readSampels so we have to adjust for this until also readSampels 2968 // readSampels so we have to adjust for this until also readSampels
2969 // has had wrap around. 2969 // has had wrap around.
2970 _read_samples_old = readSamples; 2970 _read_samples_old = readSamples;
2971 _rec_samples_old = recSamples; 2971 _rec_samples_old = recSamples;
2972 _wrapCounter++; 2972 _wrapCounter++;
2973 return (int)((recSamples + POW2(32) - readSamples)/nSamplesPerMs); 2973 return (int)((recSamples + POW2(32) - readSamples)/nSamplesPerMs);
2974 } 2974 }
2975 2975
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
3723 bool AudioDeviceWindowsWave::KeyPressed() const{ 3723 bool AudioDeviceWindowsWave::KeyPressed() const{
3724 3724
3725 int key_down = 0; 3725 int key_down = 0;
3726 for (int key = VK_SPACE; key < VK_NUMLOCK; key++) { 3726 for (int key = VK_SPACE; key < VK_NUMLOCK; key++) {
3727 short res = GetAsyncKeyState(key); 3727 short res = GetAsyncKeyState(key);
3728 key_down |= res & 0x1; // Get the LSB 3728 key_down |= res & 0x1; // Get the LSB
3729 } 3729 }
3730 return (key_down > 0); 3730 return (key_down > 0);
3731 } 3731 }
3732 } // namespace webrtc 3732 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698