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

Unified Diff: media/blink/websourcebuffer_impl.cc

Issue 1659653002: Pass MSE media track info from ChunkDemuxer to blink::SourceBuffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@use-media-tracks-in-media
Patch Set: nit Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698