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

Side by Side Diff: talk/app/webrtc/test/fakeaudiocapturemodule.cc

Issue 1362503003: Use suffixed {uint,int}{8,16,32,64}_t types. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase + revert basictypes.h (to be landed separately just in case of a revert due to unexpected us… Created 5 years, 2 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 * libjingle 2 * libjingle
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 22 matching lines...) Expand all
33 #include "webrtc/base/timeutils.h" 33 #include "webrtc/base/timeutils.h"
34 34
35 // Audio sample value that is high enough that it doesn't occur naturally when 35 // Audio sample value that is high enough that it doesn't occur naturally when
36 // frames are being faked. E.g. NetEq will not generate this large sample value 36 // frames are being faked. E.g. NetEq will not generate this large sample value
37 // unless it has received an audio frame containing a sample of this value. 37 // unless it has received an audio frame containing a sample of this value.
38 // Even simpler buffers would likely just contain audio sample values of 0. 38 // Even simpler buffers would likely just contain audio sample values of 0.
39 static const int kHighSampleValue = 10000; 39 static const int kHighSampleValue = 10000;
40 40
41 // Same value as src/modules/audio_device/main/source/audio_device_config.h in 41 // Same value as src/modules/audio_device/main/source/audio_device_config.h in
42 // https://code.google.com/p/webrtc/ 42 // https://code.google.com/p/webrtc/
43 static const uint32 kAdmMaxIdleTimeProcess = 1000; 43 static const uint32_t kAdmMaxIdleTimeProcess = 1000;
44 44
45 // Constants here are derived by running VoE using a real ADM. 45 // Constants here are derived by running VoE using a real ADM.
46 // The constants correspond to 10ms of mono audio at 44kHz. 46 // The constants correspond to 10ms of mono audio at 44kHz.
47 static const int kTimePerFrameMs = 10; 47 static const int kTimePerFrameMs = 10;
48 static const uint8_t kNumberOfChannels = 1; 48 static const uint8_t kNumberOfChannels = 1;
49 static const int kSamplesPerSecond = 44000; 49 static const int kSamplesPerSecond = 44000;
50 static const int kTotalDelayMs = 0; 50 static const int kTotalDelayMs = 0;
51 static const int kClockDriftMs = 0; 51 static const int kClockDriftMs = 0;
52 static const uint32_t kMaxVolume = 14392; 52 static const uint32_t kMaxVolume = 14392;
53 53
(...skipping 29 matching lines...) Expand all
83 } 83 }
84 return capture_module; 84 return capture_module;
85 } 85 }
86 86
87 int FakeAudioCaptureModule::frames_received() const { 87 int FakeAudioCaptureModule::frames_received() const {
88 rtc::CritScope cs(&crit_); 88 rtc::CritScope cs(&crit_);
89 return frames_received_; 89 return frames_received_;
90 } 90 }
91 91
92 int64_t FakeAudioCaptureModule::TimeUntilNextProcess() { 92 int64_t FakeAudioCaptureModule::TimeUntilNextProcess() {
93 const uint32 current_time = rtc::Time(); 93 const uint32_t current_time = rtc::Time();
94 if (current_time < last_process_time_ms_) { 94 if (current_time < last_process_time_ms_) {
95 // TODO: wraparound could be handled more gracefully. 95 // TODO: wraparound could be handled more gracefully.
96 return 0; 96 return 0;
97 } 97 }
98 const uint32 elapsed_time = current_time - last_process_time_ms_; 98 const uint32_t elapsed_time = current_time - last_process_time_ms_;
99 if (kAdmMaxIdleTimeProcess < elapsed_time) { 99 if (kAdmMaxIdleTimeProcess < elapsed_time) {
100 return 0; 100 return 0;
101 } 101 }
102 return kAdmMaxIdleTimeProcess - elapsed_time; 102 return kAdmMaxIdleTimeProcess - elapsed_time;
103 } 103 }
104 104
105 int32_t FakeAudioCaptureModule::Process() { 105 int32_t FakeAudioCaptureModule::Process() {
106 last_process_time_ms_ = rtc::Time(); 106 last_process_time_ms_ = rtc::Time();
107 return 0; 107 return 0;
108 } 108 }
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 // Receive and send frames every kTimePerFrameMs. 677 // Receive and send frames every kTimePerFrameMs.
678 if (playing_) { 678 if (playing_) {
679 ReceiveFrameP(); 679 ReceiveFrameP();
680 } 680 }
681 if (recording_) { 681 if (recording_) {
682 SendFrameP(); 682 SendFrameP();
683 } 683 }
684 } 684 }
685 685
686 next_frame_time_ += kTimePerFrameMs; 686 next_frame_time_ += kTimePerFrameMs;
687 const uint32 current_time = rtc::Time(); 687 const uint32_t current_time = rtc::Time();
688 const uint32 wait_time = (next_frame_time_ > current_time) ? 688 const uint32_t wait_time =
689 next_frame_time_ - current_time : 0; 689 (next_frame_time_ > current_time) ? next_frame_time_ - current_time : 0;
690 process_thread_->PostDelayed(wait_time, this, MSG_RUN_PROCESS); 690 process_thread_->PostDelayed(wait_time, this, MSG_RUN_PROCESS);
691 } 691 }
692 692
693 void FakeAudioCaptureModule::ReceiveFrameP() { 693 void FakeAudioCaptureModule::ReceiveFrameP() {
694 ASSERT(process_thread_->IsCurrent()); 694 ASSERT(process_thread_->IsCurrent());
695 { 695 {
696 rtc::CritScope cs(&crit_callback_); 696 rtc::CritScope cs(&crit_callback_);
697 if (!audio_callback_) { 697 if (!audio_callback_) {
698 return; 698 return;
699 } 699 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 kNumberOfChannels, 735 kNumberOfChannels,
736 kSamplesPerSecond, kTotalDelayMs, 736 kSamplesPerSecond, kTotalDelayMs,
737 kClockDriftMs, current_mic_level, 737 kClockDriftMs, current_mic_level,
738 key_pressed, 738 key_pressed,
739 current_mic_level) != 0) { 739 current_mic_level) != 0) {
740 ASSERT(false); 740 ASSERT(false);
741 } 741 }
742 SetMicrophoneVolume(current_mic_level); 742 SetMicrophoneVolume(current_mic_level);
743 } 743 }
744 744
OLDNEW
« no previous file with comments | « talk/app/webrtc/test/fakeaudiocapturemodule.h ('k') | talk/app/webrtc/test/fakedatachannelprovider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698