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

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

Issue 2263823002: Deliver change notifications to SourceBuffer track lists. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Call VideoTrackList::trackSelected also the SourceBuffer track list Created 4 years, 3 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
« no previous file with comments | « third_party/WebKit/Source/modules/mediasource/SourceBuffer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 662
663 bool SourceBuffer::initializationSegmentReceived(const WebVector<MediaTrackInfo> & newTracks) 663 bool SourceBuffer::initializationSegmentReceived(const WebVector<MediaTrackInfo> & newTracks)
664 { 664 {
665 BLINK_SBLOG << __func__ << " this=" << this << " tracks=" << newTracks.size( ); 665 BLINK_SBLOG << __func__ << " this=" << this << " tracks=" << newTracks.size( );
666 DCHECK(m_source); 666 DCHECK(m_source);
667 DCHECK(m_source->mediaElement()); 667 DCHECK(m_source->mediaElement());
668 DCHECK(m_updating); 668 DCHECK(m_updating);
669 669
670 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) { 670 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) {
671 if (!m_firstInitializationSegmentReceived) { 671 if (!m_firstInitializationSegmentReceived) {
672 m_source->setSourceBufferActive(this); 672 m_source->setSourceBufferActive(this, true);
673 m_firstInitializationSegmentReceived = true; 673 m_firstInitializationSegmentReceived = true;
674 } 674 }
675 return true; 675 return true;
676 } 676 }
677 677
678 // Implementation of Initialization Segment Received, see 678 // Implementation of Initialization Segment Received, see
679 // https://w3c.github.io/media-source/#sourcebuffer-init-segment-received 679 // https://w3c.github.io/media-source/#sourcebuffer-init-segment-received
680 680
681 // Sort newTracks into audio and video tracks to facilitate implementation 681 // Sort newTracks into audio and video tracks to facilitate implementation
682 // of subsequent steps of this algorithm. 682 // of subsequent steps of this algorithm.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 } 757 }
758 758
759 // 3.2 Add the appropriate track descriptions from this initialization s egment to each of the track buffers. 759 // 3.2 Add the appropriate track descriptions from this initialization s egment to each of the track buffers.
760 // This is done in Chromium code in stream parsers and demuxer implement ations. 760 // This is done in Chromium code in stream parsers and demuxer implement ations.
761 761
762 // 3.3 Set the need random access point flag on all track buffers to tru e. 762 // 3.3 Set the need random access point flag on all track buffers to tru e.
763 // This is done in Chromium code, see MediaSourceState::OnNewConfigs. 763 // This is done in Chromium code, see MediaSourceState::OnNewConfigs.
764 } 764 }
765 765
766 // 4. Let active track flag equal false. 766 // 4. Let active track flag equal false.
767 m_activeTrack = false; 767 bool activeTrack = false;
768 768
769 // 5. If the first initialization segment received flag is false, then run t he following steps: 769 // 5. If the first initialization segment received flag is false, then run t he following steps:
770 if (!m_firstInitializationSegmentReceived) { 770 if (!m_firstInitializationSegmentReceived) {
771 // 5.1 If the initialization segment contains tracks with codecs the use r agent does not support, then run the append error algorithm with the decode er ror parameter set to true and abort these steps. 771 // 5.1 If the initialization segment contains tracks with codecs the use r agent does not support, then run the append error algorithm with the decode er ror parameter set to true and abort these steps.
772 // This is done in Chromium code, see MediaSourceState::OnNewConfigs. 772 // This is done in Chromium code, see MediaSourceState::OnNewConfigs.
773 773
774 // 5.2 For each audio track in the initialization segment, run following steps: 774 // 5.2 For each audio track in the initialization segment, run following steps:
775 for (const MediaTrackInfo& trackInfo : newAudioTracks) { 775 for (const MediaTrackInfo& trackInfo : newAudioTracks) {
776 // 5.2.1 Let audio byte stream track ID be the Track ID for the curr ent track being processed. 776 // 5.2.1 Let audio byte stream track ID be the Track ID for the curr ent track being processed.
777 const auto& byteStreamTrackID = trackInfo.byteStreamTrackID; 777 const auto& byteStreamTrackID = trackInfo.byteStreamTrackID;
(...skipping 13 matching lines...) Expand all
791 const auto& kind = trackInfo.kind; 791 const auto& kind = trackInfo.kind;
792 // 5.2.7 TODO(servolk): Implement track kind processing. 792 // 5.2.7 TODO(servolk): Implement track kind processing.
793 // 5.2.8.2 Let new audio track be a new AudioTrack object. 793 // 5.2.8.2 Let new audio track be a new AudioTrack object.
794 AudioTrack* audioTrack = AudioTrack::create(trackInfo.id, kind, labe l, language, false); 794 AudioTrack* audioTrack = AudioTrack::create(trackInfo.id, kind, labe l, language, false);
795 SourceBufferTrackBaseSupplement::setSourceBuffer(*audioTrack, this); 795 SourceBufferTrackBaseSupplement::setSourceBuffer(*audioTrack, this);
796 // 5.2.8.7 If audioTracks.length equals 0, then run the following st eps: 796 // 5.2.8.7 If audioTracks.length equals 0, then run the following st eps:
797 if (audioTracks().length() == 0) { 797 if (audioTracks().length() == 0) {
798 // 5.2.8.7.1 Set the enabled property on new audio track to true . 798 // 5.2.8.7.1 Set the enabled property on new audio track to true .
799 audioTrack->setEnabled(true); 799 audioTrack->setEnabled(true);
800 // 5.2.8.7.2 Set active track flag to true. 800 // 5.2.8.7.2 Set active track flag to true.
801 m_activeTrack = true; 801 activeTrack = true;
802 } 802 }
803 // 5.2.8.8 Add new audio track to the audioTracks attribute on this SourceBuffer object. 803 // 5.2.8.8 Add new audio track to the audioTracks attribute on this SourceBuffer object.
804 // 5.2.8.9 Queue a task to fire a trusted event named addtrack, that does not bubble and is not cancelable, and that uses the TrackEvent interface, at the AudioTrackList object referenced by the audioTracks attribute on this Sou rceBuffer object. 804 // 5.2.8.9 Queue a task to fire a trusted event named addtrack, that does not bubble and is not cancelable, and that uses the TrackEvent interface, at the AudioTrackList object referenced by the audioTracks attribute on this Sou rceBuffer object.
805 audioTracks().add(audioTrack); 805 audioTracks().add(audioTrack);
806 // 5.2.8.10 Add new audio track to the audioTracks attribute on the HTMLMediaElement. 806 // 5.2.8.10 Add new audio track to the audioTracks attribute on the HTMLMediaElement.
807 // 5.2.8.11 Queue a task to fire a trusted event named addtrack, tha t does not bubble and is not cancelable, and that uses the TrackEvent interface, at the AudioTrackList object referenced by the audioTracks attribute on the HTM LMediaElement. 807 // 5.2.8.11 Queue a task to fire a trusted event named addtrack, tha t does not bubble and is not cancelable, and that uses the TrackEvent interface, at the AudioTrackList object referenced by the audioTracks attribute on the HTM LMediaElement.
808 m_source->mediaElement()->audioTracks().add(audioTrack); 808 m_source->mediaElement()->audioTracks().add(audioTrack);
809 } 809 }
810 810
811 // 5.3. For each video track in the initialization segment, run followin g steps: 811 // 5.3. For each video track in the initialization segment, run followin g steps:
(...skipping 16 matching lines...) Expand all
828 const auto& kind = trackInfo.kind; 828 const auto& kind = trackInfo.kind;
829 // 5.3.7 TODO(servolk): Implement track kind processing. 829 // 5.3.7 TODO(servolk): Implement track kind processing.
830 // 5.3.8.2 Let new video track be a new VideoTrack object. 830 // 5.3.8.2 Let new video track be a new VideoTrack object.
831 VideoTrack* videoTrack = VideoTrack::create(trackInfo.id, kind, labe l, language, false); 831 VideoTrack* videoTrack = VideoTrack::create(trackInfo.id, kind, labe l, language, false);
832 SourceBufferTrackBaseSupplement::setSourceBuffer(*videoTrack, this); 832 SourceBufferTrackBaseSupplement::setSourceBuffer(*videoTrack, this);
833 // 5.3.8.7 If videoTracks.length equals 0, then run the following st eps: 833 // 5.3.8.7 If videoTracks.length equals 0, then run the following st eps:
834 if (videoTracks().length() == 0) { 834 if (videoTracks().length() == 0) {
835 // 5.3.8.7.1 Set the selected property on new audio track to tru e. 835 // 5.3.8.7.1 Set the selected property on new audio track to tru e.
836 videoTrack->setSelected(true); 836 videoTrack->setSelected(true);
837 // 5.3.8.7.2 Set active track flag to true. 837 // 5.3.8.7.2 Set active track flag to true.
838 m_activeTrack = true; 838 activeTrack = true;
839 } 839 }
840 // 5.3.8.8 Add new video track to the videoTracks attribute on this SourceBuffer object. 840 // 5.3.8.8 Add new video track to the videoTracks attribute on this SourceBuffer object.
841 // 5.3.8.9 Queue a task to fire a trusted event named addtrack, that does not bubble and is not cancelable, and that uses the TrackEvent interface, at the VideoTrackList object referenced by the videoTracks attribute on this Sou rceBuffer object. 841 // 5.3.8.9 Queue a task to fire a trusted event named addtrack, that does not bubble and is not cancelable, and that uses the TrackEvent interface, at the VideoTrackList object referenced by the videoTracks attribute on this Sou rceBuffer object.
842 videoTracks().add(videoTrack); 842 videoTracks().add(videoTrack);
843 // 5.3.8.10 Add new video track to the videoTracks attribute on the HTMLMediaElement. 843 // 5.3.8.10 Add new video track to the videoTracks attribute on the HTMLMediaElement.
844 // 5.3.8.11 Queue a task to fire a trusted event named addtrack, tha t does not bubble and is not cancelable, and that uses the TrackEvent interface, at the VideoTrackList object referenced by the videoTracks attribute on the HTM LMediaElement. 844 // 5.3.8.11 Queue a task to fire a trusted event named addtrack, tha t does not bubble and is not cancelable, and that uses the TrackEvent interface, at the VideoTrackList object referenced by the videoTracks attribute on the HTM LMediaElement.
845 m_source->mediaElement()->videoTracks().add(videoTrack); 845 m_source->mediaElement()->videoTracks().add(videoTrack);
846 } 846 }
847 847
848 // 5.4 TODO(servolk): Add text track processing here. 848 // 5.4 TODO(servolk): Add text track processing here.
849 849
850 // 5.5 If active track flag equals true, then run the following steps: 850 // 5.5 If active track flag equals true, then run the following steps:
851 // activesourcebuffers. 851 // activesourcebuffers.
852 if (m_activeTrack) { 852 if (activeTrack) {
853 // 5.5.1 Add this SourceBuffer to activeSourceBuffers. 853 // 5.5.1 Add this SourceBuffer to activeSourceBuffers.
854 // 5.5.2 Queue a task to fire a simple event named addsourcebuffer a t activeSourceBuffers 854 // 5.5.2 Queue a task to fire a simple event named addsourcebuffer a t activeSourceBuffers
855 m_source->setSourceBufferActive(this); 855 m_source->setSourceBufferActive(this, true);
856 } 856 }
857 857
858 // 5.6. Set first initialization segment received flag to true. 858 // 5.6. Set first initialization segment received flag to true.
859 m_firstInitializationSegmentReceived = true; 859 m_firstInitializationSegmentReceived = true;
860 } 860 }
861 861
862 return true; 862 return true;
863 } 863 }
864 864
865 bool SourceBuffer::hasPendingActivity() const 865 bool SourceBuffer::hasPendingActivity() const
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
1260 visitor->trace(m_removeAsyncPartRunner); 1260 visitor->trace(m_removeAsyncPartRunner);
1261 visitor->trace(m_appendStreamAsyncPartRunner); 1261 visitor->trace(m_appendStreamAsyncPartRunner);
1262 visitor->trace(m_stream); 1262 visitor->trace(m_stream);
1263 visitor->trace(m_audioTracks); 1263 visitor->trace(m_audioTracks);
1264 visitor->trace(m_videoTracks); 1264 visitor->trace(m_videoTracks);
1265 EventTargetWithInlineData::trace(visitor); 1265 EventTargetWithInlineData::trace(visitor);
1266 ActiveDOMObject::trace(visitor); 1266 ActiveDOMObject::trace(visitor);
1267 } 1267 }
1268 1268
1269 } // namespace blink 1269 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/mediasource/SourceBuffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698