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_sender/audio_sender.h" | 5 #include "media/cast/audio_sender/audio_sender.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 "media/cast/audio_sender/audio_encoder.h" | 10 #include "media/cast/audio_sender/audio_encoder.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 } | 88 } |
89 | 89 |
90 void AudioSender::InsertAudio(scoped_ptr<AudioBus> audio_bus, | 90 void AudioSender::InsertAudio(scoped_ptr<AudioBus> audio_bus, |
91 const base::TimeTicks& recorded_time) { | 91 const base::TimeTicks& recorded_time) { |
92 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 92 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
93 DCHECK(audio_encoder_.get()) << "Invalid internal state"; | 93 DCHECK(audio_encoder_.get()) << "Invalid internal state"; |
94 audio_encoder_->InsertAudio(audio_bus.Pass(), recorded_time); | 94 audio_encoder_->InsertAudio(audio_bus.Pass(), recorded_time); |
95 } | 95 } |
96 | 96 |
97 void AudioSender::SendEncodedAudioFrame( | 97 void AudioSender::SendEncodedAudioFrame( |
98 scoped_ptr<transport::EncodedAudioFrame> audio_frame, | 98 scoped_ptr<transport::EncodedFrame> audio_frame) { |
99 const base::TimeTicks& recorded_time) { | |
100 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 99 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
101 rtp_timestamp_helper_.StoreLatestTime(recorded_time, | 100 DCHECK(!audio_frame->reference_time.is_null()); |
| 101 rtp_timestamp_helper_.StoreLatestTime(audio_frame->reference_time, |
102 audio_frame->rtp_timestamp); | 102 audio_frame->rtp_timestamp); |
103 InitializeTimers(); | 103 InitializeTimers(); |
104 transport_sender_->InsertCodedAudioFrame(audio_frame.get(), recorded_time); | 104 transport_sender_->InsertCodedAudioFrame(*audio_frame); |
105 } | 105 } |
106 | 106 |
107 void AudioSender::ResendPackets( | 107 void AudioSender::ResendPackets( |
108 const MissingFramesAndPacketsMap& missing_frames_and_packets) { | 108 const MissingFramesAndPacketsMap& missing_frames_and_packets) { |
109 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 109 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
110 transport_sender_->ResendPackets(true, missing_frames_and_packets); | 110 transport_sender_->ResendPackets(true, missing_frames_and_packets); |
111 } | 111 } |
112 | 112 |
113 void AudioSender::IncomingRtcpPacket(scoped_ptr<Packet> packet) { | 113 void AudioSender::IncomingRtcpPacket(scoped_ptr<Packet> packet) { |
114 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 114 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
(...skipping 21 matching lines...) Expand all Loading... |
136 uint32 now_as_rtp_timestamp = 0; | 136 uint32 now_as_rtp_timestamp = 0; |
137 if (rtp_timestamp_helper_.GetCurrentTimeAsRtpTimestamp( | 137 if (rtp_timestamp_helper_.GetCurrentTimeAsRtpTimestamp( |
138 now, &now_as_rtp_timestamp)) { | 138 now, &now_as_rtp_timestamp)) { |
139 rtcp_.SendRtcpFromRtpSender(now, now_as_rtp_timestamp); | 139 rtcp_.SendRtcpFromRtpSender(now, now_as_rtp_timestamp); |
140 } | 140 } |
141 ScheduleNextRtcpReport(); | 141 ScheduleNextRtcpReport(); |
142 } | 142 } |
143 | 143 |
144 } // namespace cast | 144 } // namespace cast |
145 } // namespace media | 145 } // namespace media |
OLD | NEW |