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

Side by Side Diff: media/blink/webmediasource_impl.cc

Issue 1282883004: Remove the old WebMediaSourceImpl::addSourceBuffer overload (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@parse-codecs-in-media
Patch Set: Rebase to ToT Created 5 years, 4 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
« no previous file with comments | « media/blink/webmediasource_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 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 "media/blink/webmediasource_impl.h" 5 #include "media/blink/webmediasource_impl.h"
6 6
7 #include "base/guid.h" 7 #include "base/guid.h"
8 #include "media/base/mime_util.h" 8 #include "media/base/mime_util.h"
9 #include "media/blink/websourcebuffer_impl.h" 9 #include "media/blink/websourcebuffer_impl.h"
10 #include "media/filters/chunk_demuxer.h" 10 #include "media/filters/chunk_demuxer.h"
(...skipping 17 matching lines...) Expand all
28 WebMediaSourceImpl::WebMediaSourceImpl(ChunkDemuxer* demuxer, 28 WebMediaSourceImpl::WebMediaSourceImpl(ChunkDemuxer* demuxer,
29 const scoped_refptr<MediaLog>& media_log) 29 const scoped_refptr<MediaLog>& media_log)
30 : demuxer_(demuxer), media_log_(media_log) { 30 : demuxer_(demuxer), media_log_(media_log) {
31 DCHECK(demuxer_); 31 DCHECK(demuxer_);
32 } 32 }
33 33
34 WebMediaSourceImpl::~WebMediaSourceImpl() {} 34 WebMediaSourceImpl::~WebMediaSourceImpl() {}
35 35
36 WebMediaSource::AddStatus WebMediaSourceImpl::addSourceBuffer( 36 WebMediaSource::AddStatus WebMediaSourceImpl::addSourceBuffer(
37 const blink::WebString& type, 37 const blink::WebString& type,
38 const blink::WebVector<blink::WebString>& codecs,
39 blink::WebSourceBuffer** source_buffer) {
40 std::string id = base::GenerateGUID();
41 std::vector<std::string> new_codecs(codecs.size());
42 for (size_t i = 0; i < codecs.size(); ++i)
43 new_codecs[i] = codecs[i].utf8().data();
44
45 WebMediaSource::AddStatus result =
46 static_cast<WebMediaSource::AddStatus>(
47 demuxer_->AddId(id, type.utf8().data(), new_codecs));
48
49 if (result == WebMediaSource::AddStatusOk)
50 *source_buffer = new WebSourceBufferImpl(id, demuxer_);
51
52 return result;
53 }
54
55 WebMediaSource::AddStatus WebMediaSourceImpl::addSourceBuffer(
56 const blink::WebString& type,
57 const blink::WebString& codecs, 38 const blink::WebString& codecs,
58 blink::WebSourceBuffer** source_buffer) { 39 blink::WebSourceBuffer** source_buffer) {
59 std::string id = base::GenerateGUID(); 40 std::string id = base::GenerateGUID();
60 41
61 std::vector<std::string> parsed_codec_ids; 42 std::vector<std::string> parsed_codec_ids;
62 media::ParseCodecString(codecs.utf8().data(), &parsed_codec_ids, false); 43 media::ParseCodecString(codecs.utf8().data(), &parsed_codec_ids, false);
63 44
64 WebMediaSource::AddStatus result = 45 WebMediaSource::AddStatus result =
65 static_cast<WebMediaSource::AddStatus>( 46 static_cast<WebMediaSource::AddStatus>(
66 demuxer_->AddId(id, type.utf8().data(), parsed_codec_ids)); 47 demuxer_->AddId(id, type.utf8().data(), parsed_codec_ids));
(...skipping 29 matching lines...) Expand all
96 } 77 }
97 78
98 demuxer_->MarkEndOfStream(pipeline_status); 79 demuxer_->MarkEndOfStream(pipeline_status);
99 } 80 }
100 81
101 void WebMediaSourceImpl::unmarkEndOfStream() { 82 void WebMediaSourceImpl::unmarkEndOfStream() {
102 demuxer_->UnmarkEndOfStream(); 83 demuxer_->UnmarkEndOfStream();
103 } 84 }
104 85
105 } // namespace media 86 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/webmediasource_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698