| 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 "media/cast/audio_receiver/audio_receiver.h" | 5 #include "media/cast/audio_receiver/audio_receiver.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 } | 191 } |
| 192 | 192 |
| 193 DCHECK(audio_buffer_) << "Invalid internal state"; | 193 DCHECK(audio_buffer_) << "Invalid internal state"; |
| 194 DCHECK(!audio_decoder_) << "Invalid internal state"; | 194 DCHECK(!audio_decoder_) << "Invalid internal state"; |
| 195 | 195 |
| 196 bool duplicate = false; | 196 bool duplicate = false; |
| 197 bool complete = audio_buffer_->InsertPacket(payload_data, payload_size, | 197 bool complete = audio_buffer_->InsertPacket(payload_data, payload_size, |
| 198 rtp_header, &duplicate); | 198 rtp_header, &duplicate); |
| 199 if (duplicate) { | 199 if (duplicate) { |
| 200 cast_environment_->Logging()->InsertPacketEvent( | 200 cast_environment_->Logging()->InsertPacketEvent( |
| 201 now, kDuplicatePacketReceived, rtp_header.webrtc.header.timestamp, | 201 now, kDuplicateAudioPacketReceived, rtp_header.webrtc.header.timestamp, |
| 202 rtp_header.frame_id, rtp_header.packet_id, rtp_header.max_packet_id, | 202 rtp_header.frame_id, rtp_header.packet_id, rtp_header.max_packet_id, |
| 203 payload_size); | 203 payload_size); |
| 204 // Duplicate packets are ignored. | 204 // Duplicate packets are ignored. |
| 205 return; | 205 return; |
| 206 } | 206 } |
| 207 if (!complete) return; // Audio frame not complete; wait for more packets. | 207 if (!complete) return; // Audio frame not complete; wait for more packets. |
| 208 if (queued_encoded_callbacks_.empty()) return; | 208 if (queued_encoded_callbacks_.empty()) return; |
| 209 AudioFrameEncodedCallback callback = queued_encoded_callbacks_.front(); | 209 AudioFrameEncodedCallback callback = queued_encoded_callbacks_.front(); |
| 210 queued_encoded_callbacks_.pop_front(); | 210 queued_encoded_callbacks_.pop_front(); |
| 211 cast_environment_->PostTask(CastEnvironment::MAIN, FROM_HERE, | 211 cast_environment_->PostTask(CastEnvironment::MAIN, FROM_HERE, |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 } | 498 } |
| 499 if (audio_decoder_) { | 499 if (audio_decoder_) { |
| 500 // Will only send a message if it is time. | 500 // Will only send a message if it is time. |
| 501 audio_decoder_->SendCastMessage(); | 501 audio_decoder_->SendCastMessage(); |
| 502 } | 502 } |
| 503 ScheduleNextCastMessage(); | 503 ScheduleNextCastMessage(); |
| 504 } | 504 } |
| 505 | 505 |
| 506 } // namespace cast | 506 } // namespace cast |
| 507 } // namespace media | 507 } // namespace media |
| OLD | NEW |