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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 if (complete) { | 46 if (complete) { |
47 // ACK as soon as possible. | 47 // ACK as soon as possible. |
48 VLOG(1) << "Complete frame " << static_cast<int>(rtp_header.frame_id); | 48 VLOG(1) << "Complete frame " << static_cast<int>(rtp_header.frame_id); |
49 cast_msg_builder_->CompleteFrameReceived(rtp_header.frame_id, | 49 cast_msg_builder_->CompleteFrameReceived(rtp_header.frame_id, |
50 rtp_header.is_key_frame); | 50 rtp_header.is_key_frame); |
51 } | 51 } |
52 return complete; | 52 return complete; |
53 } | 53 } |
54 | 54 |
55 // This does not release the frame. | 55 // This does not release the frame. |
56 bool Framer::GetEncodedAudioFrame(EncodedAudioFrame* audio_frame, | 56 bool Framer::GetEncodedAudioFrame(transport::EncodedAudioFrame* audio_frame, |
57 uint32* rtp_timestamp, | 57 uint32* rtp_timestamp, |
58 bool* next_frame) { | 58 bool* next_frame) { |
59 uint32 frame_id; | 59 uint32 frame_id; |
60 // Find frame id. | 60 // Find frame id. |
61 if (frame_id_map_.NextContinuousFrame(&frame_id)) { | 61 if (frame_id_map_.NextContinuousFrame(&frame_id)) { |
62 // We have our next frame. | 62 // We have our next frame. |
63 *next_frame = true; | 63 *next_frame = true; |
64 } else { | 64 } else { |
65 if (!frame_id_map_.NextAudioFrameAllowingMissingFrames(&frame_id)) { | 65 if (!frame_id_map_.NextAudioFrameAllowingMissingFrames(&frame_id)) { |
66 return false; | 66 return false; |
67 } | 67 } |
68 *next_frame = false; | 68 *next_frame = false; |
69 } | 69 } |
70 | 70 |
71 ConstFrameIterator it = frames_.find(frame_id); | 71 ConstFrameIterator it = frames_.find(frame_id); |
72 DCHECK(it != frames_.end()); | 72 DCHECK(it != frames_.end()); |
73 if (it == frames_.end()) return false; | 73 if (it == frames_.end()) return false; |
74 | 74 |
75 return it->second->GetEncodedAudioFrame(audio_frame, rtp_timestamp); | 75 return it->second->GetEncodedAudioFrame(audio_frame, rtp_timestamp); |
76 } | 76 } |
77 | 77 |
78 // This does not release the frame. | 78 // This does not release the frame. |
79 bool Framer::GetEncodedVideoFrame(EncodedVideoFrame* video_frame, | 79 bool Framer::GetEncodedVideoFrame(transport::EncodedVideoFrame* video_frame, |
80 uint32* rtp_timestamp, | 80 uint32* rtp_timestamp, |
81 bool* next_frame) { | 81 bool* next_frame) { |
82 uint32 frame_id; | 82 uint32 frame_id; |
83 // Find frame id. | 83 // Find frame id. |
84 if (frame_id_map_.NextContinuousFrame(&frame_id)) { | 84 if (frame_id_map_.NextContinuousFrame(&frame_id)) { |
85 // We have our next frame. | 85 // We have our next frame. |
86 *next_frame = true; | 86 *next_frame = true; |
87 } else { | 87 } else { |
88 // Check if we can skip frames when our decoder is too slow. | 88 // Check if we can skip frames when our decoder is too slow. |
89 if (!decoder_faster_than_max_frame_rate_) return false; | 89 if (!decoder_faster_than_max_frame_rate_) return false; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 bool Framer::TimeToSendNextCastMessage(base::TimeTicks* time_to_send) { | 130 bool Framer::TimeToSendNextCastMessage(base::TimeTicks* time_to_send) { |
131 return cast_msg_builder_->TimeToSendNextCastMessage(time_to_send); | 131 return cast_msg_builder_->TimeToSendNextCastMessage(time_to_send); |
132 } | 132 } |
133 | 133 |
134 void Framer::SendCastMessage() { | 134 void Framer::SendCastMessage() { |
135 cast_msg_builder_->UpdateCastMessage(); | 135 cast_msg_builder_->UpdateCastMessage(); |
136 } | 136 } |
137 | 137 |
138 } // namespace cast | 138 } // namespace cast |
139 } // namespace media | 139 } // namespace media |
OLD | NEW |