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

Side by Side Diff: media/cast/video_sender/fake_software_video_encoder.cc

Issue 308713005: Cast: Synthetic benchmark tool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge + minor fix Created 6 years, 6 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
« no previous file with comments | « media/cast/test/utility/udp_proxy.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/video_sender/fake_software_video_encoder.h" 5 #include "media/cast/video_sender/fake_software_video_encoder.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "media/cast/transport/cast_transport_config.h" 9 #include "media/cast/transport/cast_transport_config.h"
10 10
(...skipping 27 matching lines...) Expand all
38 encoded_image->dependency = transport::EncodedFrame::DEPENDENT; 38 encoded_image->dependency = transport::EncodedFrame::DEPENDENT;
39 encoded_image->referenced_frame_id = encoded_image->frame_id - 1; 39 encoded_image->referenced_frame_id = encoded_image->frame_id - 1;
40 } 40 }
41 41
42 base::DictionaryValue values; 42 base::DictionaryValue values;
43 values.SetBoolean("key", 43 values.SetBoolean("key",
44 encoded_image->dependency == transport::EncodedFrame::KEY); 44 encoded_image->dependency == transport::EncodedFrame::KEY);
45 values.SetInteger("ref", encoded_image->referenced_frame_id); 45 values.SetInteger("ref", encoded_image->referenced_frame_id);
46 values.SetInteger("id", encoded_image->frame_id); 46 values.SetInteger("id", encoded_image->frame_id);
47 values.SetInteger("size", frame_size_); 47 values.SetInteger("size", frame_size_);
48 values.SetString("data", std::string(frame_size_, ' '));
49 base::JSONWriter::Write(&values, &encoded_image->data); 48 base::JSONWriter::Write(&values, &encoded_image->data);
49 encoded_image->data.resize(
50 std::max<size_t>(encoded_image->data.size(), frame_size_));
50 return true; 51 return true;
51 } 52 }
52 53
53 void FakeSoftwareVideoEncoder::UpdateRates(uint32 new_bitrate) { 54 void FakeSoftwareVideoEncoder::UpdateRates(uint32 new_bitrate) {
54 frame_size_ = new_bitrate / video_config_.max_frame_rate / 8; 55 frame_size_ = new_bitrate / video_config_.max_frame_rate / 8;
55 } 56 }
56 57
57 void FakeSoftwareVideoEncoder::GenerateKeyFrame() { 58 void FakeSoftwareVideoEncoder::GenerateKeyFrame() {
58 next_frame_is_key_ = true; 59 next_frame_is_key_ = true;
59 } 60 }
60 61
61 void FakeSoftwareVideoEncoder::LatestFrameIdToReference(uint32 frame_id) { 62 void FakeSoftwareVideoEncoder::LatestFrameIdToReference(uint32 frame_id) {
62 frame_id_to_reference_ = frame_id; 63 frame_id_to_reference_ = frame_id;
63 } 64 }
64 65
65 } // namespace cast 66 } // namespace cast
66 } // namespace media 67 } // namespace media
67 68
68 #endif 69 #endif
OLDNEW
« no previous file with comments | « media/cast/test/utility/udp_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698