Index: third_party/WebKit/Source/modules/mediasource/MediaSource.cpp |
diff --git a/third_party/WebKit/Source/modules/mediasource/MediaSource.cpp b/third_party/WebKit/Source/modules/mediasource/MediaSource.cpp |
index 8089d192192a7819bef165474418bb66f7797609..74adff174ee9a29f135f857d5dd60130f3955cfd 100644 |
--- a/third_party/WebKit/Source/modules/mediasource/MediaSource.cpp |
+++ b/third_party/WebKit/Source/modules/mediasource/MediaSource.cpp |
@@ -51,6 +51,8 @@ |
using blink::WebMediaSource; |
using blink::WebSourceBuffer; |
+#define MEDIA_SOURCE_LOG_LEVEL 3 |
Srirama
2016/05/19 15:00:22
Is 3 fine to make it less verbose? or should we ma
wolenetz
2016/05/19 17:53:33
3 is fine. It's what I use personally when debuggi
|
+ |
namespace blink { |
static bool throwExceptionIfClosedOrUpdating(bool isOpen, bool isUpdating, ExceptionState& exceptionState) |
@@ -102,24 +104,24 @@ MediaSource::MediaSource(ExecutionContext* context) |
, m_activeSourceBuffers(SourceBufferList::create(getExecutionContext(), m_asyncEventQueue.get())) |
, m_isAddedToRegistry(false) |
{ |
- WTF_LOG(Media, "MediaSource::MediaSource %p", this); |
+ DVLOG(MEDIA_SOURCE_LOG_LEVEL) << "MediaSource " << this; |
wolenetz
2016/05/19 17:53:33
Just double-checking: does "this" not need the (vo
Srirama
2016/05/20 08:31:48
It doesn't need, I verified and it is printing the
|
} |
MediaSource::~MediaSource() |
{ |
- WTF_LOG(Media, "MediaSource::~MediaSource %p", this); |
+ DVLOG(MEDIA_SOURCE_LOG_LEVEL) << "~MediaSource " << this; |
ASSERT(isClosed()); |
} |
void MediaSource::logAndThrowDOMException(ExceptionState& exceptionState, const ExceptionCode& error, const String& message) |
{ |
- WTF_LOG(Media, "throwDOMException: error=%d msg=%s", error, message.utf8().data()); |
+ DVLOG(MEDIA_SOURCE_LOG_LEVEL) << "throwDOMException: error=" << error << " msg=" << message; |
wolenetz
2016/05/19 17:53:33
Is __FUNCTION__ usable here as a replacement (here
Srirama
2016/05/20 08:31:48
Not able to print "this" here as it is a static fu
wolenetz
2016/05/20 19:58:15
Acknowledged.
|
exceptionState.throwDOMException(error, message); |
} |
SourceBuffer* MediaSource::addSourceBuffer(const String& type, ExceptionState& exceptionState) |
{ |
- WTF_LOG(Media, "MediaSource::addSourceBuffer(%s) %p", type.ascii().data(), this); |
+ DVLOG(MEDIA_SOURCE_LOG_LEVEL) << "addSourceBuffer(" << type << ") " << this; |
// 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type |
// 1. If type is an empty string then throw an InvalidAccessError exception |
@@ -160,13 +162,13 @@ SourceBuffer* MediaSource::addSourceBuffer(const String& type, ExceptionState& e |
m_sourceBuffers->add(buffer); |
// 7. Return the new object to the caller. |
- WTF_LOG(Media, "MediaSource::addSourceBuffer(%s) %p -> %p", type.ascii().data(), this, buffer); |
+ DVLOG(MEDIA_SOURCE_LOG_LEVEL) << "addSourceBuffer(" << type << ") " << this << " -> " << buffer; |
wolenetz
2016/05/19 17:53:33
Ditto on the double-check for |buffer| here please
Srirama
2016/05/20 08:31:48
I think you want the buffer pointer to be printed
wolenetz
2016/05/20 19:58:15
Acknowledged.
|
return buffer; |
} |
void MediaSource::removeSourceBuffer(SourceBuffer* buffer, ExceptionState& exceptionState) |
{ |
- WTF_LOG(Media, "MediaSource::removeSourceBuffer() %p", this); |
+ DVLOG(MEDIA_SOURCE_LOG_LEVEL) << "removeSourceBuffer() " << this; |
wolenetz
2016/05/19 17:53:33
nit: now seems like a good time to add |buffer| to
Srirama
2016/05/20 08:31:48
Done.
|
// 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#widl-MediaSource-removeSourceBuffer-void-SourceBuffer-sourceBuffer |
@@ -235,7 +237,7 @@ bool MediaSource::isTypeSupported(const String& type) |
// https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#widl-MediaSource-isTypeSupported-boolean-DOMString-type |
// 1. If type is an empty string, then return false. |
if (type.isEmpty()) { |
- WTF_LOG(Media, "MediaSource::isTypeSupported(%s) -> false (empty input)", type.ascii().data()); |
+ DVLOG(MEDIA_SOURCE_LOG_LEVEL) << "isTypeSupported(" << type << ") -> false (empty input)"; |
return false; |
} |
@@ -244,14 +246,14 @@ bool MediaSource::isTypeSupported(const String& type) |
// 2. If type does not contain a valid MIME type string, then return false. |
if (contentType.type().isEmpty()) { |
- WTF_LOG(Media, "MediaSource::isTypeSupported(%s) -> false (invalid mime type)", type.ascii().data()); |
+ DVLOG(MEDIA_SOURCE_LOG_LEVEL) << "isTypeSupported(" << type << ") -> false (invalid mime type)"; |
return false; |
} |
// Note: MediaSource.isTypeSupported() returning true implies that HTMLMediaElement.canPlayType() will return "maybe" or "probably" |
// since it does not make sense for a MediaSource to support a type the HTMLMediaElement knows it cannot play. |
if (HTMLMediaElement::supportsType(contentType) == WebMimeRegistry::IsNotSupported) { |
- WTF_LOG(Media, "MediaSource::isTypeSupported(%s) -> false (not supported by HTMLMediaElement)", type.ascii().data()); |
+ DVLOG(MEDIA_SOURCE_LOG_LEVEL) << "isTypeSupported(" << type << ") -> false (not supported by HTMLMediaElement)"; |
return false; |
} |
@@ -260,7 +262,7 @@ bool MediaSource::isTypeSupported(const String& type) |
// 5. If the MediaSource does not support the specified combination of media type, media subtype, and codecs then return false. |
// 6. Return true. |
bool result = MIMETypeRegistry::isSupportedMediaSourceMIMEType(contentType.type(), codecs); |
- WTF_LOG(Media, "MediaSource::isTypeSupported(%s) -> %s", type.ascii().data(), result ? "true" : "false"); |
+ DVLOG(MEDIA_SOURCE_LOG_LEVEL) << "isTypeSupported(" << type << ") -> " << (result ? "true" : "false"); |
return result; |
} |
@@ -446,7 +448,7 @@ void MediaSource::setReadyState(const AtomicString& state) |
ASSERT(state == openKeyword() || state == closedKeyword() || state == endedKeyword()); |
AtomicString oldState = readyState(); |
- WTF_LOG(Media, "MediaSource::setReadyState() %p : %s -> %s", this, oldState.ascii().data(), state.ascii().data()); |
+ DVLOG(MEDIA_SOURCE_LOG_LEVEL) << "setReadyState() " << this << " : " << oldState << " -> " << state; |
if (state == closedKeyword()) { |
m_webMediaSource.clear(); |