Index: media/cast/sender/vp8_encoder.cc |
diff --git a/media/cast/sender/vp8_encoder.cc b/media/cast/sender/vp8_encoder.cc |
index 7bb2f11f5ff345e064d0e131df805ff563ed7211..771075a17aa70c66e06ddb08f57a99e6267bb25c 100644 |
--- a/media/cast/sender/vp8_encoder.cc |
+++ b/media/cast/sender/vp8_encoder.cc |
@@ -4,7 +4,11 @@ |
#include "media/cast/sender/vp8_encoder.h" |
+#include "base/debug/crash_logging.h" |
+#include "base/debug/dump_without_crashing.h" |
+#include "base/format_macros.h" |
#include "base/logging.h" |
+#include "base/strings/stringprintf.h" |
#include "media/base/video_frame.h" |
#include "media/cast/cast_defines.h" |
#include "third_party/libvpx_new/source/libvpx/vpx/vp8cx.h" |
@@ -31,7 +35,8 @@ Vp8Encoder::Vp8Encoder(const VideoSenderConfig& video_config) |
bitrate_kbit_(cast_config_.start_bitrate / 1000), |
last_encoded_frame_id_(kStartFrameId), |
last_acked_frame_id_(kStartFrameId), |
- undroppable_frames_(0) { |
+ undroppable_frames_(0), |
+ has_seen_zero_length_encoded_frame_(false) { |
config_.g_timebase.den = 0; // Not initialized. |
for (int i = 0; i < kNumberOfVp8VideoBuffers; ++i) { |
@@ -283,6 +288,24 @@ void Vp8Encoder::Encode(const scoped_refptr<media::VideoFrame>& video_frame, |
DCHECK(!encoded_frame->data.empty()) |
<< "BUG: Encoder must provide data since lagged encoding is disabled."; |
+ // TODO(miu): Determine when/why encoding can produce zero-length data, |
+ // which causes crypto crashes. http://crbug.com/519022 |
+ if (!has_seen_zero_length_encoded_frame_ && encoded_frame->data.empty()) { |
+ has_seen_zero_length_encoded_frame_ = true; |
+ |
+ const char kZeroEncodeDetails[] = "zero-encode-details"; |
+ const std::string details = base::StringPrintf( |
+ "SV/%c,id=%" PRIu32 ",rtp=%" PRIu32 ",br=%d,kfr=%c", |
+ encoded_frame->dependency == EncodedFrame::KEY ? 'K' : 'D', |
+ encoded_frame->frame_id, encoded_frame->rtp_timestamp, |
+ static_cast<int>(config_.rc_target_bitrate), |
+ key_frame_requested_ ? 'Y' : 'N'); |
+ base::debug::SetCrashKeyValue(kZeroEncodeDetails, details); |
+ // Please forward crash reports to http://crbug.com/519022: |
+ base::debug::DumpWithoutCrashing(); |
+ base::debug::ClearCrashKey(kZeroEncodeDetails); |
+ } |
+ |
// Compute deadline utilization as the real-world time elapsed divided by the |
// frame duration. |
const base::TimeDelta processing_time = base::TimeTicks::Now() - start_time; |