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

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

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase 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
« no previous file with comments | « media/base/media_log.cc ('k') | media/cast/test/sender.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 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/fake_software_video_encoder.h" 5 #include "media/cast/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/base/video_frame.h" 9 #include "media/base/video_frame.h"
10 #include "media/cast/net/cast_transport_config.h" 10 #include "media/cast/net/cast_transport_config.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 encoded_frame->rtp_timestamp = 50 encoded_frame->rtp_timestamp =
51 TimeDeltaToRtpDelta(video_frame->timestamp(), kVideoFrequency); 51 TimeDeltaToRtpDelta(video_frame->timestamp(), kVideoFrequency);
52 encoded_frame->reference_time = reference_time; 52 encoded_frame->reference_time = reference_time;
53 53
54 base::DictionaryValue values; 54 base::DictionaryValue values;
55 values.SetBoolean("key", 55 values.SetBoolean("key",
56 encoded_frame->dependency == EncodedFrame::KEY); 56 encoded_frame->dependency == EncodedFrame::KEY);
57 values.SetInteger("ref", encoded_frame->referenced_frame_id); 57 values.SetInteger("ref", encoded_frame->referenced_frame_id);
58 values.SetInteger("id", encoded_frame->frame_id); 58 values.SetInteger("id", encoded_frame->frame_id);
59 values.SetInteger("size", frame_size_); 59 values.SetInteger("size", frame_size_);
60 base::JSONWriter::Write(&values, &encoded_frame->data); 60 base::JSONWriter::Write(values, &encoded_frame->data);
61 encoded_frame->data.resize( 61 encoded_frame->data.resize(
62 std::max<size_t>(encoded_frame->data.size(), frame_size_), ' '); 62 std::max<size_t>(encoded_frame->data.size(), frame_size_), ' ');
63 } 63 }
64 64
65 void FakeSoftwareVideoEncoder::UpdateRates(uint32 new_bitrate) { 65 void FakeSoftwareVideoEncoder::UpdateRates(uint32 new_bitrate) {
66 frame_size_ = new_bitrate / video_config_.max_frame_rate / 8; 66 frame_size_ = new_bitrate / video_config_.max_frame_rate / 8;
67 } 67 }
68 68
69 void FakeSoftwareVideoEncoder::GenerateKeyFrame() { 69 void FakeSoftwareVideoEncoder::GenerateKeyFrame() {
70 next_frame_is_key_ = true; 70 next_frame_is_key_ = true;
71 } 71 }
72 72
73 void FakeSoftwareVideoEncoder::LatestFrameIdToReference(uint32 frame_id) { 73 void FakeSoftwareVideoEncoder::LatestFrameIdToReference(uint32 frame_id) {
74 frame_id_to_reference_ = frame_id; 74 frame_id_to_reference_ = frame_id;
75 } 75 }
76 76
77 } // namespace cast 77 } // namespace cast
78 } // namespace media 78 } // namespace media
79 79
80 #endif 80 #endif
OLDNEW
« no previous file with comments | « media/base/media_log.cc ('k') | media/cast/test/sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698