| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 176 |
| 176 void WebSourceBufferImpl::InitSegmentReceived( | 177 void WebSourceBufferImpl::InitSegmentReceived( |
| 177 std::unique_ptr<MediaTracks> tracks) { | 178 std::unique_ptr<MediaTracks> tracks) { |
| 178 DCHECK(tracks.get()); | 179 DCHECK(tracks.get()); |
| 179 DVLOG(1) << __FUNCTION__ << " tracks=" << tracks->tracks().size(); | 180 DVLOG(1) << __FUNCTION__ << " tracks=" << tracks->tracks().size(); |
| 180 | 181 |
| 181 std::vector<blink::WebSourceBufferClient::MediaTrackInfo> trackInfoVector; | 182 std::vector<blink::WebSourceBufferClient::MediaTrackInfo> trackInfoVector; |
| 182 for (const auto& track : tracks->tracks()) { | 183 for (const auto& track : tracks->tracks()) { |
| 183 blink::WebSourceBufferClient::MediaTrackInfo trackInfo; | 184 blink::WebSourceBufferClient::MediaTrackInfo trackInfo; |
| 184 trackInfo.trackType = mediaTrackTypeToBlink(track->type()); | 185 trackInfo.trackType = mediaTrackTypeToBlink(track->type()); |
| 185 trackInfo.byteStreamTrackId = blink::WebString::fromUTF8(track->id()); | 186 trackInfo.byteStreamTrackId = blink::WebString::fromUTF8( |
| 187 base::UintToString(track->bytestream_track_id())); |
| 186 trackInfo.kind = blink::WebString::fromUTF8(track->kind()); | 188 trackInfo.kind = blink::WebString::fromUTF8(track->kind()); |
| 187 trackInfo.label = blink::WebString::fromUTF8(track->label()); | 189 trackInfo.label = blink::WebString::fromUTF8(track->label()); |
| 188 trackInfo.language = blink::WebString::fromUTF8(track->language()); | 190 trackInfo.language = blink::WebString::fromUTF8(track->language()); |
| 189 trackInfoVector.push_back(trackInfo); | 191 trackInfoVector.push_back(trackInfo); |
| 190 } | 192 } |
| 191 | 193 |
| 192 client_->initializationSegmentReceived(trackInfoVector); | 194 client_->initializationSegmentReceived(trackInfoVector); |
| 193 } | 195 } |
| 194 | 196 |
| 195 } // namespace media | 197 } // namespace media |
| OLD | NEW |