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

Side by Side Diff: content/renderer/media/webmediasource_impl.cc

Issue 361023003: WIP fixing/extending acolwell's init-segment-received patch Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased to ToT. Lots of further work needed (BIG TODOs, nits-to-self, etc) Created 6 years, 5 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 | « no previous file | content/renderer/media/websourcebuffer_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "content/renderer/media/webmediasource_impl.h" 5 #include "content/renderer/media/webmediasource_impl.h"
6 6
7 #include "base/bind.h"
7 #include "base/guid.h" 8 #include "base/guid.h"
8 #include "content/renderer/media/websourcebuffer_impl.h" 9 #include "content/renderer/media/websourcebuffer_impl.h"
9 #include "media/filters/chunk_demuxer.h" 10 #include "media/filters/chunk_demuxer.h"
10 #include "third_party/WebKit/public/platform/WebCString.h" 11 #include "third_party/WebKit/public/platform/WebCString.h"
11 #include "third_party/WebKit/public/platform/WebString.h" 12 #include "third_party/WebKit/public/platform/WebString.h"
12 13
13 using ::blink::WebString; 14 using ::blink::WebString;
14 using ::blink::WebMediaSource; 15 using ::blink::WebMediaSource;
15 16
16 namespace content { 17 namespace content {
(...skipping 18 matching lines...) Expand all
35 36
36 WebMediaSource::AddStatus WebMediaSourceImpl::addSourceBuffer( 37 WebMediaSource::AddStatus WebMediaSourceImpl::addSourceBuffer(
37 const blink::WebString& type, 38 const blink::WebString& type,
38 const blink::WebVector<blink::WebString>& codecs, 39 const blink::WebVector<blink::WebString>& codecs,
39 blink::WebSourceBuffer** source_buffer) { 40 blink::WebSourceBuffer** source_buffer) {
40 std::string id = base::GenerateGUID(); 41 std::string id = base::GenerateGUID();
41 std::vector<std::string> new_codecs(codecs.size()); 42 std::vector<std::string> new_codecs(codecs.size());
42 for (size_t i = 0; i < codecs.size(); ++i) 43 for (size_t i = 0; i < codecs.size(); ++i)
43 new_codecs[i] = codecs[i].utf8().data(); 44 new_codecs[i] = codecs[i].utf8().data();
44 45
46 scoped_ptr<WebSourceBufferImpl> web_source_buffer(
47 new WebSourceBufferImpl(id, demuxer_));
48
45 WebMediaSource::AddStatus result = 49 WebMediaSource::AddStatus result =
46 static_cast<WebMediaSource::AddStatus>( 50 static_cast<WebMediaSource::AddStatus>(
47 demuxer_->AddId(id, type.utf8().data(), new_codecs)); 51 demuxer_->AddId(
52 id,
53 type.utf8().data(),
54 new_codecs,
55 base::Bind(&WebSourceBufferImpl::OnNewInitSegment,
56 base::Unretained(web_source_buffer.get()))));
48 57
49 if (result == WebMediaSource::AddStatusOk) 58 if (result == WebMediaSource::AddStatusOk)
50 *source_buffer = new WebSourceBufferImpl(id, demuxer_); 59 *source_buffer = web_source_buffer.release();
51 60
52 return result; 61 return result;
53 } 62 }
54 63
55 double WebMediaSourceImpl::duration() { 64 double WebMediaSourceImpl::duration() {
56 return demuxer_->GetDuration(); 65 return demuxer_->GetDuration();
57 } 66 }
58 67
59 void WebMediaSourceImpl::setDuration(double new_duration) { 68 void WebMediaSourceImpl::setDuration(double new_duration) {
60 DCHECK_GE(new_duration, 0); 69 DCHECK_GE(new_duration, 0);
(...skipping 16 matching lines...) Expand all
77 } 86 }
78 87
79 demuxer_->MarkEndOfStream(pipeline_status); 88 demuxer_->MarkEndOfStream(pipeline_status);
80 } 89 }
81 90
82 void WebMediaSourceImpl::unmarkEndOfStream() { 91 void WebMediaSourceImpl::unmarkEndOfStream() {
83 demuxer_->UnmarkEndOfStream(); 92 demuxer_->UnmarkEndOfStream();
84 } 93 }
85 94
86 } // namespace content 95 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/websourcebuffer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698