| OLD | NEW |
| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 values.SetBoolean("key", | 56 values.SetBoolean("key", |
| 57 encoded_frame->dependency == EncodedFrame::KEY); | 57 encoded_frame->dependency == EncodedFrame::KEY); |
| 58 values.SetInteger("ref", encoded_frame->referenced_frame_id.lower_32_bits()); | 58 values.SetInteger("ref", encoded_frame->referenced_frame_id.lower_32_bits()); |
| 59 values.SetInteger("id", encoded_frame->frame_id.lower_32_bits()); | 59 values.SetInteger("id", encoded_frame->frame_id.lower_32_bits()); |
| 60 values.SetInteger("size", frame_size_); | 60 values.SetInteger("size", frame_size_); |
| 61 base::JSONWriter::Write(values, &encoded_frame->data); | 61 base::JSONWriter::Write(values, &encoded_frame->data); |
| 62 encoded_frame->data.resize( | 62 encoded_frame->data.resize( |
| 63 std::max<size_t>(encoded_frame->data.size(), frame_size_), ' '); | 63 std::max<size_t>(encoded_frame->data.size(), frame_size_), ' '); |
| 64 | 64 |
| 65 if (encoded_frame->dependency == EncodedFrame::KEY) { | 65 if (encoded_frame->dependency == EncodedFrame::KEY) { |
| 66 encoded_frame->deadline_utilization = 1.0; | 66 encoded_frame->encoder_utilization = 1.0; |
| 67 encoded_frame->lossy_utilization = 6.0; | 67 encoded_frame->lossy_utilization = 6.0; |
| 68 } else { | 68 } else { |
| 69 encoded_frame->deadline_utilization = 0.8; | 69 encoded_frame->encoder_utilization = 0.8; |
| 70 encoded_frame->lossy_utilization = 0.8; | 70 encoded_frame->lossy_utilization = 0.8; |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 | 73 |
| 74 void FakeSoftwareVideoEncoder::UpdateRates(uint32_t new_bitrate) { | 74 void FakeSoftwareVideoEncoder::UpdateRates(uint32_t new_bitrate) { |
| 75 frame_size_ = new_bitrate / video_config_.max_frame_rate / 8; | 75 frame_size_ = new_bitrate / video_config_.max_frame_rate / 8; |
| 76 } | 76 } |
| 77 | 77 |
| 78 void FakeSoftwareVideoEncoder::GenerateKeyFrame() { | 78 void FakeSoftwareVideoEncoder::GenerateKeyFrame() { |
| 79 next_frame_is_key_ = true; | 79 next_frame_is_key_ = true; |
| 80 } | 80 } |
| 81 | 81 |
| 82 } // namespace cast | 82 } // namespace cast |
| 83 } // namespace media | 83 } // namespace media |
| 84 | 84 |
| 85 #endif | 85 #endif |
| OLD | NEW |