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

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

Issue 2263823002: Deliver change notifications to SourceBuffer track lists. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed video-track-selected test Created 4 years, 4 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 21 matching lines...) Expand all
32 32
33 #include "bindings/core/v8/ExceptionMessages.h" 33 #include "bindings/core/v8/ExceptionMessages.h"
34 #include "bindings/core/v8/ExceptionState.h" 34 #include "bindings/core/v8/ExceptionState.h"
35 #include "bindings/core/v8/ExceptionStatePlaceholder.h" 35 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
36 #include "core/dom/ExceptionCode.h" 36 #include "core/dom/ExceptionCode.h"
37 #include "core/events/Event.h" 37 #include "core/events/Event.h"
38 #include "core/events/GenericEventQueue.h" 38 #include "core/events/GenericEventQueue.h"
39 #include "core/frame/Deprecation.h" 39 #include "core/frame/Deprecation.h"
40 #include "core/frame/UseCounter.h" 40 #include "core/frame/UseCounter.h"
41 #include "core/html/HTMLMediaElement.h" 41 #include "core/html/HTMLMediaElement.h"
42 #include "core/html/track/AudioTrackList.h"
43 #include "core/html/track/VideoTrackList.h"
42 #include "modules/mediasource/MediaSourceRegistry.h" 44 #include "modules/mediasource/MediaSourceRegistry.h"
45 #include "modules/mediasource/SourceBufferTrackBaseSupplement.h"
43 #include "platform/ContentType.h" 46 #include "platform/ContentType.h"
44 #include "platform/MIMETypeRegistry.h" 47 #include "platform/MIMETypeRegistry.h"
45 #include "platform/RuntimeEnabledFeatures.h" 48 #include "platform/RuntimeEnabledFeatures.h"
46 #include "platform/TraceEvent.h" 49 #include "platform/TraceEvent.h"
47 #include "public/platform/WebMediaSource.h" 50 #include "public/platform/WebMediaSource.h"
48 #include "public/platform/WebSourceBuffer.h" 51 #include "public/platform/WebSourceBuffer.h"
49 #include "wtf/PtrUtil.h" 52 #include "wtf/PtrUtil.h"
50 #include "wtf/text/CString.h" 53 #include "wtf/text/CString.h"
51 #include <memory> 54 #include <memory>
52 55
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 412
410 // 3. Return a single range with a start time of 0 and an end time equal to the highest end 413 // 3. Return a single range with a start time of 0 and an end time equal to the highest end
411 // time reported by the HTMLMediaElement.buffered attribute. 414 // time reported by the HTMLMediaElement.buffered attribute.
412 return TimeRanges::create(0, buffered->end(buffered->length() - 1, ASSER T_NO_EXCEPTION)); 415 return TimeRanges::create(0, buffered->end(buffered->length() - 1, ASSER T_NO_EXCEPTION));
413 } 416 }
414 417
415 // 3. Otherwise: Return a single range with a start time of 0 and an end tim e equal to duration. 418 // 3. Otherwise: Return a single range with a start time of 0 and an end tim e equal to duration.
416 return TimeRanges::create(0, sourceDuration); 419 return TimeRanges::create(0, sourceDuration);
417 } 420 }
418 421
422 void MediaSource::onTrackChanged(TrackBase* track)
423 {
424 SourceBuffer* sourceBuffer = SourceBufferTrackBaseSupplement::sourceBuffer(* track);
425 if (sourceBuffer) {
426 if (track->type() == WebMediaPlayer::AudioTrack) {
427 sourceBuffer->audioTracks().scheduleChangeEvent();
428 } else if (track->type() == WebMediaPlayer::VideoTrack) {
429 sourceBuffer->videoTracks().scheduleChangeEvent();
430 }
431 }
432 }
433
419 void MediaSource::setDuration(double duration, ExceptionState& exceptionState) 434 void MediaSource::setDuration(double duration, ExceptionState& exceptionState)
420 { 435 {
421 // 2.1 http://www.w3.org/TR/media-source/#widl-MediaSource-duration 436 // 2.1 http://www.w3.org/TR/media-source/#widl-MediaSource-duration
422 // 1. If the value being set is negative or NaN then throw an InvalidAccessE rror 437 // 1. If the value being set is negative or NaN then throw an InvalidAccessE rror
423 // exception and abort these steps. 438 // exception and abort these steps.
424 if (std::isnan(duration)) { 439 if (std::isnan(duration)) {
425 logAndThrowDOMException(exceptionState, InvalidAccessError, ExceptionMes sages::notAFiniteNumber(duration, "duration")); 440 logAndThrowDOMException(exceptionState, InvalidAccessError, ExceptionMes sages::notAFiniteNumber(duration, "duration"));
426 return; 441 return;
427 } 442 }
428 if (duration < 0.0) { 443 if (duration < 0.0) {
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 726
712 m_asyncEventQueue->enqueueEvent(event); 727 m_asyncEventQueue->enqueueEvent(event);
713 } 728 }
714 729
715 URLRegistry& MediaSource::registry() const 730 URLRegistry& MediaSource::registry() const
716 { 731 {
717 return MediaSourceRegistry::registry(); 732 return MediaSourceRegistry::registry();
718 } 733 }
719 734
720 } // namespace blink 735 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698