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

Unified Diff: media/base/video_frame.cc

Issue 1536783003: Improve logging output for DecoderBuffer and VideoFrame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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/base/video_frame.cc
diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc
index f58e4abd660c03b45219918e934e929a5777a6db..d459f6ed364723d9d97f2bb062144e8ab6a7618e 100644
--- a/media/base/video_frame.cc
+++ b/media/base/video_frame.cc
@@ -45,6 +45,35 @@ static std::string ConfigToString(const VideoPixelFormat format,
visible_rect.ToString().c_str(), natural_size.ToString().c_str());
}
+static std::string StorageTypeToString(
+ const VideoFrame::StorageType storage_type) {
+ switch (storage_type) {
+ case VideoFrame::STORAGE_UNKNOWN:
+ return "UNKNOWN";
+ case VideoFrame::STORAGE_OPAQUE:
+ return "OPAQUE";
+ case VideoFrame::STORAGE_UNOWNED_MEMORY:
+ return "UNOWNED_MEMORY";
+ case VideoFrame::STORAGE_OWNED_MEMORY:
+ return "OWNED_MEMORY";
+ case VideoFrame::STORAGE_SHMEM:
+ return "SHMEM";
+#if defined(OS_LINUX)
+ case VideoFrame::STORAGE_DMABUFS:
+ return "DMABUFS";
+#endif
+#if defined(VIDEO_HOLE)
+ case VideoFrame::STORAGE_HOLE:
+ return "HOLE";
+#endif
+ case VideoFrame::STORAGE_GPU_MEMORY_BUFFERS:
+ return "GPU_MEMORY_BUFFERS";
+ }
+
+ NOTREACHED() << "Invalid StorageType provided: " << storage_type;
+ return "??";
+}
+
// Returns true if |plane| is a valid plane index for the given |format|.
static bool IsValidPlane(size_t plane, VideoPixelFormat format) {
DCHECK_LE(VideoFrame::NumPlanes(format),
@@ -818,6 +847,28 @@ void VideoFrame::UpdateReleaseSyncToken(SyncTokenClient* client) {
client->GenerateSyncToken(&release_sync_token_);
}
+std::string VideoFrame::AsHumanReadableString() {
+ if (metadata()->IsTrue(media::VideoFrameMetadata::END_OF_STREAM))
+ return "end of stream";
+
+ std::ostringstream s;
+ s << "format: " << VideoPixelFormatToString(format_)
+ << " storage_type: " << StorageTypeToString(storage_type_)
+ << " coded_size: " << coded_size_.ToString()
+ << " visible_rect: " << visible_rect_.ToString()
+ << " natural_size: " << natural_size_.ToString() << " strides: ";
+ for (size_t i = 0; i < NumPlanes(format_); ++i)
+ s << strides_[i] << " ";
+ s << "rows: ";
+ for (size_t i = 0; i < NumPlanes(format_); ++i)
+ s << rows(i) << " ";
+ s << "row_bytes: ";
+ for (size_t i = 0; i < NumPlanes(format_); ++i)
+ s << row_bytes(i) << " ";
xhwang 2015/12/18 23:07:43 rows and strides are no as important as other fiel
jrummell 2015/12/22 01:30:43 Removed.
+ s << "timestamp: " << timestamp_.InMicroseconds();
+ return s.str();
+}
+
// static
scoped_refptr<VideoFrame> VideoFrame::WrapExternalStorage(
VideoPixelFormat format,

Powered by Google App Engine
This is Rietveld 408576698