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/vp8_encoder.h" | 5 #include "media/cast/sender/vp8_encoder.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "media/base/video_frame.h" | 8 #include "media/base/video_frame.h" |
9 #include "media/cast/cast_defines.h" | 9 #include "media/cast/cast_defines.h" |
10 #include "media/cast/net/cast_transport_config.h" | 10 #include "media/cast/net/cast_transport_config.h" |
11 #include "third_party/libvpx/source/libvpx/vpx/vp8cx.h" | 11 #include "third_party/libvpx/source/libvpx/vpx/vp8cx.h" |
12 | 12 |
13 namespace media { | 13 namespace media { |
14 namespace cast { | 14 namespace cast { |
15 | 15 |
16 static const uint32 kMinIntra = 300; | 16 static const uint32 kMinIntra = 300; |
17 | 17 |
18 Vp8Encoder::Vp8Encoder(const VideoSenderConfig& video_config, | 18 Vp8Encoder::Vp8Encoder(const VideoSenderConfig& video_config) |
19 int max_unacked_frames) | |
20 : cast_config_(video_config), | 19 : cast_config_(video_config), |
21 use_multiple_video_buffers_( | 20 use_multiple_video_buffers_( |
22 cast_config_.max_number_of_video_buffers_used == | 21 cast_config_.max_number_of_video_buffers_used == |
23 kNumberOfVp8VideoBuffers), | 22 kNumberOfVp8VideoBuffers), |
24 raw_image_(nullptr), | 23 raw_image_(nullptr), |
25 key_frame_requested_(true), | 24 key_frame_requested_(true), |
26 first_frame_received_(false), | 25 first_frame_received_(false), |
27 last_encoded_frame_id_(kStartFrameId), | 26 last_encoded_frame_id_(kStartFrameId), |
28 last_acked_frame_id_(kStartFrameId), | 27 last_acked_frame_id_(kStartFrameId), |
29 frame_id_to_reference_(kStartFrameId - 1), | 28 frame_id_to_reference_(kStartFrameId - 1), |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 float scale_parameter = 0.5; | 420 float scale_parameter = 0.5; |
422 uint32 target_pct = optimal_buffer_size_ms * scale_parameter * | 421 uint32 target_pct = optimal_buffer_size_ms * scale_parameter * |
423 cast_config_.max_frame_rate / 10; | 422 cast_config_.max_frame_rate / 10; |
424 | 423 |
425 // Don't go below 3 times the per frame bandwidth. | 424 // Don't go below 3 times the per frame bandwidth. |
426 return std::max(target_pct, kMinIntra); | 425 return std::max(target_pct, kMinIntra); |
427 } | 426 } |
428 | 427 |
429 } // namespace cast | 428 } // namespace cast |
430 } // namespace media | 429 } // namespace media |
OLD | NEW |