OLD | NEW |
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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 ASSERT(m_source); | 581 ASSERT(m_source); |
582 ASSERT(m_source->mediaElement()); | 582 ASSERT(m_source->mediaElement()); |
583 ASSERT(m_updating); | 583 ASSERT(m_updating); |
584 | 584 |
585 // TODO(servolk): Implement proper 'initialization segment received' algorit
hm according to MSE spec: | 585 // TODO(servolk): Implement proper 'initialization segment received' algorit
hm according to MSE spec: |
586 // https://w3c.github.io/media-source/#sourcebuffer-init-segment-received | 586 // https://w3c.github.io/media-source/#sourcebuffer-init-segment-received |
587 WebVector<WebMediaPlayer::TrackId> result(newTracks.size()); | 587 WebVector<WebMediaPlayer::TrackId> result(newTracks.size()); |
588 unsigned resultIdx = 0; | 588 unsigned resultIdx = 0; |
589 for (const auto& trackInfo : newTracks) { | 589 for (const auto& trackInfo : newTracks) { |
590 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) { | 590 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) { |
591 static WebMediaPlayer::TrackId nextTrackId = 0; | 591 result[resultIdx++] = ""; |
592 result[resultIdx++] = ++nextTrackId; | |
593 continue; | 592 continue; |
594 } | 593 } |
595 | 594 |
596 const TrackBase* trackBase = nullptr; | 595 const TrackBase* trackBase = nullptr; |
597 if (trackInfo.trackType == WebMediaPlayer::AudioTrack) { | 596 if (trackInfo.trackType == WebMediaPlayer::AudioTrack) { |
598 AudioTrack* audioTrack = nullptr; | 597 AudioTrack* audioTrack = nullptr; |
599 if (!m_firstInitializationSegmentReceived) { | 598 if (!m_firstInitializationSegmentReceived) { |
600 audioTrack = AudioTrack::create(trackInfo.byteStreamTrackId, tra
ckInfo.kind, trackInfo.label, trackInfo.language, false); | 599 audioTrack = AudioTrack::create(trackInfo.byteStreamTrackId, tra
ckInfo.kind, trackInfo.label, trackInfo.language, false); |
601 SourceBufferTrackBaseSupplement::setSourceBuffer(*audioTrack, th
is); | 600 SourceBufferTrackBaseSupplement::setSourceBuffer(*audioTrack, th
is); |
602 audioTracks().add(audioTrack); | 601 audioTracks().add(audioTrack); |
(...skipping 15 matching lines...) Expand all Loading... |
618 videoTrack = findExistingTrackById(videoTracks(), trackInfo.byte
StreamTrackId); | 617 videoTrack = findExistingTrackById(videoTracks(), trackInfo.byte
StreamTrackId); |
619 ASSERT(videoTrack); | 618 ASSERT(videoTrack); |
620 } | 619 } |
621 trackBase = videoTrack; | 620 trackBase = videoTrack; |
622 result[resultIdx++] = videoTrack->trackId(); | 621 result[resultIdx++] = videoTrack->trackId(); |
623 } else { | 622 } else { |
624 NOTREACHED(); | 623 NOTREACHED(); |
625 } | 624 } |
626 (void)trackBase; | 625 (void)trackBase; |
627 #if !LOG_DISABLED | 626 #if !LOG_DISABLED |
628 const char* logActionStr = m_firstInitializationSegmentReceived ? "using
existing" : "added"; | 627 // TODO(servolk): WTF_LOG is deprecated, replace with DVLOG. |
629 const char* logTrackTypeStr = (trackInfo.trackType == WebMediaPlayer::Au
dioTrack) ? "audio" : "video"; | 628 // const char* logActionStr = m_firstInitializationSegmentReceived ? "us
ing existing" : "added"; |
630 WTF_LOG(Media, "Tracks (sb=%p): %s %sTrack %p trackId=%d id=%s label=%s
lang=%s", this, logActionStr, logTrackTypeStr, trackBase, trackBase->trackId(),
trackBase->id().utf8().data(), trackBase->label().utf8().data(), trackBase->lang
uage().utf8().data()); | 629 // const char* logTrackTypeStr = (trackInfo.trackType == WebMediaPlayer:
:AudioTrack) ? "audio" : "video"; |
| 630 // WTF_LOG(Media, "Tracks (sb=%p): %s %sTrack %p id=%s label=%s lang=%s"
, this, logActionStr, logTrackTypeStr, trackBase, trackBase->id().utf8().data(),
trackBase->label().utf8().data(), trackBase->language().utf8().data()); |
631 #endif | 631 #endif |
632 } | 632 } |
633 | 633 |
634 if (!m_firstInitializationSegmentReceived) { | 634 if (!m_firstInitializationSegmentReceived) { |
635 // 5. If active track flag equals true, then run the following steps: | 635 // 5. If active track flag equals true, then run the following steps: |
636 // 5.1. Add this SourceBuffer to activeSourceBuffers. | 636 // 5.1. Add this SourceBuffer to activeSourceBuffers. |
637 // 5.2. Queue a task to fire a simple event named addsourcebuffer at | 637 // 5.2. Queue a task to fire a simple event named addsourcebuffer at |
638 // activesourcebuffers. | 638 // activesourcebuffers. |
639 m_source->setSourceBufferActive(this); | 639 m_source->setSourceBufferActive(this); |
640 | 640 |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1023 visitor->trace(m_removeAsyncPartRunner); | 1023 visitor->trace(m_removeAsyncPartRunner); |
1024 visitor->trace(m_appendStreamAsyncPartRunner); | 1024 visitor->trace(m_appendStreamAsyncPartRunner); |
1025 visitor->trace(m_stream); | 1025 visitor->trace(m_stream); |
1026 visitor->trace(m_audioTracks); | 1026 visitor->trace(m_audioTracks); |
1027 visitor->trace(m_videoTracks); | 1027 visitor->trace(m_videoTracks); |
1028 EventTargetWithInlineData::trace(visitor); | 1028 EventTargetWithInlineData::trace(visitor); |
1029 ActiveDOMObject::trace(visitor); | 1029 ActiveDOMObject::trace(visitor); |
1030 } | 1030 } |
1031 | 1031 |
1032 } // namespace blink | 1032 } // namespace blink |
OLD | NEW |