From db3ed544f8c31ed4889d44a6e8d33b38a3d0d6a0 Mon Sep 17 00:00:00 2001 From: KongQun Yang Date: Thu, 8 Nov 2018 17:06:05 -0800 Subject: [PATCH] Add the logging for 'Container not supported' error Dump the first 512 bytes of the buffer if container is unknown. This can help us find out what the actual container is; and fix the container detection bug if there is. Closes #505. Change-Id: I4a8fe5954d0419ef2ccbb9067ec2e9ffe1da417e --- packager/media/demuxer/demuxer.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packager/media/demuxer/demuxer.cc b/packager/media/demuxer/demuxer.cc index 419ea5c4be..094319fae7 100644 --- a/packager/media/demuxer/demuxer.cc +++ b/packager/media/demuxer/demuxer.cc @@ -199,9 +199,17 @@ Status Demuxer::InitializeParser() { case CONTAINER_WEBM: parser_.reset(new WebMMediaParser()); break; - break; + case CONTAINER_UNKNOWN: { + const int64_t kDumpSizeLimit = 512; + LOG(ERROR) << "Failed to detect the container type from the buffer: " + << base::HexEncode(buffer_.get(), + std::min(bytes_read, kDumpSizeLimit)); + return Status(error::INVALID_ARGUMENT, + "Failed to detect the container type."); + } default: - NOTIMPLEMENTED(); + NOTIMPLEMENTED() << "Container " << container_name_ + << " is not supported."; return Status(error::UNIMPLEMENTED, "Container not supported."); }