| 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/framer/framer.h" | 5 #include "media/cast/framer/framer.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 namespace media { | 9 namespace media { |
| 10 namespace cast { | 10 namespace cast { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 if (complete) { | 58 if (complete) { |
| 59 // ACK as soon as possible. | 59 // ACK as soon as possible. |
| 60 VLOG(1) << "Complete frame " << static_cast<int>(rtp_header.frame_id); | 60 VLOG(1) << "Complete frame " << static_cast<int>(rtp_header.frame_id); |
| 61 cast_msg_builder_->CompleteFrameReceived(rtp_header.frame_id, | 61 cast_msg_builder_->CompleteFrameReceived(rtp_header.frame_id, |
| 62 rtp_header.is_key_frame); | 62 rtp_header.is_key_frame); |
| 63 } | 63 } |
| 64 return complete; | 64 return complete; |
| 65 } | 65 } |
| 66 | 66 |
| 67 // This does not release the frame. | 67 // This does not release the frame. |
| 68 bool Framer::GetEncodedAudioFrame(transport::EncodedAudioFrame* audio_frame, | 68 bool Framer::GetEncodedAudioFrame(EncodedAudioFrame* audio_frame, |
| 69 uint32* rtp_timestamp, | 69 uint32* rtp_timestamp, |
| 70 bool* next_frame) { | 70 bool* next_frame) { |
| 71 uint32 frame_id; | 71 uint32 frame_id; |
| 72 // Find frame id. | 72 // Find frame id. |
| 73 if (frame_id_map_.NextContinuousFrame(&frame_id)) { | 73 if (frame_id_map_.NextContinuousFrame(&frame_id)) { |
| 74 // We have our next frame. | 74 // We have our next frame. |
| 75 *next_frame = true; | 75 *next_frame = true; |
| 76 } else { | 76 } else { |
| 77 if (!frame_id_map_.NextAudioFrameAllowingMissingFrames(&frame_id)) { | 77 if (!frame_id_map_.NextAudioFrameAllowingMissingFrames(&frame_id)) { |
| 78 return false; | 78 return false; |
| 79 } | 79 } |
| 80 *next_frame = false; | 80 *next_frame = false; |
| 81 } | 81 } |
| 82 | 82 |
| 83 ConstFrameIterator it = frames_.find(frame_id); | 83 ConstFrameIterator it = frames_.find(frame_id); |
| 84 DCHECK(it != frames_.end()); | 84 DCHECK(it != frames_.end()); |
| 85 if (it == frames_.end()) return false; | 85 if (it == frames_.end()) return false; |
| 86 | 86 |
| 87 return it->second->GetEncodedAudioFrame(audio_frame, rtp_timestamp); | 87 return it->second->GetEncodedAudioFrame(audio_frame, rtp_timestamp); |
| 88 } | 88 } |
| 89 | 89 |
| 90 // This does not release the frame. | 90 // This does not release the frame. |
| 91 bool Framer::GetEncodedVideoFrame(transport::EncodedVideoFrame* video_frame, | 91 bool Framer::GetEncodedVideoFrame(EncodedVideoFrame* video_frame, |
| 92 uint32* rtp_timestamp, | 92 uint32* rtp_timestamp, |
| 93 bool* next_frame) { | 93 bool* next_frame) { |
| 94 uint32 frame_id; | 94 uint32 frame_id; |
| 95 // Find frame id. | 95 // Find frame id. |
| 96 if (frame_id_map_.NextContinuousFrame(&frame_id)) { | 96 if (frame_id_map_.NextContinuousFrame(&frame_id)) { |
| 97 // We have our next frame. | 97 // We have our next frame. |
| 98 *next_frame = true; | 98 *next_frame = true; |
| 99 } else { | 99 } else { |
| 100 // Check if we can skip frames when our decoder is too slow. | 100 // Check if we can skip frames when our decoder is too slow. |
| 101 if (!decoder_faster_than_max_frame_rate_) return false; | 101 if (!decoder_faster_than_max_frame_rate_) return false; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 bool Framer::TimeToSendNextCastMessage(base::TimeTicks* time_to_send) { | 142 bool Framer::TimeToSendNextCastMessage(base::TimeTicks* time_to_send) { |
| 143 return cast_msg_builder_->TimeToSendNextCastMessage(time_to_send); | 143 return cast_msg_builder_->TimeToSendNextCastMessage(time_to_send); |
| 144 } | 144 } |
| 145 | 145 |
| 146 void Framer::SendCastMessage() { | 146 void Framer::SendCastMessage() { |
| 147 cast_msg_builder_->UpdateCastMessage(); | 147 cast_msg_builder_->UpdateCastMessage(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 } // namespace cast | 150 } // namespace cast |
| 151 } // namespace media | 151 } // namespace media |
| OLD | NEW |