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

Side by Side Diff: content/browser/renderer_host/media/audio_input_sync_writer_unittest.cc

Issue 2670873002: Remove base's ALIGNOF/ALIGNAS in favor of alignof/alignas. (Closed)
Patch Set: Tests Created 3 years, 10 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/media/audio_input_sync_writer.h" 5 #include "content/browser/renderer_host/media/audio_input_sync_writer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 25 matching lines...) Expand all
36 // Audio buffer parameters. 36 // Audio buffer parameters.
37 const int channels = 1; 37 const int channels = 1;
38 const int sampling_frequency_hz = 16000; 38 const int sampling_frequency_hz = 16000;
39 const int frames = sampling_frequency_hz / 100; // 10 ms 39 const int frames = sampling_frequency_hz / 100; // 10 ms
40 const int bits_per_sample = 16; 40 const int bits_per_sample = 16;
41 41
42 // Faked ring buffer. Must be aligned. 42 // Faked ring buffer. Must be aligned.
43 #define DATA_ALIGNMENT 16 43 #define DATA_ALIGNMENT 16
44 static_assert(AudioBus::kChannelAlignment == DATA_ALIGNMENT, 44 static_assert(AudioBus::kChannelAlignment == DATA_ALIGNMENT,
45 "Data alignment not same as AudioBus"); 45 "Data alignment not same as AudioBus");
46 ALIGNAS(DATA_ALIGNMENT) 46 alignas(DATA_ALIGNMENT)
47 uint8_t data[kSegments * (sizeof(media::AudioInputBufferParameters) + 47 uint8_t data[kSegments * (sizeof(media::AudioInputBufferParameters) +
48 frames * channels * sizeof(float))]; 48 frames * channels * sizeof(float))];
49 49
50 } // namespace 50 } // namespace
51 51
52 // Mocked out sockets used for Send/ReceiveWithTimeout. Counts the number of 52 // Mocked out sockets used for Send/ReceiveWithTimeout. Counts the number of
53 // outstanding reads, i.e. the diff between send and receive calls. 53 // outstanding reads, i.e. the diff between send and receive calls.
54 class MockCancelableSyncSocket : public base::CancelableSyncSocket { 54 class MockCancelableSyncSocket : public base::CancelableSyncSocket {
55 public: 55 public:
56 MockCancelableSyncSocket(int buffer_size) 56 MockCancelableSyncSocket(int buffer_size)
57 : in_failure_mode_(false), 57 : in_failure_mode_(false),
58 writes_(0), 58 writes_(0),
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 EXPECT_TRUE(TestSocketAndFifoExpectations(kSegments, 0, 2)); 359 EXPECT_TRUE(TestSocketAndFifoExpectations(kSegments, 0, 2));
360 360
361 // Empty both. Should render a log call for emptying the fifo. 361 // Empty both. Should render a log call for emptying the fifo.
362 socket_->Read(kSegments); 362 socket_->Read(kSegments);
363 writer_->Write(audio_bus_.get(), 0, false, 0); 363 writer_->Write(audio_bus_.get(), 0, false, 0);
364 socket_->Read(3); 364 socket_->Read(3);
365 EXPECT_TRUE(TestSocketAndFifoExpectations(0, 3 * sizeof(uint32_t), 0)); 365 EXPECT_TRUE(TestSocketAndFifoExpectations(0, 3 * sizeof(uint32_t), 0));
366 } 366 }
367 367
368 } // namespace content 368 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698