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

Side by Side Diff: media/cast/sender/external_video_encoder.cc

Issue 1148233002: [Cast] Compute utilization metrics and add performance overlay. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed hubbe's comments. Created 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/sender/external_video_encoder.h" 5 #include "media/cast/sender/external_video_encoder.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/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 // Save the bitstream buffer in |stream_header_| to be sent later along 193 // Save the bitstream buffer in |stream_header_| to be sent later along
194 // with the first key frame. 194 // with the first key frame.
195 // 195 //
196 // TODO(miu): Should |stream_header_| be an std::ostringstream for 196 // TODO(miu): Should |stream_header_| be an std::ostringstream for
197 // performance reasons? 197 // performance reasons?
198 stream_header_.append(static_cast<const char*>(output_buffer->memory()), 198 stream_header_.append(static_cast<const char*>(output_buffer->memory()),
199 payload_size); 199 payload_size);
200 } else if (!in_progress_frame_encodes_.empty()) { 200 } else if (!in_progress_frame_encodes_.empty()) {
201 const InProgressFrameEncode& request = in_progress_frame_encodes_.front(); 201 const InProgressFrameEncode& request = in_progress_frame_encodes_.front();
202 202
203 scoped_ptr<EncodedFrame> encoded_frame(new EncodedFrame()); 203 scoped_ptr<SenderEncodedFrame> encoded_frame(new SenderEncodedFrame());
204 encoded_frame->dependency = key_frame ? EncodedFrame::KEY : 204 encoded_frame->dependency = key_frame ? EncodedFrame::KEY :
205 EncodedFrame::DEPENDENT; 205 EncodedFrame::DEPENDENT;
206 encoded_frame->frame_id = next_frame_id_++; 206 encoded_frame->frame_id = next_frame_id_++;
207 if (key_frame) 207 if (key_frame)
208 encoded_frame->referenced_frame_id = encoded_frame->frame_id; 208 encoded_frame->referenced_frame_id = encoded_frame->frame_id;
209 else 209 else
210 encoded_frame->referenced_frame_id = encoded_frame->frame_id - 1; 210 encoded_frame->referenced_frame_id = encoded_frame->frame_id - 1;
211 encoded_frame->rtp_timestamp = request.rtp_timestamp; 211 encoded_frame->rtp_timestamp = request.rtp_timestamp;
212 encoded_frame->reference_time = request.reference_time; 212 encoded_frame->reference_time = request.reference_time;
213 if (!stream_header_.empty()) { 213 if (!stream_header_.empty()) {
214 encoded_frame->data = stream_header_; 214 encoded_frame->data = stream_header_;
215 stream_header_.clear(); 215 stream_header_.clear();
216 } 216 }
217 encoded_frame->data.append( 217 encoded_frame->data.append(
218 static_cast<const char*>(output_buffer->memory()), payload_size); 218 static_cast<const char*>(output_buffer->memory()), payload_size);
219 // TODO(miu): Compute and populate the |deadline_utilization| and
220 // |lossy_utilization| performance metrics in |encoded_frame|.
219 221
220 cast_environment_->PostTask( 222 cast_environment_->PostTask(
221 CastEnvironment::MAIN, 223 CastEnvironment::MAIN,
222 FROM_HERE, 224 FROM_HERE,
223 base::Bind(&LogFrameEncodedEvent, 225 base::Bind(&LogFrameEncodedEvent,
224 cast_environment_, 226 cast_environment_,
225 cast_environment_->Clock()->NowTicks(), 227 cast_environment_->Clock()->NowTicks(),
226 encoded_frame->rtp_timestamp, 228 encoded_frame->rtp_timestamp,
227 encoded_frame->frame_id)); 229 encoded_frame->frame_id));
228 230
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 video_config(), 466 video_config(),
465 frame_size(), 467 frame_size(),
466 last_frame_id() + 1, 468 last_frame_id() + 1,
467 CreateEncoderStatusChangeCallback(), 469 CreateEncoderStatusChangeCallback(),
468 create_vea_cb_, 470 create_vea_cb_,
469 create_video_encode_memory_cb_)); 471 create_video_encode_memory_cb_));
470 } 472 }
471 473
472 } // namespace cast 474 } // namespace cast
473 } // namespace media 475 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/receiver/video_decoder_unittest.cc ('k') | media/cast/sender/fake_software_video_encoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698