Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Side by Side Diff: media/cast/framer/framer.cc

Issue 288103002: [Cast] EncodedAudioFrame+EncodedVideoFrame+reference_time --> EncodedFrame (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/cast/framer/framer.h ('k') | media/cast/framer/framer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 if (complete) { 62 if (complete) {
63 // ACK as soon as possible. 63 // ACK as soon as possible.
64 VLOG(2) << "Complete frame " << static_cast<int>(rtp_header.frame_id); 64 VLOG(2) << "Complete frame " << static_cast<int>(rtp_header.frame_id);
65 cast_msg_builder_->CompleteFrameReceived(rtp_header.frame_id, 65 cast_msg_builder_->CompleteFrameReceived(rtp_header.frame_id,
66 rtp_header.is_key_frame); 66 rtp_header.is_key_frame);
67 } 67 }
68 return complete; 68 return complete;
69 } 69 }
70 70
71 // This does not release the frame. 71 // This does not release the frame.
72 bool Framer::GetEncodedAudioFrame(transport::EncodedAudioFrame* audio_frame, 72 bool Framer::GetEncodedAudioFrame(transport::EncodedFrame* audio_frame,
73 bool* next_frame) { 73 bool* next_frame) {
74 uint32 frame_id; 74 uint32 frame_id;
75 // Find frame id. 75 // Find frame id.
76 if (frame_id_map_.NextContinuousFrame(&frame_id)) { 76 if (frame_id_map_.NextContinuousFrame(&frame_id)) {
77 // We have our next frame. 77 // We have our next frame.
78 *next_frame = true; 78 *next_frame = true;
79 } else { 79 } else {
80 if (!frame_id_map_.NextAudioFrameAllowingMissingFrames(&frame_id)) { 80 if (!frame_id_map_.NextAudioFrameAllowingMissingFrames(&frame_id)) {
81 return false; 81 return false;
82 } 82 }
83 *next_frame = false; 83 *next_frame = false;
84 } 84 }
85 85
86 ConstFrameIterator it = frames_.find(frame_id); 86 ConstFrameIterator it = frames_.find(frame_id);
87 DCHECK(it != frames_.end()); 87 DCHECK(it != frames_.end());
88 if (it == frames_.end()) 88 if (it == frames_.end())
89 return false; 89 return false;
90 90
91 return it->second->GetEncodedAudioFrame(audio_frame); 91 return it->second->AssembleEncodedFrame(audio_frame);
92 } 92 }
93 93
94 // This does not release the frame. 94 // This does not release the frame.
95 bool Framer::GetEncodedVideoFrame(transport::EncodedVideoFrame* video_frame, 95 bool Framer::GetEncodedVideoFrame(transport::EncodedFrame* video_frame,
96 bool* next_frame) { 96 bool* next_frame) {
97 uint32 frame_id; 97 uint32 frame_id;
98 // Find frame id. 98 // Find frame id.
99 if (frame_id_map_.NextContinuousFrame(&frame_id)) { 99 if (frame_id_map_.NextContinuousFrame(&frame_id)) {
100 // We have our next frame. 100 // We have our next frame.
101 *next_frame = true; 101 *next_frame = true;
102 } else { 102 } else {
103 // Check if we can skip frames when our decoder is too slow. 103 // Check if we can skip frames when our decoder is too slow.
104 if (!decoder_faster_than_max_frame_rate_) 104 if (!decoder_faster_than_max_frame_rate_)
105 return false; 105 return false;
106 106
107 if (!frame_id_map_.NextVideoFrameAllowingSkippingFrames(&frame_id)) { 107 if (!frame_id_map_.NextVideoFrameAllowingSkippingFrames(&frame_id)) {
108 return false; 108 return false;
109 } 109 }
110 *next_frame = false; 110 *next_frame = false;
111 } 111 }
112 112
113 ConstFrameIterator it = frames_.find(frame_id); 113 ConstFrameIterator it = frames_.find(frame_id);
114 DCHECK(it != frames_.end()); 114 DCHECK(it != frames_.end());
115 if (it == frames_.end()) 115 if (it == frames_.end())
116 return false; 116 return false;
117 117
118 return it->second->GetEncodedVideoFrame(video_frame); 118 return it->second->AssembleEncodedFrame(video_frame);
119 } 119 }
120 120
121 void Framer::Reset() { 121 void Framer::Reset() {
122 frame_id_map_.Clear(); 122 frame_id_map_.Clear();
123 frames_.clear(); 123 frames_.clear();
124 cast_msg_builder_->Reset(); 124 cast_msg_builder_->Reset();
125 } 125 }
126 126
127 void Framer::ReleaseFrame(uint32 frame_id) { 127 void Framer::ReleaseFrame(uint32 frame_id) {
128 frame_id_map_.RemoveOldFrames(frame_id); 128 frame_id_map_.RemoveOldFrames(frame_id);
(...skipping 16 matching lines...) Expand all
145 } 145 }
146 146
147 bool Framer::TimeToSendNextCastMessage(base::TimeTicks* time_to_send) { 147 bool Framer::TimeToSendNextCastMessage(base::TimeTicks* time_to_send) {
148 return cast_msg_builder_->TimeToSendNextCastMessage(time_to_send); 148 return cast_msg_builder_->TimeToSendNextCastMessage(time_to_send);
149 } 149 }
150 150
151 void Framer::SendCastMessage() { cast_msg_builder_->UpdateCastMessage(); } 151 void Framer::SendCastMessage() { cast_msg_builder_->UpdateCastMessage(); }
152 152
153 } // namespace cast 153 } // namespace cast
154 } // namespace media 154 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/framer/framer.h ('k') | media/cast/framer/framer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698