| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |