OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/logging.h" | 5 #include "base/logging.h" |
6 #include "media/cast/audio_receiver/audio_decoder.h" | 6 #include "media/cast/audio_receiver/audio_decoder.h" |
7 | 7 |
8 #include "third_party/webrtc/modules/audio_coding/main/interface/audio_coding_mo dule.h" | 8 #include "third_party/webrtc/modules/audio_coding/main/interface/audio_coding_mo dule.h" |
9 #include "third_party/webrtc/modules/interface/module_common_types.h" | 9 #include "third_party/webrtc/modules/interface/module_common_types.h" |
10 | 10 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 audio_decoder_->SetMaximumPlayoutDelay(audio_config.rtp_max_delay_ms); | 45 audio_decoder_->SetMaximumPlayoutDelay(audio_config.rtp_max_delay_ms); |
46 audio_decoder_->SetPlayoutMode(webrtc::streaming); | 46 audio_decoder_->SetPlayoutMode(webrtc::streaming); |
47 } | 47 } |
48 | 48 |
49 AudioDecoder::~AudioDecoder() {} | 49 AudioDecoder::~AudioDecoder() {} |
50 | 50 |
51 bool AudioDecoder::GetRawAudioFrame(int number_of_10ms_blocks, | 51 bool AudioDecoder::GetRawAudioFrame(int number_of_10ms_blocks, |
52 int desired_frequency, | 52 int desired_frequency, |
53 PcmAudioFrame* audio_frame, | 53 PcmAudioFrame* audio_frame, |
54 uint32* rtp_timestamp) { | 54 uint32* rtp_timestamp) { |
55 if (!have_received_packets_) return false; | 55 if (!base::subtle::NoBarrier_Load(&have_received_packets_)) return false; |
Alpha Left Google
2013/11/15 19:40:39
We very rarely use atomicops. What is the reason t
pwestin
2013/11/15 19:48:06
I was looking for other options but did not find a
| |
56 | 56 |
57 audio_frame->samples.clear(); | 57 audio_frame->samples.clear(); |
58 | 58 |
59 for (int i = 0; i < number_of_10ms_blocks; ++i) { | 59 for (int i = 0; i < number_of_10ms_blocks; ++i) { |
60 webrtc::AudioFrame webrtc_audio_frame; | 60 webrtc::AudioFrame webrtc_audio_frame; |
61 if (0 != audio_decoder_->PlayoutData10Ms(desired_frequency, | 61 if (0 != audio_decoder_->PlayoutData10Ms(desired_frequency, |
62 &webrtc_audio_frame)) { | 62 &webrtc_audio_frame)) { |
63 return false; | 63 return false; |
64 } | 64 } |
65 if (webrtc_audio_frame.speech_type_ == webrtc::AudioFrame::kPLCCNG || | 65 if (webrtc_audio_frame.speech_type_ == webrtc::AudioFrame::kPLCCNG || |
(...skipping 19 matching lines...) Expand all Loading... | |
85 } | 85 } |
86 return true; | 86 return true; |
87 } | 87 } |
88 | 88 |
89 void AudioDecoder::IncomingParsedRtpPacket(const uint8* payload_data, | 89 void AudioDecoder::IncomingParsedRtpPacket(const uint8* payload_data, |
90 size_t payload_size, | 90 size_t payload_size, |
91 const RtpCastHeader& rtp_header) { | 91 const RtpCastHeader& rtp_header) { |
92 DCHECK_LE(payload_size, kIpPacketSize); | 92 DCHECK_LE(payload_size, kIpPacketSize); |
93 audio_decoder_->IncomingPacket(payload_data, static_cast<int32>(payload_size), | 93 audio_decoder_->IncomingPacket(payload_data, static_cast<int32>(payload_size), |
94 rtp_header.webrtc); | 94 rtp_header.webrtc); |
95 have_received_packets_ = true; | 95 base::subtle::NoBarrier_Store(&have_received_packets_, true); |
96 } | 96 } |
97 | 97 |
98 } // namespace cast | 98 } // namespace cast |
99 } // namespace media | 99 } // namespace media |
OLD | NEW |