OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 } | 45 } |
46 switch (info->codec_type) { | 46 switch (info->codec_type) { |
47 case NetEqDecoder::kDecoderG722: | 47 case NetEqDecoder::kDecoderG722: |
48 case NetEqDecoder::kDecoderG722_2ch: { | 48 case NetEqDecoder::kDecoderG722_2ch: { |
49 // Use timestamp scaling with factor 2 (two output samples per RTP | 49 // Use timestamp scaling with factor 2 (two output samples per RTP |
50 // timestamp). | 50 // timestamp). |
51 numerator_ = 2; | 51 numerator_ = 2; |
52 denominator_ = 1; | 52 denominator_ = 1; |
53 break; | 53 break; |
54 } | 54 } |
55 case NetEqDecoder::kDecoderCNGswb48kHz: { | |
56 // Use timestamp scaling with factor 2/3 (32 kHz sample rate, but RTP | |
57 // timestamps run on 48 kHz). | |
58 // TODO(tlegrand): Remove scaling for kDecoderCNGswb48kHz once ACM has | |
59 // full 48 kHz support. | |
60 numerator_ = 2; | |
61 denominator_ = 3; | |
62 break; | |
63 } | |
64 case NetEqDecoder::kDecoderAVT: | 55 case NetEqDecoder::kDecoderAVT: |
65 case NetEqDecoder::kDecoderCNGnb: | 56 case NetEqDecoder::kDecoderCNGnb: |
66 case NetEqDecoder::kDecoderCNGwb: | 57 case NetEqDecoder::kDecoderCNGwb: |
67 case NetEqDecoder::kDecoderCNGswb32kHz: { | 58 case NetEqDecoder::kDecoderCNGswb32kHz: |
| 59 case NetEqDecoder::kDecoderCNGswb48kHz: { |
68 // Do not change the timestamp scaling settings for DTMF or CNG. | 60 // Do not change the timestamp scaling settings for DTMF or CNG. |
69 break; | 61 break; |
70 } | 62 } |
71 default: { | 63 default: { |
72 // Do not use timestamp scaling for any other codec. | 64 // Do not use timestamp scaling for any other codec. |
73 numerator_ = 1; | 65 numerator_ = 1; |
74 denominator_ = 1; | 66 denominator_ = 1; |
75 break; | 67 break; |
76 } | 68 } |
77 } | 69 } |
(...skipping 24 matching lines...) Expand all Loading... |
102 } else { | 94 } else { |
103 int32_t internal_diff = internal_timestamp - internal_ref_; | 95 int32_t internal_diff = internal_timestamp - internal_ref_; |
104 assert(numerator_ > 0); // Should not be possible. | 96 assert(numerator_ > 0); // Should not be possible. |
105 // Do not update references in this method. | 97 // Do not update references in this method. |
106 // Switch |denominator_| and |numerator_| to convert the other way. | 98 // Switch |denominator_| and |numerator_| to convert the other way. |
107 return external_ref_ + (internal_diff * denominator_) / numerator_; | 99 return external_ref_ + (internal_diff * denominator_) / numerator_; |
108 } | 100 } |
109 } | 101 } |
110 | 102 |
111 } // namespace webrtc | 103 } // namespace webrtc |
OLD | NEW |