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

Unified Diff: media/filters/ffmpeg_video_decoder.cc

Issue 2768713002: Pass a |media_log| to FFmpegVideoDecoder and roll ffmpeg (Closed)
Patch Set: Created 3 years, 9 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
Index: media/filters/ffmpeg_video_decoder.cc
diff --git a/media/filters/ffmpeg_video_decoder.cc b/media/filters/ffmpeg_video_decoder.cc
index 606968b2141269ab1262ea9d3e5dbe8ad5d57d6b..3ff3db860d52293a9da46992a9a19ac3f2b043e8 100644
--- a/media/filters/ffmpeg_video_decoder.cc
+++ b/media/filters/ffmpeg_video_decoder.cc
@@ -21,6 +21,7 @@
#include "media/base/bind_to_current_loop.h"
#include "media/base/decoder_buffer.h"
#include "media/base/limits.h"
+#include "media/base/media_log.h"
#include "media/base/media_switches.h"
#include "media/base/timestamp_constants.h"
#include "media/base/video_frame.h"
@@ -30,6 +31,16 @@
namespace media {
+namespace {
+
+std::string AVErrorString(int errnum) {
wolenetz 2017/03/22 19:31:50 If the plan is to put similar into other ffmpeg us
sandersd (OOO until July 31) 2017/03/23 23:34:36 Done.
+ char errbuf[AV_ERROR_MAX_STRING_SIZE];
+ av_make_error_string(errbuf, AV_ERROR_MAX_STRING_SIZE, errnum);
DaleCurtis 2017/03/22 00:43:16 Will need an ffmpeg roll to use this in component
sandersd (OOO until July 31) 2017/03/23 23:34:36 Done.
+ return std::string(errbuf);
+}
+
+} // namespace
+
// Always use 2 or more threads for video decoding. Most machines today will
// have 2-8 execution contexts. Using more cores generally doesn't seem to
// increase power usage and allows us to decode video faster.
@@ -112,8 +123,10 @@ bool FFmpegVideoDecoder::IsCodecSupported(VideoCodec codec) {
return avcodec_find_decoder(VideoCodecToCodecID(codec)) != nullptr;
}
-FFmpegVideoDecoder::FFmpegVideoDecoder()
- : state_(kUninitialized), decode_nalus_(false) {
+FFmpegVideoDecoder::FFmpegVideoDecoder(scoped_refptr<MediaLog> media_log)
+ : media_log_(std::move(media_log)),
+ state_(kUninitialized),
+ decode_nalus_(false) {
thread_checker_.DetachFromThread();
}
@@ -358,7 +371,9 @@ bool FFmpegVideoDecoder::FFmpegDecode(
&packet);
// Log the problem if we can't decode a video frame and exit early.
if (result < 0) {
- LOG(ERROR) << "Error decoding video: " << buffer->AsHumanReadableString();
+ MEDIA_LOG(DEBUG, media_log_)
+ << "avcodec_decode_video2(): " << AVErrorString(result) << ", at "
+ << buffer->AsHumanReadableString();
return false;
}

Powered by Google App Engine
This is Rietveld 408576698