| 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=%zu,act=%c,ref=%d", | 321 ("%c/%c,id=%" PRIu32 ",rtp=%" PRIu32 ",br=%d,q=%" PRIuS |
| 322 ",act=%c,ref=%d"), |
| 322 codec_profile_ == media::VP8PROFILE_ANY ? 'V' : 'H', | 323 codec_profile_ == media::VP8PROFILE_ANY ? 'V' : 'H', |
| 323 key_frame ? 'K' : 'D', encoded_frame->frame_id, | 324 key_frame ? 'K' : 'D', encoded_frame->frame_id, |
| 324 encoded_frame->rtp_timestamp, request.target_bit_rate / 1000, | 325 encoded_frame->rtp_timestamp, request.target_bit_rate / 1000, |
| 325 in_progress_frame_encodes_.size(), encoder_active_ ? 'Y' : 'N', | 326 in_progress_frame_encodes_.size(), encoder_active_ ? 'Y' : 'N', |
| 326 static_cast<int>(encoded_frame->referenced_frame_id % 1000)); | 327 static_cast<int>(encoded_frame->referenced_frame_id % 1000)); |
| 327 base::debug::SetCrashKeyValue(kZeroEncodeDetails, details); | 328 base::debug::SetCrashKeyValue(kZeroEncodeDetails, details); |
| 328 // Please forward crash reports to http://crbug.com/519022: | 329 // Please forward crash reports to http://crbug.com/519022: |
| 329 base::debug::DumpWithoutCrashing(); | 330 base::debug::DumpWithoutCrashing(); |
| 330 base::debug::ClearCrashKey(kZeroEncodeDetails); | 331 base::debug::ClearCrashKey(kZeroEncodeDetails); |
| 331 } | 332 } |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 const double kEntropyAtMaxQuantizer = 7.5; | 797 const double kEntropyAtMaxQuantizer = 7.5; |
| 797 const double slope = | 798 const double slope = |
| 798 (MAX_VP8_QUANTIZER - MIN_VP8_QUANTIZER) / kEntropyAtMaxQuantizer; | 799 (MAX_VP8_QUANTIZER - MIN_VP8_QUANTIZER) / kEntropyAtMaxQuantizer; |
| 799 const double quantizer = std::min<double>( | 800 const double quantizer = std::min<double>( |
| 800 MAX_VP8_QUANTIZER, MIN_VP8_QUANTIZER + slope * shannon_entropy); | 801 MAX_VP8_QUANTIZER, MIN_VP8_QUANTIZER + slope * shannon_entropy); |
| 801 return quantizer; | 802 return quantizer; |
| 802 } | 803 } |
| 803 | 804 |
| 804 } // namespace cast | 805 } // namespace cast |
| 805 } // namespace media | 806 } // namespace media |
| OLD | NEW |