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

Side by Side Diff: webrtc/modules/utility/source/coder.cc

Issue 2056653002: Fix trivial lint errors in FileRecorder and FilePlayer (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@remove5
Patch Set: Fix trivial lint errors Created 4 years, 4 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
« no previous file with comments | « webrtc/modules/utility/source/coder.h ('k') | webrtc/modules/utility/source/file_player.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 int32_t AudioCoder::SetDecodeCodec(const CodecInst& codec_inst) { 47 int32_t AudioCoder::SetDecodeCodec(const CodecInst& codec_inst) {
48 if (acm_->RegisterReceiveCodec(codec_inst, [&] { 48 if (acm_->RegisterReceiveCodec(codec_inst, [&] {
49 return rent_a_codec_.RentIsacDecoder(codec_inst.plfreq); 49 return rent_a_codec_.RentIsacDecoder(codec_inst.plfreq);
50 }) == -1) { 50 }) == -1) {
51 return -1; 51 return -1;
52 } 52 }
53 memcpy(&receive_codec_, &codec_inst, sizeof(CodecInst)); 53 memcpy(&receive_codec_, &codec_inst, sizeof(CodecInst));
54 return 0; 54 return 0;
55 } 55 }
56 56
57 int32_t AudioCoder::Decode(AudioFrame& decoded_audio, 57 int32_t AudioCoder::Decode(AudioFrame* decoded_audio,
58 uint32_t samp_freq_hz, 58 uint32_t samp_freq_hz,
59 const int8_t* incoming_payload, 59 const int8_t* incoming_payload,
60 size_t payload_length) { 60 size_t payload_length) {
61 if (payload_length > 0) { 61 if (payload_length > 0) {
62 const uint8_t payload_type = receive_codec_.pltype; 62 const uint8_t payload_type = receive_codec_.pltype;
63 decode_timestamp_ += receive_codec_.pacsize; 63 decode_timestamp_ += receive_codec_.pacsize;
64 if (acm_->IncomingPayload((const uint8_t*)incoming_payload, payload_length, 64 if (acm_->IncomingPayload((const uint8_t*)incoming_payload, payload_length,
65 payload_type, decode_timestamp_) == -1) { 65 payload_type, decode_timestamp_) == -1) {
66 return -1; 66 return -1;
67 } 67 }
68 } 68 }
69 bool muted; 69 bool muted;
70 int32_t ret = 70 int32_t ret =
71 acm_->PlayoutData10Ms((uint16_t)samp_freq_hz, &decoded_audio, &muted); 71 acm_->PlayoutData10Ms((uint16_t)samp_freq_hz, decoded_audio, &muted);
72 RTC_DCHECK(!muted); 72 RTC_DCHECK(!muted);
73 return ret; 73 return ret;
74 } 74 }
75 75
76 int32_t AudioCoder::PlayoutData(AudioFrame& decoded_audio, 76 int32_t AudioCoder::PlayoutData(AudioFrame* decoded_audio,
77 uint16_t& samp_freq_hz) { 77 uint16_t samp_freq_hz) {
78 bool muted; 78 bool muted;
79 int32_t ret = acm_->PlayoutData10Ms(samp_freq_hz, &decoded_audio, &muted); 79 int32_t ret = acm_->PlayoutData10Ms(samp_freq_hz, decoded_audio, &muted);
80 RTC_DCHECK(!muted); 80 RTC_DCHECK(!muted);
81 return ret; 81 return ret;
82 } 82 }
83 83
84 int32_t AudioCoder::Encode(const AudioFrame& audio, 84 int32_t AudioCoder::Encode(const AudioFrame& audio,
85 int8_t* encoded_data, 85 int8_t* encoded_data,
86 size_t& encoded_length_in_bytes) { 86 size_t* encoded_length_in_bytes) {
87 // Fake a timestamp in case audio doesn't contain a correct timestamp. 87 // Fake a timestamp in case audio doesn't contain a correct timestamp.
88 // Make a local copy of the audio frame since audio is const 88 // Make a local copy of the audio frame since audio is const
89 AudioFrame audio_frame; 89 AudioFrame audio_frame;
90 audio_frame.CopyFrom(audio); 90 audio_frame.CopyFrom(audio);
91 audio_frame.timestamp_ = encode_timestamp_; 91 audio_frame.timestamp_ = encode_timestamp_;
92 encode_timestamp_ += static_cast<uint32_t>(audio_frame.samples_per_channel_); 92 encode_timestamp_ += static_cast<uint32_t>(audio_frame.samples_per_channel_);
93 93
94 // For any codec with a frame size that is longer than 10 ms the encoded 94 // For any codec with a frame size that is longer than 10 ms the encoded
95 // length in bytes should be zero until a a full frame has been encoded. 95 // length in bytes should be zero until a a full frame has been encoded.
96 encoded_length_in_bytes_ = 0; 96 encoded_length_in_bytes_ = 0;
97 if (acm_->Add10MsData((AudioFrame&)audio_frame) == -1) { 97 if (acm_->Add10MsData((AudioFrame&)audio_frame) == -1) {
98 return -1; 98 return -1;
99 } 99 }
100 encoded_data_ = encoded_data; 100 encoded_data_ = encoded_data;
101 encoded_length_in_bytes = encoded_length_in_bytes_; 101 *encoded_length_in_bytes = encoded_length_in_bytes_;
102 return 0; 102 return 0;
103 } 103 }
104 104
105 int32_t AudioCoder::SendData(FrameType /* frame_type */, 105 int32_t AudioCoder::SendData(FrameType /* frame_type */,
106 uint8_t /* payload_type */, 106 uint8_t /* payload_type */,
107 uint32_t /* time_stamp */, 107 uint32_t /* time_stamp */,
108 const uint8_t* payload_data, 108 const uint8_t* payload_data,
109 size_t payload_size, 109 size_t payload_size,
110 const RTPFragmentationHeader* /* fragmentation*/) { 110 const RTPFragmentationHeader* /* fragmentation*/) {
111 memcpy(encoded_data_, payload_data, sizeof(uint8_t) * payload_size); 111 memcpy(encoded_data_, payload_data, sizeof(uint8_t) * payload_size);
112 encoded_length_in_bytes_ = payload_size; 112 encoded_length_in_bytes_ = payload_size;
113 return 0; 113 return 0;
114 } 114 }
115 115
116 } // namespace webrtc 116 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/utility/source/coder.h ('k') | webrtc/modules/utility/source/file_player.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698