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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp

Issue 2050043002: Generate and assign media track ids in demuxers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@use-streamparser-trackid
Patch Set: Created 4 years, 6 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) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 2345 matching lines...) Expand 10 before | Expand all | Expand 10 after
2356 } 2356 }
2357 2357
2358 AudioTrackList& HTMLMediaElement::audioTracks() 2358 AudioTrackList& HTMLMediaElement::audioTracks()
2359 { 2359 {
2360 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); 2360 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled());
2361 return *m_audioTracks; 2361 return *m_audioTracks;
2362 } 2362 }
2363 2363
2364 void HTMLMediaElement::audioTrackChanged(WebMediaPlayer::TrackId trackId, bool e nabled) 2364 void HTMLMediaElement::audioTrackChanged(WebMediaPlayer::TrackId trackId, bool e nabled)
2365 { 2365 {
2366 DVLOG(MEDIA_LOG_LEVEL) << "audioTrackChanged(" << (void*)this << ") trackId= " << trackId << " enabled=" << boolString(enabled); 2366 DVLOG(MEDIA_LOG_LEVEL) << "audioTrackChanged(" << (void*)this << ") trackId= " << (String)trackId << " enabled=" << boolString(enabled);
2367 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); 2367 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled());
2368 2368
2369 audioTracks().scheduleChangeEvent(); 2369 audioTracks().scheduleChangeEvent();
2370 2370
2371 // FIXME: Add call on m_mediaSource to notify it of track changes once the S ourceBuffer.audioTracks attribute is added. 2371 // FIXME: Add call on m_mediaSource to notify it of track changes once the S ourceBuffer.audioTracks attribute is added.
2372 2372
2373 if (!m_audioTracksTimer.isActive()) 2373 if (!m_audioTracksTimer.isActive())
2374 m_audioTracksTimer.startOneShot(0, BLINK_FROM_HERE); 2374 m_audioTracksTimer.startOneShot(0, BLINK_FROM_HERE);
2375 } 2375 }
2376 2376
2377 void HTMLMediaElement::audioTracksTimerFired(Timer<HTMLMediaElement>*) 2377 void HTMLMediaElement::audioTracksTimerFired(Timer<HTMLMediaElement>*)
2378 { 2378 {
2379 Vector<WebMediaPlayer::TrackId> enabledTrackIds; 2379 Vector<WebMediaPlayer::TrackId> enabledTrackIds;
2380 for (unsigned i = 0; i < audioTracks().length(); ++i) { 2380 for (unsigned i = 0; i < audioTracks().length(); ++i) {
2381 AudioTrack* track = audioTracks().anonymousIndexedGetter(i); 2381 AudioTrack* track = audioTracks().anonymousIndexedGetter(i);
2382 if (track->enabled()) 2382 if (track->enabled())
2383 enabledTrackIds.append(track->trackId()); 2383 enabledTrackIds.append(track->trackId());
2384 } 2384 }
2385 2385
2386 webMediaPlayer()->enabledAudioTracksChanged(enabledTrackIds); 2386 webMediaPlayer()->enabledAudioTracksChanged(enabledTrackIds);
2387 } 2387 }
2388 2388
2389 WebMediaPlayer::TrackId HTMLMediaElement::addAudioTrack(const WebString& id, Web MediaPlayerClient::AudioTrackKind kind, const WebString& label, const WebString& language, bool enabled) 2389 WebMediaPlayer::TrackId HTMLMediaElement::addAudioTrack(const WebString& id, Web MediaPlayerClient::AudioTrackKind kind, const WebString& label, const WebString& language, bool enabled)
2390 { 2390 {
2391 AtomicString kindString = AudioKindToString(kind); 2391 AtomicString kindString = AudioKindToString(kind);
2392 DVLOG(MEDIA_LOG_LEVEL) << "addAudioTrack(" << (void*)this << ", '" << (Strin g)id << "', ' " << (AtomicString)kindString 2392 DVLOG(MEDIA_LOG_LEVEL) << "addAudioTrack(" << (void*)this << ", '" << (Strin g)id << "', ' " << (AtomicString)kindString
2393 << "', '" << (String)label << "', '" << (String)language << "', " << boo lString(enabled) << ")"; 2393 << "', '" << (String)label << "', '" << (String)language << "', " << boo lString(enabled) << ")";
2394 2394
2395 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) 2395 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled())
2396 return 0; 2396 return blink::WebString();
2397 2397
2398 AudioTrack* audioTrack = AudioTrack::create(id, kindString, label, language, enabled); 2398 AudioTrack* audioTrack = AudioTrack::create(id, kindString, label, language, enabled);
2399 audioTracks().add(audioTrack); 2399 audioTracks().add(audioTrack);
2400 2400
2401 return audioTrack->trackId(); 2401 return audioTrack->trackId();
2402 } 2402 }
2403 2403
2404 void HTMLMediaElement::removeAudioTrack(WebMediaPlayer::TrackId trackId) 2404 void HTMLMediaElement::removeAudioTrack(WebMediaPlayer::TrackId trackId)
2405 { 2405 {
2406 DVLOG(MEDIA_LOG_LEVEL) << "removeAudioTrack(" << (void*)this << ")"; 2406 DVLOG(MEDIA_LOG_LEVEL) << "removeAudioTrack(" << (void*)this << ")";
2407 2407
2408 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) 2408 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled())
2409 return; 2409 return;
2410 2410
2411 audioTracks().remove(trackId); 2411 audioTracks().remove(trackId);
2412 } 2412 }
2413 2413
2414 VideoTrackList& HTMLMediaElement::videoTracks() 2414 VideoTrackList& HTMLMediaElement::videoTracks()
2415 { 2415 {
2416 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); 2416 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled());
2417 return *m_videoTracks; 2417 return *m_videoTracks;
2418 } 2418 }
2419 2419
2420 void HTMLMediaElement::selectedVideoTrackChanged(WebMediaPlayer::TrackId* select edTrackId) 2420 void HTMLMediaElement::selectedVideoTrackChanged(WebMediaPlayer::TrackId* select edTrackId)
2421 { 2421 {
2422 DVLOG(MEDIA_LOG_LEVEL) << "selectedVideoTrackChanged(" << (void*)this << ") selectedTrackId=" << (selectedTrackId ? String::format("%u", *selectedTrackId) : "none"); 2422 DVLOG(MEDIA_LOG_LEVEL) << "selectedVideoTrackChanged(" << (void*)this << ") selectedTrackId=" << (selectedTrackId ? ((String)*selectedTrackId) : "none");
2423 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); 2423 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled());
2424 2424
2425 if (selectedTrackId) 2425 if (selectedTrackId)
2426 videoTracks().trackSelected(*selectedTrackId); 2426 videoTracks().trackSelected(*selectedTrackId);
2427 2427
2428 // FIXME: Add call on m_mediaSource to notify it of track changes once the S ourceBuffer.videoTracks attribute is added. 2428 // FIXME: Add call on m_mediaSource to notify it of track changes once the S ourceBuffer.videoTracks attribute is added.
2429 2429
2430 webMediaPlayer()->selectedVideoTrackChanged(selectedTrackId); 2430 webMediaPlayer()->selectedVideoTrackChanged(selectedTrackId);
2431 } 2431 }
2432 2432
2433 WebMediaPlayer::TrackId HTMLMediaElement::addVideoTrack(const WebString& id, Web MediaPlayerClient::VideoTrackKind kind, const WebString& label, const WebString& language, bool selected) 2433 WebMediaPlayer::TrackId HTMLMediaElement::addVideoTrack(const WebString& id, Web MediaPlayerClient::VideoTrackKind kind, const WebString& label, const WebString& language, bool selected)
2434 { 2434 {
2435 AtomicString kindString = VideoKindToString(kind); 2435 AtomicString kindString = VideoKindToString(kind);
2436 DVLOG(MEDIA_LOG_LEVEL) << "addVideoTrack(" << (void*)this << ", '" << (Strin g)id << "', '" << (AtomicString)kindString 2436 DVLOG(MEDIA_LOG_LEVEL) << "addVideoTrack(" << (void*)this << ", '" << (Strin g)id << "', '" << (AtomicString)kindString
2437 << "', '" << (String)label << "', '" << (String)language << "', " << boo lString(selected) << ")"; 2437 << "', '" << (String)label << "', '" << (String)language << "', " << boo lString(selected) << ")";
2438 2438
2439 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) 2439 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled())
2440 return 0; 2440 return blink::WebString();
2441 2441
2442 // If another track was selected (potentially by the user), leave it selecte d. 2442 // If another track was selected (potentially by the user), leave it selecte d.
2443 if (selected && videoTracks().selectedIndex() != -1) 2443 if (selected && videoTracks().selectedIndex() != -1)
2444 selected = false; 2444 selected = false;
2445 2445
2446 VideoTrack* videoTrack = VideoTrack::create(id, kindString, label, language, selected); 2446 VideoTrack* videoTrack = VideoTrack::create(id, kindString, label, language, selected);
2447 videoTracks().add(videoTrack); 2447 videoTracks().add(videoTrack);
2448 2448
2449 return videoTrack->trackId(); 2449 return videoTrack->trackId();
2450 } 2450 }
(...skipping 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after
3918 3918
3919 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst 3919 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst
3920 { 3920 {
3921 IntRect result; 3921 IntRect result;
3922 if (LayoutObject* object = m_element->layoutObject()) 3922 if (LayoutObject* object = m_element->layoutObject())
3923 result = object->absoluteBoundingBoxRect(); 3923 result = object->absoluteBoundingBoxRect();
3924 return result; 3924 return result;
3925 } 3925 }
3926 3926
3927 } // namespace blink 3927 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698