Commit 591c272b authored by Matt Wolenetz's avatar Matt Wolenetz Committed by Commit Bot

MSE: Clarify WebMediaSource::AddSourceBuffer() method

For this interface method and implementation, adds comments, renames
|type| parameter to |content_type|, and removes unnecessary .data()
following Utf8(); all per CR comments on the recently added similar
WebSourceBuffer::{Can}ChangeType() methods.

BUG=605134

Change-Id: I0cd259a1a1508edff91287eb60b49721d61e9187
Reviewed-on: https://chromium-review.googlesource.com/1115578Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Matthew Wolenetz <wolenetz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570836}
parent 3660f7d9
...@@ -32,13 +32,13 @@ WebMediaSourceImpl::WebMediaSourceImpl(ChunkDemuxer* demuxer) ...@@ -32,13 +32,13 @@ WebMediaSourceImpl::WebMediaSourceImpl(ChunkDemuxer* demuxer)
WebMediaSourceImpl::~WebMediaSourceImpl() = default; WebMediaSourceImpl::~WebMediaSourceImpl() = default;
WebMediaSource::AddStatus WebMediaSourceImpl::AddSourceBuffer( WebMediaSource::AddStatus WebMediaSourceImpl::AddSourceBuffer(
const blink::WebString& type, const blink::WebString& content_type,
const blink::WebString& codecs, const blink::WebString& codecs,
blink::WebSourceBuffer** source_buffer) { blink::WebSourceBuffer** source_buffer) {
std::string id = base::GenerateGUID(); std::string id = base::GenerateGUID();
WebMediaSource::AddStatus result = static_cast<WebMediaSource::AddStatus>( WebMediaSource::AddStatus result = static_cast<WebMediaSource::AddStatus>(
demuxer_->AddId(id, type.Utf8().data(), codecs.Utf8().data())); demuxer_->AddId(id, content_type.Utf8(), codecs.Utf8()));
if (result == WebMediaSource::kAddStatusOk) if (result == WebMediaSource::kAddStatusOk)
*source_buffer = new WebSourceBufferImpl(id, demuxer_); *source_buffer = new WebSourceBufferImpl(id, demuxer_);
......
...@@ -21,7 +21,7 @@ class MEDIA_BLINK_EXPORT WebMediaSourceImpl : public blink::WebMediaSource { ...@@ -21,7 +21,7 @@ class MEDIA_BLINK_EXPORT WebMediaSourceImpl : public blink::WebMediaSource {
~WebMediaSourceImpl() override; ~WebMediaSourceImpl() override;
// blink::WebMediaSource implementation. // blink::WebMediaSource implementation.
AddStatus AddSourceBuffer(const blink::WebString& type, AddStatus AddSourceBuffer(const blink::WebString& content_type,
const blink::WebString& codecs, const blink::WebString& codecs,
blink::WebSourceBuffer** source_buffer) override; blink::WebSourceBuffer** source_buffer) override;
double Duration() override; double Duration() override;
......
...@@ -54,9 +54,24 @@ class WebMediaSource { ...@@ -54,9 +54,24 @@ class WebMediaSource {
}; };
virtual ~WebMediaSource() = default; virtual ~WebMediaSource() = default;
virtual AddStatus AddSourceBuffer(const WebString& type,
// Attempts to create a new WebSourceBuffer for use with this WebMediaSource.
// |content_type| is the ContentType string of the new WebSourceBuffer
// bytestream's MIME type, and |codecs| contains the "codecs" parameter
// string, if any, of the bytestream's MIME type.
// If this WebMediaSource supports the format indicated by |content_type| and
// |codecs| and has enough resources to support a new WebSourceBuffer, returns
// kAddStatusOk and creates a new WebSourceBuffer and changes the
// WebSourceBuffer parameter to point to it.
// If this WebMediaSource cannot handle another WebSourceBuffer right now,
// returns kAddStatusReachedIdLimit without modifying the WebSourceBuffer
// parameter.
// If |content_type| and |codecs| are not supported, returns
// kAddStatusNotSupported without modifying the WebSourceBuffer parameter.
virtual AddStatus AddSourceBuffer(const WebString& content_type,
const WebString& codecs, const WebString& codecs,
WebSourceBuffer**) = 0; WebSourceBuffer**) = 0;
virtual double Duration() = 0; virtual double Duration() = 0;
virtual void SetDuration(double) = 0; virtual void SetDuration(double) = 0;
virtual void MarkEndOfStream(EndOfStreamStatus) = 0; virtual void MarkEndOfStream(EndOfStreamStatus) = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment