OLD | NEW |
---|---|
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 #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_ |
12 #define WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_ | 12 #define WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_ |
13 | 13 |
14 #include <algorithm> | 14 #include <algorithm> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "webrtc/base/array_view.h" | 17 #include "webrtc/base/array_view.h" |
18 #include "webrtc/base/buffer.h" | 18 #include "webrtc/base/buffer.h" |
19 #include "webrtc/base/deprecation.h" | 19 #include "webrtc/base/deprecation.h" |
20 #include "webrtc/typedefs.h" | 20 #include "webrtc/typedefs.h" |
21 | 21 |
22 namespace webrtc { | 22 namespace webrtc { |
23 | 23 |
24 // This is the interface class for encoders in AudioCoding module. Each codec | 24 // This is the interface class for encoders in AudioCoding module. Each codec |
25 // type must have an implementation of this class. | 25 // type must have an implementation of this class. |
26 class AudioEncoder { | 26 class AudioEncoder { |
27 public: | 27 public: |
28 // Used for UMA logging of codec usage. The same codecs in the same | |
29 // order must be listed in | |
30 // src/tools/metrics/histograms/histograms.xml in chromium to log | |
31 // correct values. | |
kwiberg-webrtc
2016/05/12 23:30:21
Does that file list the actual number for each nam
aleloi
2016/05/13 09:02:27
Here is what the relevant section of the histogram
| |
32 enum class CodecType { | |
33 // kOther stands for no name, other or unknown codec | |
34 kOther = 0, | |
kwiberg-webrtc
2016/05/12 23:30:21
Maybe
kOther = 0, // Codec not specified, and/
aleloi
2016/05/13 09:02:27
That's a little more clear, I think. Changed.
| |
35 kOpus, | |
36 kIsac, | |
37 kPcmA, | |
38 kPcmU, | |
39 kG722, | |
40 kIlbc, | |
41 | |
42 // Number of histogram bins in the UMA logging of codec types. The | |
43 // total number of different codecs that are logged cannot exceed this | |
44 // number. | |
45 kMaxLoggedAudioCodecNames = 64 | |
kwiberg-webrtc
2016/05/12 23:30:21
Why is this explicitly 64, rather than just implic
aleloi
2016/05/13 09:02:27
I was inspired by the logging of video codecs, htt
Steven Holte
2016/05/13 21:20:58
This does seem unnecessary and wastes a tiny bit o
kwiberg-webrtc
2016/05/15 02:06:13
OK. Alex, would you check if we are allowed to cha
aleloi
2016/05/16 08:02:23
Done.
| |
46 }; | |
47 | |
28 struct EncodedInfoLeaf { | 48 struct EncodedInfoLeaf { |
29 size_t encoded_bytes = 0; | 49 size_t encoded_bytes = 0; |
30 uint32_t encoded_timestamp = 0; | 50 uint32_t encoded_timestamp = 0; |
31 int payload_type = 0; | 51 int payload_type = 0; |
32 bool send_even_if_empty = false; | 52 bool send_even_if_empty = false; |
33 bool speech = true; | 53 bool speech = true; |
54 CodecType encoder_type = CodecType::kOther; | |
34 }; | 55 }; |
35 | 56 |
36 // This is the main struct for auxiliary encoding information. Each encoded | 57 // This is the main struct for auxiliary encoding information. Each encoded |
37 // packet should be accompanied by one EncodedInfo struct, containing the | 58 // packet should be accompanied by one EncodedInfo struct, containing the |
38 // total number of |encoded_bytes|, the |encoded_timestamp| and the | 59 // total number of |encoded_bytes|, the |encoded_timestamp| and the |
39 // |payload_type|. If the packet contains redundant encodings, the |redundant| | 60 // |payload_type|. If the packet contains redundant encodings, the |redundant| |
40 // vector will be populated with EncodedInfoLeaf structs. Each struct in the | 61 // vector will be populated with EncodedInfoLeaf structs. Each struct in the |
41 // vector represents one encoding; the order of structs in the vector is the | 62 // vector represents one encoding; the order of structs in the vector is the |
42 // same as the order in which the actual payloads are written to the byte | 63 // same as the order in which the actual payloads are written to the byte |
43 // stream. When EncoderInfoLeaf structs are present in the vector, the main | 64 // stream. When EncoderInfoLeaf structs are present in the vector, the main |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
140 // This function is deprecated. It was used to return the maximum number of | 161 // This function is deprecated. It was used to return the maximum number of |
141 // bytes that can be produced by the encoder at each Encode() call. Since the | 162 // bytes that can be produced by the encoder at each Encode() call. Since the |
142 // Encode interface was changed to use rtc::Buffer, this is no longer | 163 // Encode interface was changed to use rtc::Buffer, this is no longer |
143 // applicable. It is only kept in to avoid breaking subclasses that still have | 164 // applicable. It is only kept in to avoid breaking subclasses that still have |
144 // it implemented (with the override attribute). It will be removed as soon | 165 // it implemented (with the override attribute). It will be removed as soon |
145 // as these subclasses have been given a chance to change. | 166 // as these subclasses have been given a chance to change. |
146 virtual size_t MaxEncodedBytes() const; | 167 virtual size_t MaxEncodedBytes() const; |
147 }; | 168 }; |
148 } // namespace webrtc | 169 } // namespace webrtc |
149 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_ | 170 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_ |
OLD | NEW |