Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(367)

Unified Diff: media/filters/ffmpeg_demuxer.cc

Issue 21953003: Added logging calls to FFmpegDemuxer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« media/base/video_frame.cc ('K') | « media/base/video_frame.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/ffmpeg_demuxer.cc
diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc
index 70c55963f1c9700c2c090f89a0e270bde58e07c1..ea2e70fa69b27913c7c66909e41a982370ec712e 100644
--- a/media/filters/ffmpeg_demuxer.cc
+++ b/media/filters/ffmpeg_demuxer.cc
@@ -17,6 +17,7 @@
#include "base/metrics/sparse_histogram.h"
#include "base/stl_util.h"
#include "base/strings/string_util.h"
+#include "base/strings/stringprintf.h"
#include "base/task_runner_util.h"
#include "base/time/time.h"
#include "media/base/audio_decoder_config.h"
@@ -503,6 +504,7 @@ void FFmpegDemuxer::OnFindStreamInfoDone(const PipelineStatusCB& status_cb,
if (codec_type == AVMEDIA_TYPE_AUDIO) {
if (found_audio_stream)
continue;
+
// Log the codec detected, whether it is supported or not.
UMA_HISTOGRAM_SPARSE_SLOWLY("Media.DetectedAudioCodec",
codec_context->codec_id);
@@ -510,12 +512,24 @@ void FFmpegDemuxer::OnFindStreamInfoDone(const PipelineStatusCB& status_cb,
// channel layout and sample format are valid.
AudioDecoderConfig audio_config;
AVStreamToAudioDecoderConfig(stream, &audio_config, false);
+
+ // Logging
+ media_log_->SetStringProperty("audio_codec_name",
+ codec_context->codec_name);
+ media_log_->SetIntegerProperty("audio_sample_rate",
+ codec_context->sample_rate);
+ media_log_->SetIntegerProperty("audio_channels_count",
+ codec_context->channels);
+ media_log_->SetIntegerProperty("audio_samples_per_second",
+ audio_config.samples_per_second());
+
if (!audio_config.IsValidConfig())
continue;
found_audio_stream = true;
} else if (codec_type == AVMEDIA_TYPE_VIDEO) {
if (found_video_stream)
continue;
+
// Log the codec detected, whether it is supported or not.
UMA_HISTOGRAM_SPARSE_SLOWLY("Media.DetectedVideoCodec",
codec_context->codec_id);
@@ -523,6 +537,24 @@ void FFmpegDemuxer::OnFindStreamInfoDone(const PipelineStatusCB& status_cb,
// frame size and visible size are valid.
VideoDecoderConfig video_config;
AVStreamToVideoDecoderConfig(stream, &video_config, false);
+
+ // Logging
+ std::string codec_name = avcodec_get_name(codec_context->codec_id);
+ media_log_->SetStringProperty("video_codec_name", codec_name);
+ media_log_->SetIntegerProperty("width", codec_context->width);
+ media_log_->SetIntegerProperty("height", codec_context->height);
+ media_log_->SetIntegerProperty("coded_width", codec_context->coded_width);
+ media_log_->SetIntegerProperty("coded_height",
+ codec_context->coded_height);
+ media_log_->SetStringProperty(
+ "time_base", base::StringPrintf("%d/%d",
+ codec_context->time_base.num,
+ codec_context->time_base.den));
+ media_log_->SetStringProperty("video_format",
+ VideoFrame::FormatToString(video_config.format()));
+ media_log_->SetBooleanProperty("video_is_encrypted",
+ video_config.is_encrypted());
+
if (!video_config.IsValidConfig())
continue;
found_video_stream = true;
@@ -579,6 +611,14 @@ void FFmpegDemuxer::OnFindStreamInfoDone(const PipelineStatusCB& status_cb,
if (bitrate_ > 0)
data_source_->SetBitrate(bitrate_);
+ media_log_->SetBooleanProperty("found_audio_stream", found_audio_stream);
+ media_log_->SetBooleanProperty("found_video_stream", found_video_stream);
+ media_log_->SetDoubleProperty("max_duration", max_duration.InSecondsF());
+ media_log_->SetDoubleProperty("start_time", start_time_.InSecondsF());
+ media_log_->SetStringProperty("filesize_in_bytes",
+ std::to_string(filesize_in_bytes));
+ media_log_->SetIntegerProperty("bitrate", bitrate_);
+
status_cb.Run(PIPELINE_OK);
}
« media/base/video_frame.cc ('K') | « media/base/video_frame.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698