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

Side by Side Diff: webkit/media/webmediasourceclient_impl.cc

Issue 12713004: Add Chromium-side changes for MediaSource::isTypeSupported() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Relax DEPS strictness to media/filters & rebased. Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/media/webmediasourceclient_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/media/webmediasourceclient_impl.h" 5 #include "webkit/media/webmediasourceclient_impl.h"
6 6
7 #include "base/guid.h" 7 #include "base/guid.h"
8 #include "media/filters/chunk_demuxer.h" 8 #include "media/filters/chunk_demuxer.h"
9 #include "third_party/WebKit/Source/Platform/chromium/public/WebCString.h" 9 #include "third_party/WebKit/Source/Platform/chromium/public/WebCString.h"
10 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 offset * base::Time::kMicrosecondsPerSecond); 78 offset * base::Time::kMicrosecondsPerSecond);
79 return demuxer_->SetTimestampOffset(id_, time_offset); 79 return demuxer_->SetTimestampOffset(id_, time_offset);
80 } 80 }
81 81
82 void WebSourceBufferImpl::removedFromMediaSource() { 82 void WebSourceBufferImpl::removedFromMediaSource() {
83 demuxer_->RemoveId(id_); 83 demuxer_->RemoveId(id_);
84 demuxer_ = NULL; 84 demuxer_ = NULL;
85 } 85 }
86 86
87 WebMediaSourceClientImpl::WebMediaSourceClientImpl( 87 WebMediaSourceClientImpl::WebMediaSourceClientImpl(
88 const scoped_refptr<media::ChunkDemuxer>& demuxer) 88 const scoped_refptr<media::ChunkDemuxer>& demuxer,
89 : demuxer_(demuxer) { 89 media::LogCB log_cb)
90 : demuxer_(demuxer),
91 log_cb_(log_cb) {
90 DCHECK(demuxer_); 92 DCHECK(demuxer_);
91 } 93 }
92 94
93 WebMediaSourceClientImpl::~WebMediaSourceClientImpl() {} 95 WebMediaSourceClientImpl::~WebMediaSourceClientImpl() {}
94 96
95 WebMediaSourceClient::AddStatus WebMediaSourceClientImpl::addSourceBuffer( 97 WebMediaSourceClient::AddStatus WebMediaSourceClientImpl::addSourceBuffer(
96 const WebKit::WebString& type, 98 const WebKit::WebString& type,
97 const WebKit::WebVector<WebKit::WebString>& codecs, 99 const WebKit::WebVector<WebKit::WebString>& codecs,
98 WebKit::WebSourceBuffer** source_buffer) { 100 WebKit::WebSourceBuffer** source_buffer) {
99 std::string id = base::GenerateGUID(); 101 std::string id = base::GenerateGUID();
100 std::vector<std::string> new_codecs(codecs.size()); 102 std::vector<std::string> new_codecs(codecs.size());
101 for (size_t i = 0; i < codecs.size(); ++i) 103 for (size_t i = 0; i < codecs.size(); ++i)
102 new_codecs[i] = codecs[i].utf8().data(); 104 new_codecs[i] = codecs[i].utf8().data();
103
104 WebMediaSourceClient::AddStatus result = 105 WebMediaSourceClient::AddStatus result =
105 static_cast<WebMediaSourceClient::AddStatus>( 106 static_cast<WebMediaSourceClient::AddStatus>(
106 demuxer_->AddId(id, type.utf8().data(), new_codecs)); 107 demuxer_->AddId(id, type.utf8().data(), new_codecs));
107 108
108 if (result == WebMediaSourceClient::AddStatusOk) 109 if (result == WebMediaSourceClient::AddStatusOk)
109 *source_buffer = new WebSourceBufferImpl(id, demuxer_); 110 *source_buffer = new WebSourceBufferImpl(id, demuxer_);
110 111
111 return result; 112 return result;
112 } 113 }
113 114
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 break; 151 break;
151 default: 152 default:
152 NOTIMPLEMENTED(); 153 NOTIMPLEMENTED();
153 } 154 }
154 155
155 if (!demuxer_->EndOfStream(pipeline_status)) 156 if (!demuxer_->EndOfStream(pipeline_status))
156 DVLOG(1) << "EndOfStream call failed."; 157 DVLOG(1) << "EndOfStream call failed.";
157 } 158 }
158 159
159 } // namespace webkit_media 160 } // namespace webkit_media
OLDNEW
« no previous file with comments | « webkit/media/webmediasourceclient_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698