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

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

Issue 1172163004: Reformat existing code. There should be no functional effects. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 6 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 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 // remote side unless a packet containing a sample of that magnitude has been 616 // remote side unless a packet containing a sample of that magnitude has been
617 // sent to it. Note that the audio processing pipeline will likely distort the 617 // sent to it. Note that the audio processing pipeline will likely distort the
618 // original signal. 618 // original signal.
619 SetSendBuffer(kHighSampleValue); 619 SetSendBuffer(kHighSampleValue);
620 last_process_time_ms_ = rtc::Time(); 620 last_process_time_ms_ = rtc::Time();
621 return true; 621 return true;
622 } 622 }
623 623
624 void FakeAudioCaptureModule::SetSendBuffer(int value) { 624 void FakeAudioCaptureModule::SetSendBuffer(int value) {
625 Sample* buffer_ptr = reinterpret_cast<Sample*>(send_buffer_); 625 Sample* buffer_ptr = reinterpret_cast<Sample*>(send_buffer_);
626 const int buffer_size_in_samples = sizeof(send_buffer_) / 626 const int buffer_size_in_samples =
627 kNumberBytesPerSample; 627 sizeof(send_buffer_) / kNumberBytesPerSample;
628 for (int i = 0; i < buffer_size_in_samples; ++i) { 628 for (int i = 0; i < buffer_size_in_samples; ++i) {
629 buffer_ptr[i] = value; 629 buffer_ptr[i] = value;
630 } 630 }
631 } 631 }
632 632
633 void FakeAudioCaptureModule::ResetRecBuffer() { 633 void FakeAudioCaptureModule::ResetRecBuffer() {
634 memset(rec_buffer_, 0, sizeof(rec_buffer_)); 634 memset(rec_buffer_, 0, sizeof(rec_buffer_));
635 } 635 }
636 636
637 bool FakeAudioCaptureModule::CheckRecBuffer(int value) { 637 bool FakeAudioCaptureModule::CheckRecBuffer(int value) {
638 const Sample* buffer_ptr = reinterpret_cast<const Sample*>(rec_buffer_); 638 const Sample* buffer_ptr = reinterpret_cast<const Sample*>(rec_buffer_);
639 const int buffer_size_in_samples = sizeof(rec_buffer_) / 639 const int buffer_size_in_samples =
640 kNumberBytesPerSample; 640 sizeof(rec_buffer_) / kNumberBytesPerSample;
641 for (int i = 0; i < buffer_size_in_samples; ++i) { 641 for (int i = 0; i < buffer_size_in_samples; ++i) {
642 if (buffer_ptr[i] >= value) return true; 642 if (buffer_ptr[i] >= value) return true;
643 } 643 }
644 return false; 644 return false;
645 } 645 }
646 646
647 bool FakeAudioCaptureModule::ShouldStartProcessing() { 647 bool FakeAudioCaptureModule::ShouldStartProcessing() {
648 return recording_ || playing_; 648 return recording_ || playing_;
649 } 649 }
650 650
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 ASSERT(false); 745 ASSERT(false);
746 } 746 }
747 SetMicrophoneVolume(current_mic_level); 747 SetMicrophoneVolume(current_mic_level);
748 } 748 }
749 749
750 void FakeAudioCaptureModule::StopProcessP() { 750 void FakeAudioCaptureModule::StopProcessP() {
751 ASSERT(rtc::Thread::Current() == process_thread_); 751 ASSERT(rtc::Thread::Current() == process_thread_);
752 started_ = false; 752 started_ = false;
753 process_thread_->Clear(this); 753 process_thread_->Clear(this);
754 } 754 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698