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

Side by Side Diff: webrtc/modules/audio_coding/neteq/decision_logic_fax.cc

Issue 2411183003: Removed RTPHeader from NetEq's Packet struct. (Closed)
Patch Set: Created 4 years, 2 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) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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/decision_logic_fax.h" 11 #include "webrtc/modules/audio_coding/neteq/decision_logic_fax.h"
12 12
13 #include <assert.h> 13 #include <assert.h>
14 14
15 #include <algorithm> 15 #include <algorithm>
16 16
17 #include "webrtc/modules/audio_coding/neteq/decoder_database.h" 17 #include "webrtc/modules/audio_coding/neteq/decoder_database.h"
18 #include "webrtc/modules/audio_coding/neteq/sync_buffer.h" 18 #include "webrtc/modules/audio_coding/neteq/sync_buffer.h"
19 19
20 namespace webrtc { 20 namespace webrtc {
21 21
22 Operations DecisionLogicFax::GetDecisionSpecialized( 22 Operations DecisionLogicFax::GetDecisionSpecialized(
23 const SyncBuffer& sync_buffer, 23 const SyncBuffer& sync_buffer,
24 const Expand& expand, 24 const Expand& expand,
25 size_t decoder_frame_length, 25 size_t decoder_frame_length,
26 const RTPHeader* packet_header, 26 const Packet* next_packet,
27 Modes prev_mode, 27 Modes prev_mode,
28 bool play_dtmf, 28 bool play_dtmf,
29 bool* reset_decoder, 29 bool* reset_decoder,
30 size_t generated_noise_samples) { 30 size_t generated_noise_samples) {
31 assert(playout_mode_ == kPlayoutFax || playout_mode_ == kPlayoutOff); 31 assert(playout_mode_ == kPlayoutFax || playout_mode_ == kPlayoutOff);
32 uint32_t target_timestamp = sync_buffer.end_timestamp(); 32 uint32_t target_timestamp = sync_buffer.end_timestamp();
33 uint32_t available_timestamp = 0; 33 uint32_t available_timestamp = 0;
34 int is_cng_packet = 0; 34 int is_cng_packet = 0;
35 if (packet_header) { 35 if (next_packet) {
36 available_timestamp = packet_header->timestamp; 36 available_timestamp = next_packet->timestamp;
37 is_cng_packet = 37 is_cng_packet = decoder_database_->IsComfortNoise(next_packet->payloadType);
38 decoder_database_->IsComfortNoise(packet_header->payloadType);
39 } 38 }
40 if (is_cng_packet) { 39 if (is_cng_packet) {
41 if (static_cast<int32_t>((generated_noise_samples + target_timestamp) 40 if (static_cast<int32_t>((generated_noise_samples + target_timestamp)
42 - available_timestamp) >= 0) { 41 - available_timestamp) >= 0) {
43 // Time to play this packet now. 42 // Time to play this packet now.
44 return kRfc3389Cng; 43 return kRfc3389Cng;
45 } else { 44 } else {
46 // Wait before playing this packet. 45 // Wait before playing this packet.
47 return kRfc3389CngNoPacket; 46 return kRfc3389CngNoPacket;
48 } 47 }
49 } 48 }
50 if (!packet_header) { 49 if (!next_packet) {
51 // No packet. If in CNG mode, play as usual. Otherwise, use other method to 50 // No packet. If in CNG mode, play as usual. Otherwise, use other method to
52 // generate data. 51 // generate data.
53 if (cng_state_ == kCngRfc3389On) { 52 if (cng_state_ == kCngRfc3389On) {
54 // Continue playing comfort noise. 53 // Continue playing comfort noise.
55 return kRfc3389CngNoPacket; 54 return kRfc3389CngNoPacket;
56 } else if (cng_state_ == kCngInternalOn) { 55 } else if (cng_state_ == kCngInternalOn) {
57 // Continue playing codec-internal comfort noise. 56 // Continue playing codec-internal comfort noise.
58 return kCodecInternalCng; 57 return kCodecInternalCng;
59 } else { 58 } else {
60 // Nothing to play. Generate some data to play out. 59 // Nothing to play. Generate some data to play out.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 assert(0); 93 assert(0);
95 return kUndefined; 94 return kUndefined;
96 } 95 }
97 } 96 }
98 } 97 }
99 } 98 }
100 } 99 }
101 100
102 101
103 } // namespace webrtc 102 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698