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

Side by Side Diff: webrtc/modules/audio_coding/acm2/acm_receiver.cc

Issue 1863993002: Move setting of AudioFrame::timestamp_ into NetEq (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@neteq-empty-playout-ts
Patch Set: Created 4 years, 8 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
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 resampled_last_output_frame_ = false; 184 resampled_last_output_frame_ = false;
185 // We might end up here ONLY if codec is changed. 185 // We might end up here ONLY if codec is changed.
186 } 186 }
187 187
188 // Store current audio in |last_audio_buffer_| for next time. 188 // Store current audio in |last_audio_buffer_| for next time.
189 memcpy(last_audio_buffer_.get(), audio_frame->data_, 189 memcpy(last_audio_buffer_.get(), audio_frame->data_,
190 sizeof(int16_t) * audio_frame->samples_per_channel_ * 190 sizeof(int16_t) * audio_frame->samples_per_channel_ *
191 audio_frame->num_channels_); 191 audio_frame->num_channels_);
192 192
193 call_stats_.DecodedByNetEq(audio_frame->speech_type_); 193 call_stats_.DecodedByNetEq(audio_frame->speech_type_);
194
195 // Computes the RTP timestamp of the first sample in |audio_frame| from
196 // |GetPlayoutTimestamp|, which is the timestamp of the last sample of
197 // |audio_frame|.
198 // TODO(henrik.lundin) Move setting of audio_frame->timestamp_ inside NetEq.
199 rtc::Optional<uint32_t> playout_timestamp = GetPlayoutTimestamp();
200 if (playout_timestamp) {
201 audio_frame->timestamp_ =
202 *playout_timestamp -
203 static_cast<uint32_t>(audio_frame->samples_per_channel_);
204 } else {
205 // Remain 0 until we have a valid |playout_timestamp|.
206 audio_frame->timestamp_ = 0;
207 }
208
209 return 0; 194 return 0;
210 } 195 }
211 196
212 int32_t AcmReceiver::AddCodec(int acm_codec_id, 197 int32_t AcmReceiver::AddCodec(int acm_codec_id,
213 uint8_t payload_type, 198 uint8_t payload_type,
214 size_t channels, 199 size_t channels,
215 int sample_rate_hz, 200 int sample_rate_hz,
216 AudioDecoder* audio_decoder, 201 AudioDecoder* audio_decoder,
217 const std::string& name) { 202 const std::string& name) {
218 const auto neteq_decoder = [acm_codec_id, channels]() -> NetEqDecoder { 203 const auto neteq_decoder = [acm_codec_id, channels]() -> NetEqDecoder {
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 410
426 void AcmReceiver::GetDecodingCallStatistics( 411 void AcmReceiver::GetDecodingCallStatistics(
427 AudioDecodingCallStats* stats) const { 412 AudioDecodingCallStats* stats) const {
428 rtc::CritScope lock(&crit_sect_); 413 rtc::CritScope lock(&crit_sect_);
429 *stats = call_stats_.GetDecodingStatistics(); 414 *stats = call_stats_.GetDecodingStatistics();
430 } 415 }
431 416
432 } // namespace acm2 417 } // namespace acm2
433 418
434 } // namespace webrtc 419 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698