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

Side by Side Diff: webrtc/modules/audio_coding/neteq/tools/neteq_performance_test.cc

Issue 1949533002: WIP: Move the creation of AudioCodecFactory into PeerConnectionFactory. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 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) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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
11 #include "webrtc/modules/audio_coding/neteq/tools/neteq_performance_test.h" 11 #include "webrtc/modules/audio_coding/neteq/tools/neteq_performance_test.h"
12 12
13 #include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h"
13 #include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.h" 14 #include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.h"
14 #include "webrtc/modules/audio_coding/neteq/include/neteq.h" 15 #include "webrtc/modules/audio_coding/neteq/include/neteq.h"
15 #include "webrtc/modules/audio_coding/neteq/tools/audio_loop.h" 16 #include "webrtc/modules/audio_coding/neteq/tools/audio_loop.h"
16 #include "webrtc/modules/audio_coding/neteq/tools/rtp_generator.h" 17 #include "webrtc/modules/audio_coding/neteq/tools/rtp_generator.h"
17 #include "webrtc/modules/include/module_common_types.h" 18 #include "webrtc/modules/include/module_common_types.h"
18 #include "webrtc/system_wrappers/include/clock.h" 19 #include "webrtc/system_wrappers/include/clock.h"
19 #include "webrtc/test/testsupport/fileutils.h" 20 #include "webrtc/test/testsupport/fileutils.h"
20 #include "webrtc/typedefs.h" 21 #include "webrtc/typedefs.h"
21 22
22 using webrtc::NetEq; 23 using webrtc::NetEq;
(...skipping 11 matching lines...) Expand all
34 webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm"); 35 webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm");
35 const int kSampRateHz = 32000; 36 const int kSampRateHz = 32000;
36 const webrtc::NetEqDecoder kDecoderType = 37 const webrtc::NetEqDecoder kDecoderType =
37 webrtc::NetEqDecoder::kDecoderPCM16Bswb32kHz; 38 webrtc::NetEqDecoder::kDecoderPCM16Bswb32kHz;
38 const std::string kDecoderName = "pcm16-swb32"; 39 const std::string kDecoderName = "pcm16-swb32";
39 const int kPayloadType = 95; 40 const int kPayloadType = 95;
40 41
41 // Initialize NetEq instance. 42 // Initialize NetEq instance.
42 NetEq::Config config; 43 NetEq::Config config;
43 config.sample_rate_hz = kSampRateHz; 44 config.sample_rate_hz = kSampRateHz;
44 NetEq* neteq = NetEq::Create(config); 45 NetEq* neteq = NetEq::Create(config, CreateBuiltinAudioDecoderFactory());
45 // Register decoder in |neteq|. 46 // Register decoder in |neteq|.
46 if (neteq->RegisterPayloadType(kDecoderType, kDecoderName, kPayloadType) != 0) 47 if (neteq->RegisterPayloadType(kDecoderType, kDecoderName, kPayloadType) != 0)
47 return -1; 48 return -1;
48 49
49 // Set up AudioLoop object. 50 // Set up AudioLoop object.
50 AudioLoop audio_loop; 51 AudioLoop audio_loop;
51 const size_t kMaxLoopLengthSamples = kSampRateHz * 10; // 10 second loop. 52 const size_t kMaxLoopLengthSamples = kSampRateHz * 10; // 10 second loop.
52 const size_t kInputBlockSizeSamples = 60 * kSampRateHz / 1000; // 60 ms. 53 const size_t kInputBlockSizeSamples = 60 * kSampRateHz / 1000; // 60 ms.
53 if (!audio_loop.Init(kInputFileName, kMaxLoopLengthSamples, 54 if (!audio_loop.Init(kInputFileName, kMaxLoopLengthSamples,
54 kInputBlockSizeSamples)) 55 kInputBlockSizeSamples))
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 drift_flipped = true; 121 drift_flipped = true;
121 } 122 }
122 } 123 }
123 int64_t end_time_ms = clock->TimeInMilliseconds(); 124 int64_t end_time_ms = clock->TimeInMilliseconds();
124 delete neteq; 125 delete neteq;
125 return end_time_ms - start_time_ms; 126 return end_time_ms - start_time_ms;
126 } 127 }
127 128
128 } // namespace test 129 } // namespace test
129 } // namespace webrtc 130 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698