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

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: rebase Created 4 years, 11 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
« no previous file with comments | « media/base/video_frame.h ('k') | media/cdm/cdm_adapter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/video_frame.cc
diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc
index aad4969e61541effbf31541a825dad83ba59e32b..0ad4ac0f807607d90b0bc0a24695a79507d2eeb8 100644
--- a/media/base/video_frame.cc
+++ b/media/base/video_frame.cc
@@ -47,6 +47,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 "INVALID";
+}
+
// 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),
@@ -826,6 +855,20 @@ 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()
+ << " timestamp: " << timestamp_.InMicroseconds();
+ return s.str();
+}
+
// static
scoped_refptr<VideoFrame> VideoFrame::WrapExternalStorage(
VideoPixelFormat format,
« no previous file with comments | « media/base/video_frame.h ('k') | media/cdm/cdm_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698