Index: media/blink/websourcebuffer_impl.cc |
diff --git a/media/blink/websourcebuffer_impl.cc b/media/blink/websourcebuffer_impl.cc |
index 6b08b1319634b55179767637f8fcb2d0f5df12cd..9386f5222eca6a9145c7f5e53e6853ebebfa37ca 100644 |
--- a/media/blink/websourcebuffer_impl.cc |
+++ b/media/blink/websourcebuffer_impl.cc |
@@ -15,6 +15,7 @@ |
#include "media/base/media_tracks.h" |
#include "media/base/timestamp_constants.h" |
#include "media/filters/chunk_demuxer.h" |
+#include "third_party/WebKit/public/platform/WebMediaPlayer.h" |
#include "third_party/WebKit/public/platform/WebSourceBufferClient.h" |
namespace media { |
@@ -159,11 +160,35 @@ void WebSourceBufferImpl::removedFromMediaSource() { |
client_ = NULL; |
} |
+blink::WebMediaPlayer::TrackType mediaTrackTypeToBlink(MediaTrack::Type type) { |
+ switch (type) { |
+ case MediaTrack::Audio: |
+ return blink::WebMediaPlayer::AudioTrack; |
+ case MediaTrack::Text: |
+ return blink::WebMediaPlayer::TextTrack; |
+ case MediaTrack::Video: |
+ return blink::WebMediaPlayer::VideoTrack; |
+ } |
+ NOTREACHED(); |
+ return blink::WebMediaPlayer::AudioTrack; |
+} |
+ |
void WebSourceBufferImpl::InitSegmentReceived(scoped_ptr<MediaTracks> tracks) { |
- DVLOG(1) << __FUNCTION__; |
- // TODO(servolk): Implement passing MediaTrack info to blink level. |
- // https://crbug.com/249428 |
- client_->initializationSegmentReceived(); |
+ DCHECK(tracks.get()); |
+ DVLOG(1) << __FUNCTION__ << " tracks=" << tracks->tracks().size(); |
+ |
+ std::vector<blink::WebSourceBufferClient::MediaTrackInfo> trackInfoVector; |
+ for (const auto& track : tracks->tracks()) { |
+ trackInfoVector.push_back( |
+ std::make_tuple(mediaTrackTypeToBlink(track->type()), |
+ blink::WebString::fromUTF8(track->id()), |
+ blink::WebString::fromUTF8(track->kind()), |
+ blink::WebString::fromUTF8(track->label()), |
+ blink::WebString::fromUTF8(track->language()))); |
+ } |
+ |
+ std::vector<blink::WebMediaPlayer::TrackId> blinkTrackIds = |
+ client_->initializationSegmentReceived(trackInfoVector); |
} |
} // namespace media |