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/external_video_encoder.h" | 5 #include "media/cast/sender/external_video_encoder.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/debug/crash_logging.h" | 10 #include "base/debug/crash_logging.h" |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 quantizer_estimator_.Reset(); | 311 quantizer_estimator_.Reset(); |
312 } | 312 } |
313 | 313 |
314 // TODO(miu): Determine when/why encoding can produce zero-length data, | 314 // TODO(miu): Determine when/why encoding can produce zero-length data, |
315 // which causes crypto crashes. http://crbug.com/519022 | 315 // which causes crypto crashes. http://crbug.com/519022 |
316 if (!has_seen_zero_length_encoded_frame_ && encoded_frame->data.empty()) { | 316 if (!has_seen_zero_length_encoded_frame_ && encoded_frame->data.empty()) { |
317 has_seen_zero_length_encoded_frame_ = true; | 317 has_seen_zero_length_encoded_frame_ = true; |
318 | 318 |
319 const char kZeroEncodeDetails[] = "zero-encode-details"; | 319 const char kZeroEncodeDetails[] = "zero-encode-details"; |
320 const std::string details = base::StringPrintf( | 320 const std::string details = base::StringPrintf( |
321 ("%c/%c,id=%" PRIu32 ",rtp=%" PRIu32 ",br=%d,q=%" PRIuS | 321 "%c/%c,id=%" PRIu32 ",rtp=%" PRIu32 ",br=%d,q=%zu,act=%c,ref=%d", |
322 ",act=%c,ref=%d"), | |
323 codec_profile_ == media::VP8PROFILE_ANY ? 'V' : 'H', | 322 codec_profile_ == media::VP8PROFILE_ANY ? 'V' : 'H', |
324 key_frame ? 'K' : 'D', encoded_frame->frame_id, | 323 key_frame ? 'K' : 'D', encoded_frame->frame_id, |
325 encoded_frame->rtp_timestamp, request.target_bit_rate / 1000, | 324 encoded_frame->rtp_timestamp, request.target_bit_rate / 1000, |
326 in_progress_frame_encodes_.size(), encoder_active_ ? 'Y' : 'N', | 325 in_progress_frame_encodes_.size(), encoder_active_ ? 'Y' : 'N', |
327 static_cast<int>(encoded_frame->referenced_frame_id % 1000)); | 326 static_cast<int>(encoded_frame->referenced_frame_id % 1000)); |
328 base::debug::SetCrashKeyValue(kZeroEncodeDetails, details); | 327 base::debug::SetCrashKeyValue(kZeroEncodeDetails, details); |
329 // Please forward crash reports to http://crbug.com/519022: | 328 // Please forward crash reports to http://crbug.com/519022: |
330 base::debug::DumpWithoutCrashing(); | 329 base::debug::DumpWithoutCrashing(); |
331 base::debug::ClearCrashKey(kZeroEncodeDetails); | 330 base::debug::ClearCrashKey(kZeroEncodeDetails); |
332 } | 331 } |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 const double kEntropyAtMaxQuantizer = 7.5; | 796 const double kEntropyAtMaxQuantizer = 7.5; |
798 const double slope = | 797 const double slope = |
799 (MAX_VP8_QUANTIZER - MIN_VP8_QUANTIZER) / kEntropyAtMaxQuantizer; | 798 (MAX_VP8_QUANTIZER - MIN_VP8_QUANTIZER) / kEntropyAtMaxQuantizer; |
800 const double quantizer = std::min<double>( | 799 const double quantizer = std::min<double>( |
801 MAX_VP8_QUANTIZER, MIN_VP8_QUANTIZER + slope * shannon_entropy); | 800 MAX_VP8_QUANTIZER, MIN_VP8_QUANTIZER + slope * shannon_entropy); |
802 return quantizer; | 801 return quantizer; |
803 } | 802 } |
804 | 803 |
805 } // namespace cast | 804 } // namespace cast |
806 } // namespace media | 805 } // namespace media |
OLD | NEW |