Chromium Code Reviews| 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" |
| 11 #include "media/base/video_frame.h" | 11 #include "media/base/video_frame.h" |
| 12 #include "media/cast/common/rtp_time.h" | 12 #include "media/cast/common/rtp_time.h" |
| 13 #include "media/cast/constants.h" | 13 #include "media/cast/constants.h" |
| 14 | 14 |
| 15 #ifndef OFFICIAL_BUILD | 15 #ifndef OFFICIAL_BUILD |
| 16 | 16 |
| 17 namespace media { | 17 namespace media { |
| 18 namespace cast { | 18 namespace cast { |
| 19 | 19 |
| 20 FakeSoftwareVideoEncoder::FakeSoftwareVideoEncoder( | 20 FakeSoftwareVideoEncoder::FakeSoftwareVideoEncoder( |
| 21 const VideoSenderConfig& video_config) | 21 const FrameSenderConfig& video_config) |
| 22 : video_config_(video_config), | 22 : video_config_(video_config), |
| 23 next_frame_is_key_(true), | 23 next_frame_is_key_(true), |
| 24 frame_id_(FrameId::first()), | 24 frame_id_(FrameId::first()), |
| 25 frame_size_(0) {} | 25 frame_size_(0) {} |
| 26 | 26 |
| 27 FakeSoftwareVideoEncoder::~FakeSoftwareVideoEncoder() {} | 27 FakeSoftwareVideoEncoder::~FakeSoftwareVideoEncoder() {} |
| 28 | 28 |
| 29 void FakeSoftwareVideoEncoder::Initialize() {} | 29 void FakeSoftwareVideoEncoder::Initialize() {} |
| 30 | 30 |
| 31 void FakeSoftwareVideoEncoder::Encode( | 31 void FakeSoftwareVideoEncoder::Encode( |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 if (encoded_frame->dependency == EncodedFrame::KEY) { | 65 if (encoded_frame->dependency == EncodedFrame::KEY) { |
| 66 encoded_frame->deadline_utilization = 1.0; | 66 encoded_frame->deadline_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->deadline_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 DCHECK_GT(video_config_.max_frame_rate, 0); | |
|
miu
2016/06/30 21:59:43
Seems that this could be in the ctor (to just chec
xjz
2016/07/01 23:52:09
Done.
| |
| 75 frame_size_ = new_bitrate / video_config_.max_frame_rate / 8; | 76 frame_size_ = new_bitrate / video_config_.max_frame_rate / 8; |
| 76 } | 77 } |
| 77 | 78 |
| 78 void FakeSoftwareVideoEncoder::GenerateKeyFrame() { | 79 void FakeSoftwareVideoEncoder::GenerateKeyFrame() { |
| 79 next_frame_is_key_ = true; | 80 next_frame_is_key_ = true; |
| 80 } | 81 } |
| 81 | 82 |
| 82 } // namespace cast | 83 } // namespace cast |
| 83 } // namespace media | 84 } // namespace media |
| 84 | 85 |
| 85 #endif | 86 #endif |
| OLD | NEW |