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

Side by Side Diff: third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp

Issue 1658033002: Add SourceBuffer implementations of Audio/VideoTracks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pass-media-tracks-to-blink
Patch Set: Added SourceBufferTrackBaseSupplement::from Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 30 matching lines...) Expand all
41 #include "core/fileapi/FileReaderLoader.h" 41 #include "core/fileapi/FileReaderLoader.h"
42 #include "core/html/HTMLMediaElement.h" 42 #include "core/html/HTMLMediaElement.h"
43 #include "core/html/MediaError.h" 43 #include "core/html/MediaError.h"
44 #include "core/html/TimeRanges.h" 44 #include "core/html/TimeRanges.h"
45 #include "core/html/track/AudioTrack.h" 45 #include "core/html/track/AudioTrack.h"
46 #include "core/html/track/AudioTrackList.h" 46 #include "core/html/track/AudioTrackList.h"
47 #include "core/html/track/VideoTrack.h" 47 #include "core/html/track/VideoTrack.h"
48 #include "core/html/track/VideoTrackList.h" 48 #include "core/html/track/VideoTrackList.h"
49 #include "core/streams/Stream.h" 49 #include "core/streams/Stream.h"
50 #include "modules/mediasource/MediaSource.h" 50 #include "modules/mediasource/MediaSource.h"
51 #include "modules/mediasource/SourceBufferTrackBaseSupplement.h"
51 #include "platform/Logging.h" 52 #include "platform/Logging.h"
52 #include "platform/TraceEvent.h" 53 #include "platform/TraceEvent.h"
53 #include "public/platform/WebSourceBuffer.h" 54 #include "public/platform/WebSourceBuffer.h"
54 #include "wtf/MathExtras.h" 55 #include "wtf/MathExtras.h"
55 56
56 #include <limits> 57 #include <limits>
57 #include <sstream> 58 #include <sstream>
58 59
59 using blink::WebSourceBuffer; 60 using blink::WebSourceBuffer;
60 61
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 static WebMediaPlayer::TrackId nextTrackId = 0; 526 static WebMediaPlayer::TrackId nextTrackId = 0;
526 result.push_back(++nextTrackId); 527 result.push_back(++nextTrackId);
527 continue; 528 continue;
528 } 529 }
529 530
530 const TrackBase* trackBase = nullptr; 531 const TrackBase* trackBase = nullptr;
531 if (trackType == WebMediaPlayer::AudioTrack) { 532 if (trackType == WebMediaPlayer::AudioTrack) {
532 AudioTrack* audioTrack = nullptr; 533 AudioTrack* audioTrack = nullptr;
533 if (!m_firstInitializationSegmentReceived) { 534 if (!m_firstInitializationSegmentReceived) {
534 audioTrack = AudioTrack::create(id, kind, label, language, false ); 535 audioTrack = AudioTrack::create(id, kind, label, language, false );
536 SourceBufferTrackBaseSupplement::from(*audioTrack).setSourceBuff er(this);
535 audioTracks().add(audioTrack); 537 audioTracks().add(audioTrack);
536 m_source->mediaElement()->audioTracks().add(audioTrack); 538 m_source->mediaElement()->audioTracks().add(audioTrack);
537 } else { 539 } else {
538 audioTrack = findExistingTrackById(audioTracks(), id); 540 audioTrack = findExistingTrackById(audioTracks(), id);
539 ASSERT(audioTrack); 541 ASSERT(audioTrack);
540 } 542 }
541 trackBase = audioTrack; 543 trackBase = audioTrack;
542 result.push_back(audioTrack->trackId()); 544 result.push_back(audioTrack->trackId());
543 } else if (trackType == WebMediaPlayer::VideoTrack) { 545 } else if (trackType == WebMediaPlayer::VideoTrack) {
544 VideoTrack* videoTrack = nullptr; 546 VideoTrack* videoTrack = nullptr;
545 if (!m_firstInitializationSegmentReceived) { 547 if (!m_firstInitializationSegmentReceived) {
546 videoTrack = VideoTrack::create(id, kind, label, language, false ); 548 videoTrack = VideoTrack::create(id, kind, label, language, false );
549 SourceBufferTrackBaseSupplement::from(*videoTrack).setSourceBuff er(this);
547 videoTracks().add(videoTrack); 550 videoTracks().add(videoTrack);
548 m_source->mediaElement()->videoTracks().add(videoTrack); 551 m_source->mediaElement()->videoTracks().add(videoTrack);
549 } else { 552 } else {
550 videoTrack = findExistingTrackById(videoTracks(), id); 553 videoTrack = findExistingTrackById(videoTracks(), id);
551 ASSERT(videoTrack); 554 ASSERT(videoTrack);
552 } 555 }
553 trackBase = videoTrack; 556 trackBase = videoTrack;
554 result.push_back(videoTrack->trackId()); 557 result.push_back(videoTrack->trackId());
555 } else { 558 } else {
556 NOTREACHED(); 559 NOTREACHED();
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 visitor->trace(m_removeAsyncPartRunner); 958 visitor->trace(m_removeAsyncPartRunner);
956 visitor->trace(m_appendStreamAsyncPartRunner); 959 visitor->trace(m_appendStreamAsyncPartRunner);
957 visitor->trace(m_stream); 960 visitor->trace(m_stream);
958 visitor->trace(m_audioTracks); 961 visitor->trace(m_audioTracks);
959 visitor->trace(m_videoTracks); 962 visitor->trace(m_videoTracks);
960 RefCountedGarbageCollectedEventTargetWithInlineData<SourceBuffer>::trace(vis itor); 963 RefCountedGarbageCollectedEventTargetWithInlineData<SourceBuffer>::trace(vis itor);
961 ActiveDOMObject::trace(visitor); 964 ActiveDOMObject::trace(visitor);
962 } 965 }
963 966
964 } // namespace blink 967 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698