| OLD | NEW |
| 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/websourcebuffer_impl.h" | 5 #include "media/blink/websourcebuffer_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <limits> | 10 #include <limits> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/callback_helpers.h" | 14 #include "base/callback_helpers.h" |
| 15 #include "base/strings/string_number_conversions.h" |
| 15 #include "media/base/media_tracks.h" | 16 #include "media/base/media_tracks.h" |
| 16 #include "media/base/timestamp_constants.h" | 17 #include "media/base/timestamp_constants.h" |
| 17 #include "media/filters/chunk_demuxer.h" | 18 #include "media/filters/chunk_demuxer.h" |
| 18 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" | 19 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" |
| 19 #include "third_party/WebKit/public/platform/WebSourceBufferClient.h" | 20 #include "third_party/WebKit/public/platform/WebSourceBufferClient.h" |
| 20 | 21 |
| 21 namespace media { | 22 namespace media { |
| 22 | 23 |
| 23 static base::TimeDelta DoubleToTimeDelta(double time) { | 24 static base::TimeDelta DoubleToTimeDelta(double time) { |
| 24 DCHECK(!std::isnan(time)); | 25 DCHECK(!std::isnan(time)); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 } | 175 } |
| 175 | 176 |
| 176 void WebSourceBufferImpl::InitSegmentReceived(scoped_ptr<MediaTracks> tracks) { | 177 void WebSourceBufferImpl::InitSegmentReceived(scoped_ptr<MediaTracks> tracks) { |
| 177 DCHECK(tracks.get()); | 178 DCHECK(tracks.get()); |
| 178 DVLOG(1) << __FUNCTION__ << " tracks=" << tracks->tracks().size(); | 179 DVLOG(1) << __FUNCTION__ << " tracks=" << tracks->tracks().size(); |
| 179 | 180 |
| 180 std::vector<blink::WebSourceBufferClient::MediaTrackInfo> trackInfoVector; | 181 std::vector<blink::WebSourceBufferClient::MediaTrackInfo> trackInfoVector; |
| 181 for (const auto& track : tracks->tracks()) { | 182 for (const auto& track : tracks->tracks()) { |
| 182 blink::WebSourceBufferClient::MediaTrackInfo trackInfo; | 183 blink::WebSourceBufferClient::MediaTrackInfo trackInfo; |
| 183 trackInfo.trackType = mediaTrackTypeToBlink(track->type()); | 184 trackInfo.trackType = mediaTrackTypeToBlink(track->type()); |
| 184 trackInfo.byteStreamTrackId = blink::WebString::fromUTF8(track->id()); | 185 trackInfo.byteStreamTrackId = |
| 186 blink::WebString::fromUTF8(base::UintToString(track->id())); |
| 185 trackInfo.kind = blink::WebString::fromUTF8(track->kind()); | 187 trackInfo.kind = blink::WebString::fromUTF8(track->kind()); |
| 186 trackInfo.label = blink::WebString::fromUTF8(track->label()); | 188 trackInfo.label = blink::WebString::fromUTF8(track->label()); |
| 187 trackInfo.language = blink::WebString::fromUTF8(track->language()); | 189 trackInfo.language = blink::WebString::fromUTF8(track->language()); |
| 188 trackInfoVector.push_back(trackInfo); | 190 trackInfoVector.push_back(trackInfo); |
| 189 } | 191 } |
| 190 | 192 |
| 191 client_->initializationSegmentReceived(trackInfoVector); | 193 client_->initializationSegmentReceived(trackInfoVector); |
| 192 } | 194 } |
| 193 | 195 |
| 194 } // namespace media | 196 } // namespace media |
| OLD | NEW |