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

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

Issue 2034273003: Change WebMediaPlayer::trackId to be the same as byteStreamTrackId (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Buildfixes 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 2335 matching lines...) Expand 10 before | Expand all | Expand 10 after
2346 } 2346 }
2347 2347
2348 AudioTrackList& HTMLMediaElement::audioTracks() 2348 AudioTrackList& HTMLMediaElement::audioTracks()
2349 { 2349 {
2350 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); 2350 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled());
2351 return *m_audioTracks; 2351 return *m_audioTracks;
2352 } 2352 }
2353 2353
2354 void HTMLMediaElement::audioTrackChanged(WebMediaPlayer::TrackId trackId, bool e nabled) 2354 void HTMLMediaElement::audioTrackChanged(WebMediaPlayer::TrackId trackId, bool e nabled)
2355 { 2355 {
2356 DVLOG(MEDIA_LOG_LEVEL) << "audioTrackChanged(" << (void*)this << ") trackId= " << trackId << " enabled=" << boolString(enabled); 2356 DVLOG(MEDIA_LOG_LEVEL) << "audioTrackChanged(" << (void*)this << ") trackId= " << (String)trackId << " enabled=" << boolString(enabled);
2357 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); 2357 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled());
2358 2358
2359 audioTracks().scheduleChangeEvent(); 2359 audioTracks().scheduleChangeEvent();
2360 2360
2361 // FIXME: Add call on m_mediaSource to notify it of track changes once the S ourceBuffer.audioTracks attribute is added. 2361 // FIXME: Add call on m_mediaSource to notify it of track changes once the S ourceBuffer.audioTracks attribute is added.
2362 2362
2363 if (!m_audioTracksTimer.isActive()) 2363 if (!m_audioTracksTimer.isActive())
2364 m_audioTracksTimer.startOneShot(0, BLINK_FROM_HERE); 2364 m_audioTracksTimer.startOneShot(0, BLINK_FROM_HERE);
2365 } 2365 }
2366 2366
2367 void HTMLMediaElement::audioTracksTimerFired(Timer<HTMLMediaElement>*) 2367 void HTMLMediaElement::audioTracksTimerFired(Timer<HTMLMediaElement>*)
2368 { 2368 {
2369 Vector<WebMediaPlayer::TrackId> enabledTrackIds; 2369 Vector<WebMediaPlayer::TrackId> enabledTrackIds;
2370 for (unsigned i = 0; i < audioTracks().length(); ++i) { 2370 for (unsigned i = 0; i < audioTracks().length(); ++i) {
2371 AudioTrack* track = audioTracks().anonymousIndexedGetter(i); 2371 AudioTrack* track = audioTracks().anonymousIndexedGetter(i);
2372 if (track->enabled()) 2372 if (track->enabled())
2373 enabledTrackIds.append(track->trackId()); 2373 enabledTrackIds.append(track->trackId());
2374 } 2374 }
2375 2375
2376 webMediaPlayer()->enabledAudioTracksChanged(enabledTrackIds); 2376 webMediaPlayer()->enabledAudioTracksChanged(enabledTrackIds);
2377 } 2377 }
2378 2378
2379 WebMediaPlayer::TrackId HTMLMediaElement::addAudioTrack(const WebString& id, Web MediaPlayerClient::AudioTrackKind kind, const WebString& label, const WebString& language, bool enabled) 2379 WebMediaPlayer::TrackId HTMLMediaElement::addAudioTrack(const WebString& id, Web MediaPlayerClient::AudioTrackKind kind, const WebString& label, const WebString& language, bool enabled)
2380 { 2380 {
2381 AtomicString kindString = AudioKindToString(kind); 2381 AtomicString kindString = AudioKindToString(kind);
2382 DVLOG(MEDIA_LOG_LEVEL) << "addAudioTrack(" << (void*)this << ", '" << (Strin g)id << "', ' " << (AtomicString)kindString 2382 DVLOG(MEDIA_LOG_LEVEL) << "addAudioTrack(" << (void*)this << ", '" << (Strin g)id << "', ' " << (AtomicString)kindString
2383 << "', '" << (String)label << "', '" << (String)language << "', " << boo lString(enabled) << ")"; 2383 << "', '" << (String)label << "', '" << (String)language << "', " << boo lString(enabled) << ")";
2384 2384
2385 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) 2385 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled())
2386 return 0; 2386 return blink::WebString();
2387 2387
2388 AudioTrack* audioTrack = AudioTrack::create(id, kindString, label, language, enabled); 2388 AudioTrack* audioTrack = AudioTrack::create(id, kindString, label, language, enabled);
2389 audioTracks().add(audioTrack); 2389 audioTracks().add(audioTrack);
2390 2390
2391 return audioTrack->trackId(); 2391 return audioTrack->trackId();
2392 } 2392 }
2393 2393
2394 void HTMLMediaElement::removeAudioTrack(WebMediaPlayer::TrackId trackId) 2394 void HTMLMediaElement::removeAudioTrack(WebMediaPlayer::TrackId trackId)
2395 { 2395 {
2396 DVLOG(MEDIA_LOG_LEVEL) << "removeAudioTrack(" << (void*)this << ")"; 2396 DVLOG(MEDIA_LOG_LEVEL) << "removeAudioTrack(" << (void*)this << ")";
2397 2397
2398 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) 2398 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled())
2399 return; 2399 return;
2400 2400
2401 audioTracks().remove(trackId); 2401 audioTracks().remove(trackId);
2402 } 2402 }
2403 2403
2404 VideoTrackList& HTMLMediaElement::videoTracks() 2404 VideoTrackList& HTMLMediaElement::videoTracks()
2405 { 2405 {
2406 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); 2406 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled());
2407 return *m_videoTracks; 2407 return *m_videoTracks;
2408 } 2408 }
2409 2409
2410 void HTMLMediaElement::selectedVideoTrackChanged(WebMediaPlayer::TrackId* select edTrackId) 2410 void HTMLMediaElement::selectedVideoTrackChanged(WebMediaPlayer::TrackId* select edTrackId)
2411 { 2411 {
2412 DVLOG(MEDIA_LOG_LEVEL) << "selectedVideoTrackChanged(" << (void*)this << ") selectedTrackId=" << (selectedTrackId ? String::format("%u", *selectedTrackId) : "none"); 2412 DVLOG(MEDIA_LOG_LEVEL) << "selectedVideoTrackChanged(" << (void*)this << ") selectedTrackId=" << (selectedTrackId ? ((String)*selectedTrackId) : "none");
2413 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); 2413 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled());
2414 2414
2415 if (selectedTrackId) 2415 if (selectedTrackId)
2416 videoTracks().trackSelected(*selectedTrackId); 2416 videoTracks().trackSelected(*selectedTrackId);
2417 2417
2418 // FIXME: Add call on m_mediaSource to notify it of track changes once the S ourceBuffer.videoTracks attribute is added. 2418 // FIXME: Add call on m_mediaSource to notify it of track changes once the S ourceBuffer.videoTracks attribute is added.
2419 2419
2420 webMediaPlayer()->selectedVideoTrackChanged(selectedTrackId); 2420 webMediaPlayer()->selectedVideoTrackChanged(selectedTrackId);
2421 } 2421 }
2422 2422
2423 WebMediaPlayer::TrackId HTMLMediaElement::addVideoTrack(const WebString& id, Web MediaPlayerClient::VideoTrackKind kind, const WebString& label, const WebString& language, bool selected) 2423 WebMediaPlayer::TrackId HTMLMediaElement::addVideoTrack(const WebString& id, Web MediaPlayerClient::VideoTrackKind kind, const WebString& label, const WebString& language, bool selected)
2424 { 2424 {
2425 AtomicString kindString = VideoKindToString(kind); 2425 AtomicString kindString = VideoKindToString(kind);
2426 DVLOG(MEDIA_LOG_LEVEL) << "addVideoTrack(" << (void*)this << ", '" << (Strin g)id << "', '" << (AtomicString)kindString 2426 DVLOG(MEDIA_LOG_LEVEL) << "addVideoTrack(" << (void*)this << ", '" << (Strin g)id << "', '" << (AtomicString)kindString
2427 << "', '" << (String)label << "', '" << (String)language << "', " << boo lString(selected) << ")"; 2427 << "', '" << (String)label << "', '" << (String)language << "', " << boo lString(selected) << ")";
2428 2428
2429 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) 2429 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled())
2430 return 0; 2430 return blink::WebString();
2431 2431
2432 // If another track was selected (potentially by the user), leave it selecte d. 2432 // If another track was selected (potentially by the user), leave it selecte d.
2433 if (selected && videoTracks().selectedIndex() != -1) 2433 if (selected && videoTracks().selectedIndex() != -1)
2434 selected = false; 2434 selected = false;
2435 2435
2436 VideoTrack* videoTrack = VideoTrack::create(id, kindString, label, language, selected); 2436 VideoTrack* videoTrack = VideoTrack::create(id, kindString, label, language, selected);
2437 videoTracks().add(videoTrack); 2437 videoTracks().add(videoTrack);
2438 2438
2439 return videoTrack->trackId(); 2439 return videoTrack->trackId();
2440 } 2440 }
(...skipping 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after
3881 3881
3882 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst 3882 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst
3883 { 3883 {
3884 IntRect result; 3884 IntRect result;
3885 if (LayoutObject* object = m_element->layoutObject()) 3885 if (LayoutObject* object = m_element->layoutObject())
3886 result = object->absoluteBoundingBoxRect(); 3886 result = object->absoluteBoundingBoxRect();
3887 return result; 3887 return result;
3888 } 3888 }
3889 3889
3890 } // namespace blink 3890 } // namespace blink
OLDNEW
« no previous file with comments | « media/blink/webmediaplayer_impl_unittest.cc ('k') | third_party/WebKit/Source/core/html/track/TrackBase.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698