Changeset 252938 in webkit
- Timestamp:
- Nov 29, 2019 3:11:00 AM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r252937 r252938 1 2019-11-29 Philippe Normand <pnormand@igalia.com> 2 3 Unreviewed, rolling out r252937. 4 5 broke GTK/WPE builds and most likely media track notification 6 support 7 8 Reverted changeset: 9 10 "[GStreamer] MediaPlayerPrivateGStreamer style cleanups" 11 https://bugs.webkit.org/show_bug.cgi?id=204617 12 https://trac.webkit.org/changeset/252937 13 1 14 2019-11-29 Charlie Turner <cturner@igalia.com> 2 15 -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
r252937 r252938 337 337 #endif 338 338 339 static void initializeDebugCategory() 340 { 341 static std::once_flag onceFlag; 342 std::call_once(onceFlag, [] { 343 GST_DEBUG_CATEGORY_INIT(webkit_media_player_debug, "webkitmediaplayer", 0, "WebKit media player"); 344 }); 339 void MediaPlayerPrivateGStreamer::initializeDebugCategory() 340 { 341 GST_DEBUG_CATEGORY_INIT(webkit_media_player_debug, "webkitmediaplayer", 0, "WebKit media player"); 345 342 } 346 343 … … 501 498 if (m_preload == MediaPlayer::None) { 502 499 GST_INFO_OBJECT(pipeline(), "Delaying load."); 503 m_ isDelayingLoad = true;500 m_delayingLoad = true; 504 501 } 505 502 … … 510 507 m_readyState = MediaPlayer::HaveNothing; 511 508 m_player->readyStateChanged(); 512 m_ areVolumeAndMuteInitialized = false;509 m_volumeAndMuteInitialized = false; 513 510 m_hasTaintedOrigin = WTF::nullopt; 514 511 515 if (!m_ isDelayingLoad)512 if (!m_delayingLoad) 516 513 commitLoad(); 517 514 } … … 545 542 #endif 546 543 544 void MediaPlayerPrivateGStreamer::commitLoad() 545 { 546 ASSERT(!m_delayingLoad); 547 GST_DEBUG_OBJECT(pipeline(), "Committing load."); 548 549 // GStreamer needs to have the pipeline set to a paused state to 550 // start providing anything useful. 551 changePipelineState(GST_STATE_PAUSED); 552 553 updateDownloadBufferingFlag(); 554 updateStates(); 555 } 556 547 557 void MediaPlayerPrivateGStreamer::cancelLoad() 548 558 { … … 558 568 GST_DEBUG_OBJECT(pipeline(), "Prepare to play"); 559 569 m_preload = MediaPlayer::Auto; 560 if (m_ isDelayingLoad) {561 m_ isDelayingLoad = false;570 if (m_delayingLoad) { 571 m_delayingLoad = false; 562 572 commitLoad(); 563 573 } … … 567 577 { 568 578 if (!m_playbackRate) { 569 m_ isPlaybackRatePaused= true;579 m_playbackRatePause = true; 570 580 return; 571 581 } … … 573 583 if (changePipelineState(GST_STATE_PLAYING)) { 574 584 m_isEndReached = false; 575 m_ isDelayingLoad = false;585 m_delayingLoad = false; 576 586 m_preload = MediaPlayer::Auto; 577 587 updateDownloadBufferingFlag(); … … 583 593 void MediaPlayerPrivateGStreamer::pause() 584 594 { 585 m_ isPlaybackRatePaused= false;595 m_playbackRatePause = false; 586 596 GstState currentState, pendingState; 587 597 gst_element_get_state(m_pipeline.get(), ¤tState, &pendingState, 0); … … 605 615 } 606 616 607 if (m_ isPlaybackRatePaused) {617 if (m_playbackRatePause) { 608 618 GST_DEBUG_OBJECT(pipeline(), "Playback rate is 0, simulating PAUSED state"); 609 619 return false; … … 624 634 if (rate < 0) { 625 635 startTime = MediaTime::zeroTime(); 626 // If we are at beginning of media, start from the end to avoid immediate EOS. 627 endTime = position < MediaTime::zeroTime() ? durationMediaTime() : position; 636 // If we are at beginning of media, start from the end to 637 // avoid immediate EOS. 638 if (position < MediaTime::zeroTime()) 639 endTime = durationMediaTime(); 640 else 641 endTime = position; 628 642 } 629 643 … … 637 651 void MediaPlayerPrivateGStreamer::seek(const MediaTime& mediaTime) 638 652 { 639 if (!m_pipeline || m_didErrorOccur) 653 if (!m_pipeline) 654 return; 655 656 if (m_errorOccured) 640 657 return; 641 658 … … 650 667 MediaTime time = std::min(mediaTime, durationMediaTime()); 651 668 652 if ( m_isLiveStream) {669 if (isLiveStream()) { 653 670 GST_DEBUG_OBJECT(pipeline(), "[Seek] Live stream seek unhandled"); 654 671 return; … … 657 674 GST_INFO_OBJECT(pipeline(), "[Seek] seeking to %s", toString(time).utf8().data()); 658 675 659 if (m_ isSeeking) {676 if (m_seeking) { 660 677 m_timeOfOverlappingSeek = time; 661 if (m_ isSeekPending) {678 if (m_seekIsPending) { 662 679 m_seekTime = time; 663 680 return; … … 672 689 } 673 690 if (getStateResult == GST_STATE_CHANGE_ASYNC || state < GST_STATE_PAUSED || m_isEndReached) { 674 m_ isSeekPending = true;691 m_seekIsPending = true; 675 692 if (m_isEndReached) { 676 693 GST_DEBUG_OBJECT(pipeline(), "[Seek] reset pipeline"); 677 m_ shouldResetPipeline = true;694 m_resetPipeline = true; 678 695 if (!changePipelineState(GST_STATE_PAUSED)) 679 696 loadingFailed(MediaPlayer::Empty); … … 687 704 } 688 705 689 m_ isSeeking = true;706 m_seeking = true; 690 707 m_seekTime = time; 691 708 m_isEndReached = false; … … 694 711 void MediaPlayerPrivateGStreamer::updatePlaybackRate() 695 712 { 696 if (!m_ isChangingRate)713 if (!m_changingRate) 697 714 return; 698 715 … … 700 717 701 718 // Mute the sound if the playback rate is negative or too extreme and audio pitch is not adjusted. 702 bool mute = m_playbackRate <= 0 || (!m_ shouldPreservePitch && (m_playbackRate < 0.8 || m_playbackRate > 2));719 bool mute = m_playbackRate <= 0 || (!m_preservesPitch && (m_playbackRate < 0.8 || m_playbackRate > 2)); 703 720 704 721 GST_INFO_OBJECT(pipeline(), mute ? "Need to mute audio" : "Do not need to mute audio"); … … 712 729 } 713 730 714 if (m_isPlaybackRatePaused) { 715 GstState state, pending; 731 if (m_playbackRatePause) { 732 GstState state; 733 GstState pending; 716 734 717 735 gst_element_get_state(m_pipeline.get(), &state, &pending, 0); 718 736 if (state != GST_STATE_PLAYING && pending != GST_STATE_PLAYING) 719 737 changePipelineState(GST_STATE_PLAYING); 720 m_ isPlaybackRatePaused= false;721 } 722 723 m_ isChangingRate = false;738 m_playbackRatePause = false; 739 } 740 741 m_changingRate = false; 724 742 m_player->rateChanged(); 743 } 744 745 MediaTime MediaPlayerPrivateGStreamer::platformDuration() const 746 { 747 if (!m_pipeline) 748 return MediaTime::invalidTime(); 749 750 GST_TRACE_OBJECT(pipeline(), "errorOccured: %s, pipeline state: %s", boolForPrinting(m_errorOccured), gst_element_state_get_name(GST_STATE(m_pipeline.get()))); 751 if (m_errorOccured) 752 return MediaTime::invalidTime(); 753 754 // The duration query would fail on a not-prerolled pipeline. 755 if (GST_STATE(m_pipeline.get()) < GST_STATE_PAUSED) 756 return MediaTime::invalidTime(); 757 758 int64_t duration = 0; 759 if (!gst_element_query_duration(m_pipeline.get(), GST_FORMAT_TIME, &duration) || !GST_CLOCK_TIME_IS_VALID(duration)) { 760 GST_DEBUG_OBJECT(pipeline(), "Time duration query failed for %s", m_url.string().utf8().data()); 761 return MediaTime::positiveInfiniteTime(); 762 } 763 764 GST_LOG_OBJECT(pipeline(), "Duration: %" GST_TIME_FORMAT, GST_TIME_ARGS(duration)); 765 return MediaTime(duration, GST_SECOND); 725 766 } 726 767 … … 742 783 MediaTime MediaPlayerPrivateGStreamer::currentMediaTime() const 743 784 { 744 if (!m_pipeline || m_ didErrorOccur)785 if (!m_pipeline || m_errorOccured) 745 786 return MediaTime::invalidTime(); 746 787 747 GST_TRACE_OBJECT(pipeline(), "seeking: %s, seekTime: %s", boolForPrinting(m_ isSeeking), m_seekTime.toString().utf8().data());748 if (m_ isSeeking)788 GST_TRACE_OBJECT(pipeline(), "seeking: %s, seekTime: %s", boolForPrinting(m_seeking), m_seekTime.toString().utf8().data()); 789 if (m_seeking) 749 790 return m_seekTime; 750 791 … … 754 795 void MediaPlayerPrivateGStreamer::setRate(float rate) 755 796 { 756 float rateClamped = clampTo(rate, -20.0, 20.0); 757 if (rateClamped != rate) 758 GST_WARNING("Clamping original rate (%f) to [-20, 20] (%f), higher rates cause crashes", rate, rateClamped); 797 // Higher rate causes crash. 798 rate = clampTo(rate, -20.0, 20.0); 759 799 760 800 // Avoid useless playback rate update. 761 if (m_playbackRate == rate Clamped) {762 // And make sure that upper layers were notified if rate was set.763 764 if (!m_ isChangingRate && m_player->rate() != m_playbackRate)801 if (m_playbackRate == rate) { 802 // and make sure that upper layers were notified if rate was set 803 804 if (!m_changingRate && m_player->rate() != m_playbackRate) 765 805 m_player->rateChanged(); 766 806 return; 767 807 } 768 808 769 if ( m_isLiveStream) {770 // Notify upper layers that we cannot handle passed rate.771 m_ isChangingRate = false;809 if (isLiveStream()) { 810 // notify upper layers that we cannot handle passed rate. 811 m_changingRate = false; 772 812 m_player->rateChanged(); 773 813 return; 774 814 } 775 815 776 GstState state, pending; 777 778 m_playbackRate = rateClamped; 779 m_isChangingRate = true; 816 GstState state; 817 GstState pending; 818 819 m_playbackRate = rate; 820 m_changingRate = true; 780 821 781 822 gst_element_get_state(m_pipeline.get(), &state, &pending, 0); 782 823 783 if (!rate Clamped) {784 m_ isChangingRate = false;785 m_ isPlaybackRatePaused= true;824 if (!rate) { 825 m_changingRate = false; 826 m_playbackRatePause = true; 786 827 if (state != GST_STATE_PAUSED && pending != GST_STATE_PAUSED) 787 828 changePipelineState(GST_STATE_PAUSED); … … 803 844 void MediaPlayerPrivateGStreamer::setPreservesPitch(bool preservesPitch) 804 845 { 805 m_ shouldPreservePitch = preservesPitch;846 m_preservesPitch = preservesPitch; 806 847 } 807 848 … … 809 850 { 810 851 GST_DEBUG_OBJECT(pipeline(), "Setting preload to %s", convertEnumerationToString(preload).utf8().data()); 811 if (preload == MediaPlayer::Auto && m_isLiveStream)852 if (preload == MediaPlayer::Auto && isLiveStream()) 812 853 return; 813 854 … … 815 856 updateDownloadBufferingFlag(); 816 857 817 if (m_ isDelayingLoad && m_preload != MediaPlayer::None) {818 m_ isDelayingLoad = false;858 if (m_delayingLoad && m_preload != MediaPlayer::None) { 859 m_delayingLoad = false; 819 860 commitLoad(); 820 861 } … … 824 865 { 825 866 auto timeRanges = makeUnique<PlatformTimeRanges>(); 826 if (m_ didErrorOccur || m_isLiveStream)867 if (m_errorOccured || isLiveStream()) 827 868 return timeRanges; 828 869 … … 836 877 return timeRanges; 837 878 838 unsignednumBufferingRanges = gst_query_get_n_buffering_ranges(query.get());839 for ( unsignedindex = 0; index < numBufferingRanges; index++) {879 guint numBufferingRanges = gst_query_get_n_buffering_ranges(query.get()); 880 for (guint index = 0; index < numBufferingRanges; index++) { 840 881 gint64 rangeStart = 0, rangeStop = 0; 841 882 if (gst_query_parse_nth_buffering_range(query.get(), index, &rangeStart, &rangeStop)) { … … 846 887 } 847 888 848 // Fallback to the more general maxTimeLoaded() if no range has been found. 889 // Fallback to the more general maxTimeLoaded() if no range has 890 // been found. 849 891 if (!timeRanges->length()) { 850 892 MediaTime loaded = maxTimeLoaded(); … … 858 900 MediaTime MediaPlayerPrivateGStreamer::maxMediaTimeSeekable() const 859 901 { 860 GST_TRACE_OBJECT(pipeline(), "errorOccured: %s, isLiveStream: %s", boolForPrinting(m_ didErrorOccur), boolForPrinting(m_isLiveStream));861 if (m_ didErrorOccur)902 GST_TRACE_OBJECT(pipeline(), "errorOccured: %s, isLiveStream: %s", boolForPrinting(m_errorOccured), boolForPrinting(isLiveStream())); 903 if (m_errorOccured) 862 904 return MediaTime::zeroTime(); 863 905 864 if ( m_isLiveStream)906 if (isLiveStream()) 865 907 return MediaTime::zeroTime(); 866 908 867 909 MediaTime duration = durationMediaTime(); 868 910 GST_DEBUG_OBJECT(pipeline(), "maxMediaTimeSeekable, duration: %s", toString(duration).utf8().data()); 869 // Infinite duration means live stream.911 // infinite duration means live stream 870 912 if (duration.isPositiveInfinite()) 871 913 return MediaTime::zeroTime(); … … 876 918 MediaTime MediaPlayerPrivateGStreamer::maxTimeLoaded() const 877 919 { 878 if (m_ didErrorOccur)920 if (m_errorOccured) 879 921 return MediaTime::zeroTime(); 880 922 … … 888 930 bool MediaPlayerPrivateGStreamer::didLoadingProgress() const 889 931 { 890 if (m_ didErrorOccur|| m_loadingStalled)932 if (m_errorOccured || m_loadingStalled) 891 933 return false; 892 934 … … 911 953 unsigned long long MediaPlayerPrivateGStreamer::totalBytes() const 912 954 { 913 if (m_ didErrorOccur || !m_source || m_isLiveStream)955 if (m_errorOccured) 914 956 return 0; 915 957 916 958 if (m_totalBytes) 917 959 return m_totalBytes; 960 961 if (!m_source) 962 return 0; 963 964 if (isLiveStream()) 965 return 0; 918 966 919 967 GstFormat fmt = GST_FORMAT_BYTES; … … 922 970 GST_INFO_OBJECT(pipeline(), "totalBytes %" G_GINT64_FORMAT, length); 923 971 m_totalBytes = static_cast<unsigned long long>(length); 924 m_is LiveStream= !length;972 m_isStreaming = !length; 925 973 return m_totalBytes; 926 974 } 927 975 928 // Fall back to querying the source pads manually. See also https://bugzilla.gnome.org/show_bug.cgi?id=638749 976 // Fall back to querying the source pads manually. 977 // See also https://bugzilla.gnome.org/show_bug.cgi?id=638749 929 978 GstIterator* iter = gst_element_iterate_src_pads(m_source.get()); 930 979 bool done = false; … … 956 1005 GST_INFO_OBJECT(pipeline(), "totalBytes %" G_GINT64_FORMAT, length); 957 1006 m_totalBytes = static_cast<unsigned long long>(length); 958 m_is LiveStream= !length;1007 m_isStreaming = !length; 959 1008 return m_totalBytes; 960 1009 } … … 1081 1130 ASSERT(m_pipeline); 1082 1131 1083 GstState currentState, pending; 1132 GstState currentState; 1133 GstState pending; 1084 1134 1085 1135 gst_element_get_state(m_pipeline.get(), ¤tState, &pending, 0); … … 1098 1148 return false; 1099 1149 1100 // Create a timer when entering the READY state so that we can free resources if we stay for too long on READY. 1101 // Also lets remove the timer if we request a state change for any state other than READY. See also https://bugs.webkit.org/show_bug.cgi?id=117354 1150 // Create a timer when entering the READY state so that we can free resources 1151 // if we stay for too long on READY. 1152 // Also lets remove the timer if we request a state change for any state other than READY. 1153 // See also https://bugs.webkit.org/show_bug.cgi?id=117354 1102 1154 if (newState == GST_STATE_READY && !m_readyTimerHandler.isActive()) { 1103 // Max interval in seconds to stay in the READY state on manual state change requests. 1155 // Max interval in seconds to stay in the READY state on manual 1156 // state change requests. 1104 1157 static const Seconds readyStateTimerDelay { 1_min }; 1105 1158 m_readyTimerHandler.startOneShot(readyStateTimerDelay); … … 1145 1198 } 1146 1199 1147 enum MediaType { 1148 Video, Audio, Text 1149 }; 1150 void MediaPlayerPrivateGStreamer::notifyPlayerOf(MediaType mediaType) 1200 void MediaPlayerPrivateGStreamer::notifyPlayerOfVideo() 1151 1201 { 1152 1202 if (UNLIKELY(!m_pipeline || !m_source)) … … 1155 1205 ASSERT(m_isLegacyPlaybin || isMediaSource()); 1156 1206 1157 const char *mediaType; 1158 const char *sourceType; 1159 switch (mediaType) { 1160 case MediaType::Video: 1161 mediaType = "video"; 1162 sourceType = "n-video"; 1163 break; 1164 case MediaType::Audio: 1165 mediaType = "audio"; 1166 sourceType = "n-audio"; 1167 break; 1168 case MediaType::Text: 1169 mediaType = "text"; 1170 sourceType = "n-text"; 1171 break; 1172 } 1173 1174 unsigned numTracks = 0; 1207 gint numTracks = 0; 1175 1208 bool useMediaSource = isMediaSource(); 1176 1209 GstElement* element = useMediaSource ? m_source.get() : m_pipeline.get(); 1177 g_object_get(element, sourceType, &numTracks, nullptr);1210 g_object_get(element, "n-video", &numTracks, nullptr); 1178 1211 1179 1212 GST_INFO_OBJECT(pipeline(), "Media has %d video tracks", numTracks); … … 1195 1228 #if ENABLE(VIDEO_TRACK) 1196 1229 Vector<String> validVideoStreams; 1197 for ( unsignedi = 0; i < numTracks; ++i) {1230 for (gint i = 0; i < numTracks; ++i) { 1198 1231 GRefPtr<GstPad> pad; 1199 1232 g_signal_emit_by_name(m_pipeline.get(), "get-video-pad", i, &pad.outPtr(), nullptr); … … 1202 1235 String streamId = "V" + String::number(i); 1203 1236 validVideoStreams.append(streamId); 1204 if (i < m_videoTracks.size()) {1237 if (i < static_cast<gint>(m_videoTracks.size())) { 1205 1238 RefPtr<VideoTrackPrivateGStreamer> existingTrack = m_videoTracks.get(streamId); 1206 1239 if (existingTrack) { … … 1223 1256 } 1224 1257 1225 void MediaPlayerPrivateGStreamer::notifyPlayerOfVideo()1226 {1227 }1228 1229 1258 void MediaPlayerPrivateGStreamer::videoSinkCapsChangedCallback(MediaPlayerPrivateGStreamer* player) 1230 1259 { … … 1254 1283 ASSERT(m_isLegacyPlaybin || isMediaSource()); 1255 1284 1256 unsignednumTracks = 0;1285 gint numTracks = 0; 1257 1286 bool useMediaSource = isMediaSource(); 1258 1287 GstElement* element = useMediaSource ? m_source.get() : m_pipeline.get(); … … 1273 1302 #if ENABLE(VIDEO_TRACK) 1274 1303 Vector<String> validAudioStreams; 1275 for ( unsignedi = 0; i < numTracks; ++i) {1304 for (gint i = 0; i < numTracks; ++i) { 1276 1305 GRefPtr<GstPad> pad; 1277 1306 g_signal_emit_by_name(m_pipeline.get(), "get-audio-pad", i, &pad.outPtr(), nullptr); … … 1280 1309 String streamId = "A" + String::number(i); 1281 1310 validAudioStreams.append(streamId); 1282 if (i < m_audioTracks.size()) {1311 if (i < static_cast<gint>(m_audioTracks.size())) { 1283 1312 RefPtr<AudioTrackPrivateGStreamer> existingTrack = m_audioTracks.get(streamId); 1284 1313 if (existingTrack) { … … 1316 1345 ASSERT(m_isLegacyPlaybin || isMediaSource()); 1317 1346 1318 unsignednumTracks = 0;1347 gint numTracks = 0; 1319 1348 bool useMediaSource = isMediaSource(); 1320 1349 GstElement* element = useMediaSource ? m_source.get() : m_pipeline.get(); … … 1329 1358 1330 1359 Vector<String> validTextStreams; 1331 for ( unsignedi = 0; i < numTracks; ++i) {1360 for (gint i = 0; i < numTracks; ++i) { 1332 1361 GRefPtr<GstPad> pad; 1333 1362 g_signal_emit_by_name(m_pipeline.get(), "get-text-pad", i, &pad.outPtr(), nullptr); … … 1341 1370 1342 1371 validTextStreams.append(streamId); 1343 if (i < m_textTracks.size()) {1372 if (i < static_cast<gint>(m_textTracks.size())) { 1344 1373 RefPtr<InbandTextTrackPrivateGStreamer> existingTrack = m_textTracks.get(streamId); 1345 1374 if (existingTrack) { … … 1394 1423 #endif 1395 1424 1396 MediaTime MediaPlayerPrivateGStreamer::platformDuration() const1397 {1398 if (!m_pipeline)1399 return MediaTime::invalidTime();1400 1401 GST_TRACE_OBJECT(pipeline(), "errorOccured: %s, pipeline state: %s", boolForPrinting(m_didErrorOccur), gst_element_state_get_name(GST_STATE(m_pipeline.get())));1402 if (m_didErrorOccur)1403 return MediaTime::invalidTime();1404 1405 // The duration query would fail on a not-prerolled pipeline.1406 if (GST_STATE(m_pipeline.get()) < GST_STATE_PAUSED)1407 return MediaTime::invalidTime();1408 1409 int64_t duration = 0;1410 if (!gst_element_query_duration(m_pipeline.get(), GST_FORMAT_TIME, &duration) || !GST_CLOCK_TIME_IS_VALID(duration)) {1411 GST_DEBUG_OBJECT(pipeline(), "Time duration query failed for %s", m_url.string().utf8().data());1412 return MediaTime::positiveInfiniteTime();1413 }1414 1415 GST_LOG_OBJECT(pipeline(), "Duration: %" GST_TIME_FORMAT, GST_TIME_ARGS(duration));1416 return MediaTime(duration, GST_SECOND);1417 }1418 1419 bool MediaPlayerPrivateGStreamer::isMuted() const1420 {1421 if (!m_volumeElement)1422 return false;1423 1424 gboolean isMuted;1425 g_object_get(m_volumeElement.get(), "mute", &isMuted, nullptr);1426 GST_INFO_OBJECT(pipeline(), "Player is muted: %s", boolForPrinting(!!isMuted));1427 return isMuted;1428 }1429 1430 void MediaPlayerPrivateGStreamer::commitLoad()1431 {1432 ASSERT(!m_isDelayingLoad);1433 GST_DEBUG_OBJECT(pipeline(), "Committing load.");1434 1435 // GStreamer needs to have the pipeline set to a paused state to1436 // start providing anything useful.1437 changePipelineState(GST_STATE_PAUSED);1438 1439 updateDownloadBufferingFlag();1440 updateStates();1441 }1442 1443 1425 void MediaPlayerPrivateGStreamer::fillTimerFired() 1444 1426 { 1445 if (m_ didErrorOccur) {1427 if (m_errorOccured) { 1446 1428 GST_DEBUG_OBJECT(pipeline(), "[Buffering] An error occurred, disabling the fill timer"); 1447 1429 m_fillTimer.stop(); … … 1485 1467 GST_WARNING("Loading failed, error: %s", convertEnumerationToString(networkError).utf8().data()); 1486 1468 1487 m_ didErrorOccur= true;1469 m_errorOccured = true; 1488 1470 if (forceNotifications || m_networkState != networkError) { 1489 1471 m_networkState = networkError; … … 1528 1510 MediaTime MediaPlayerPrivateGStreamer::playbackPosition() const 1529 1511 { 1530 GST_TRACE_OBJECT(pipeline(), "isEndReached: %s, seeking: %s, seekTime: %s", boolForPrinting(m_isEndReached), boolForPrinting(m_ isSeeking), m_seekTime.toString().utf8().data());1531 if (m_isEndReached && m_ isSeeking)1512 GST_TRACE_OBJECT(pipeline(), "isEndReached: %s, seeking: %s, seekTime: %s", boolForPrinting(m_isEndReached), boolForPrinting(m_seeking), m_seekTime.toString().utf8().data()); 1513 if (m_isEndReached && m_seeking) 1532 1514 return m_seekTime; 1533 1515 … … 1549 1531 gst_query_unref(query); 1550 1532 1533 GST_TRACE_OBJECT(pipeline(), "Position %" GST_TIME_FORMAT ", canFallBackToLastFinishedSeekPosition: %s", GST_TIME_ARGS(position), boolForPrinting(m_canFallBackToLastFinishedSeekPosition)); 1534 1535 MediaTime playbackPosition = MediaTime::zeroTime(); 1551 1536 GstClockTime gstreamerPosition = static_cast<GstClockTime>(position); 1552 GST_TRACE_OBJECT(pipeline(), "Position %" GST_TIME_FORMAT ", canFallBackToLastFinishedSeekPosition: %s", GST_TIME_ARGS(gstreamerPosition), boolForPrinting(m_canFallBackToLastFinishedSeekPosition));1553 1554 MediaTime playbackPosition = MediaTime::zeroTime();1555 1556 1537 if (GST_CLOCK_TIME_IS_VALID(gstreamerPosition)) 1557 1538 playbackPosition = MediaTime(gstreamerPosition, GST_SECOND); … … 1629 1610 break; 1630 1611 case TrackPrivateBaseGStreamer::TrackType::Unknown: 1631 FALLTHROUGH;1632 1612 default: 1633 1613 ASSERT_NOT_REACHED(); … … 1681 1661 } 1682 1662 1683 if ( oldHasVideo != m_hasVideo || oldHasAudio != m_hasAudio)1663 if ((oldHasVideo != m_hasVideo) || (oldHasAudio != m_hasAudio)) 1684 1664 m_player->characteristicChanged(); 1685 1665 … … 1741 1721 1742 1722 const gchar* contextType; 1743 if (!gst_message_parse_context_type(message, &contextType)) 1744 return false; 1745 1723 gst_message_parse_context_type(message, &contextType); 1746 1724 GST_DEBUG_OBJECT(pipeline(), "Handling %s need-context message for %s", contextType, GST_MESSAGE_SRC_NAME(message)); 1747 1725 … … 1794 1772 gst_element_set_context(GST_ELEMENT(GST_MESSAGE_SRC(message)), context.get()); 1795 1773 } else 1796 GST_WARNING("CDM instance not initializ ed");1774 GST_WARNING("CDM instance not initializaed"); 1797 1775 1798 1776 return true; … … 1804 1782 } 1805 1783 1806 // Returns the size of the video .1784 // Returns the size of the video 1807 1785 FloatSize MediaPlayerPrivateGStreamer::naturalSize() const 1808 1786 { … … 1842 1820 return FloatSize(); 1843 1821 1844 // TODO: handle possible clean aperture data. See https://bugzilla.gnome.org/show_bug.cgi?id=596571 1845 // TODO: handle possible transformation matrix. See https://bugzilla.gnome.org/show_bug.cgi?id=596326 1822 // TODO: handle possible clean aperture data. See 1823 // https://bugzilla.gnome.org/show_bug.cgi?id=596571 1824 // TODO: handle possible transformation matrix. See 1825 // https://bugzilla.gnome.org/show_bug.cgi?id=596326 1846 1826 1847 1827 // Get the video PAR and original size, if this fails the … … 1855 1835 #if USE(TEXTURE_MAPPER_GL) 1856 1836 // When using accelerated compositing, if the video is tagged as rotated 90 or 270 degrees, swap width and height. 1857 if (m_ canRenderingBeAccelerated) {1837 if (m_renderingCanBeAccelerated) { 1858 1838 if (m_videoSourceOrientation.usesWidthAsHeight()) 1859 1839 originalSize = originalSize.transposedSize(); … … 1874 1854 1875 1855 // Apply DAR to original video size. This is the same behavior as in xvimagesink's setcaps function. 1876 uint64_twidth = 0, height = 0;1856 guint64 width = 0, height = 0; 1877 1857 if (!(originalSize.height() % displayHeight)) { 1878 1858 GST_DEBUG_OBJECT(pipeline(), "Keeping video original height"); 1879 1859 width = gst_util_uint64_scale_int(originalSize.height(), displayWidth, displayHeight); 1880 height = originalSize.height();1860 height = static_cast<guint64>(originalSize.height()); 1881 1861 } else if (!(originalSize.width() % displayWidth)) { 1882 1862 GST_DEBUG_OBJECT(pipeline(), "Keeping video original width"); 1883 1863 height = gst_util_uint64_scale_int(originalSize.width(), displayHeight, displayWidth); 1884 width = originalSize.width();1864 width = static_cast<guint64>(originalSize.width()); 1885 1865 } else { 1886 1866 GST_DEBUG_OBJECT(pipeline(), "Approximating while keeping original video height"); 1887 1867 width = gst_util_uint64_scale_int(originalSize.height(), displayWidth, displayHeight); 1888 height = originalSize.height();1868 height = static_cast<guint64>(originalSize.height()); 1889 1869 } 1890 1870 … … 1944 1924 } 1945 1925 1946 void MediaPlayerPrivateGStreamer::setMuted(bool shouldMute) 1947 { 1948 if (!m_volumeElement || shouldMute == isMuted()) 1949 return; 1950 1951 GST_INFO_OBJECT(pipeline(), "Muted? %s", boolForPrinting(shouldMute)); 1952 g_object_set(m_volumeElement.get(), "mute", shouldMute, nullptr); 1926 void MediaPlayerPrivateGStreamer::sizeChanged() 1927 { 1928 notImplemented(); 1929 } 1930 1931 void MediaPlayerPrivateGStreamer::setMuted(bool mute) 1932 { 1933 if (!m_volumeElement) 1934 return; 1935 1936 bool currentValue = muted(); 1937 if (currentValue == mute) 1938 return; 1939 1940 GST_INFO_OBJECT(pipeline(), "Set muted to %s", toString(mute).utf8().data()); 1941 g_object_set(m_volumeElement.get(), "mute", mute, nullptr); 1942 } 1943 1944 bool MediaPlayerPrivateGStreamer::muted() const 1945 { 1946 if (!m_volumeElement) 1947 return false; 1948 1949 gboolean muted; 1950 g_object_get(m_volumeElement.get(), "mute", &muted, nullptr); 1951 GST_INFO_OBJECT(pipeline(), "Player is muted: %s", toString(static_cast<bool>(muted)).utf8().data()); 1952 return muted; 1953 1953 } 1954 1954 … … 2000 2000 switch (GST_MESSAGE_TYPE(message)) { 2001 2001 case GST_MESSAGE_ERROR: 2002 if (m_ shouldResetPipeline || !m_missingPluginCallbacks.isEmpty() || m_didErrorOccur)2002 if (m_resetPipeline || !m_missingPluginCallbacks.isEmpty() || m_errorOccured) 2003 2003 break; 2004 2004 gst_message_parse_error(message, &err.outPtr(), &debug.outPtr()); … … 2015 2015 error = MediaPlayer::FormatError; 2016 2016 else if (g_error_matches(err.get(), GST_STREAM_ERROR, GST_STREAM_ERROR_TYPE_NOT_FOUND)) { 2017 // Let the mediaPlayerClient handle the stream error, in this case the HTMLMediaElement will emit a stalled event. 2017 // Let the mediaPlayerClient handle the stream error, in 2018 // this case the HTMLMediaElement will emit a stalled 2019 // event. 2018 2020 GST_ERROR("Decode error, let the Media element emit a stalled event."); 2019 2021 m_loadingStalled = true; … … 2028 2030 issueError = !loadNextLocation(); 2029 2031 if (issueError) { 2030 m_ didErrorOccur= true;2032 m_errorOccured = true; 2031 2033 if (m_networkState != error) { 2032 2034 m_networkState = error; … … 2039 2041 break; 2040 2042 case GST_MESSAGE_ASYNC_DONE: 2041 if (!messageSourceIsPlaybin || m_ isDelayingLoad)2043 if (!messageSourceIsPlaybin || m_delayingLoad) 2042 2044 break; 2043 2045 asyncStateChangeDone(); 2044 2046 break; 2045 2047 case GST_MESSAGE_STATE_CHANGED: { 2046 if (!messageSourceIsPlaybin || m_ isDelayingLoad)2048 if (!messageSourceIsPlaybin || m_delayingLoad) 2047 2049 break; 2048 2050 updateStates(); … … 2175 2177 } 2176 2178 if (!isRangeRequest) { 2177 m_is LiveStream= !contentLength;2178 GST_INFO_OBJECT(pipeline(), "%s stream detected", m_is LiveStream? "Live" : "Non-live");2179 m_isStreaming = !contentLength; 2180 GST_INFO_OBJECT(pipeline(), "%s stream detected", m_isStreaming ? "Live" : "Non-live"); 2179 2181 updateDownloadBufferingFlag(); 2180 2182 } … … 2284 2286 GST_DEBUG_OBJECT(pipeline(), "[Buffering] mode: %s, status: %f%%", enumToString(GST_TYPE_BUFFERING_MODE, mode).data(), percentage); 2285 2287 2286 m_d idDownloadFinish= percentage == 100;2287 m_ isBuffering = !m_didDownloadFinish;2288 m_downloadFinished = percentage == 100; 2289 m_buffering = !m_downloadFinished; 2288 2290 2289 2291 switch (mode) { … … 2292 2294 2293 2295 m_bufferingPercentage = percentage; 2294 if (m_d idDownloadFinish)2296 if (m_downloadFinished) 2295 2297 updateStates(); 2296 2298 … … 2302 2304 // Media is now fully loaded. It will play even if network connection is 2303 2305 // cut. Buffering is done, remove the fill source from the main loop. 2304 if (m_d idDownloadFinish)2306 if (m_downloadFinished) 2305 2307 m_fillTimer.stop(); 2306 2308 … … 2322 2324 const GstMpegtsPMT* pmt = gst_mpegts_section_get_pmt(section); 2323 2325 m_metadataTracks.clear(); 2324 for ( unsignedi = 0; i < pmt->streams->len; ++i) {2326 for (guint i = 0; i < pmt->streams->len; ++i) { 2325 2327 const GstMpegtsPMTStream* stream = static_cast<const GstMpegtsPMTStream*>(g_ptr_array_index(pmt->streams, i)); 2326 2328 if (stream->stream_type == 0x05 || stream->stream_type >= 0x80) { … … 2341 2343 String inbandMetadataTrackDispatchType; 2342 2344 appendUnsignedAsHexFixedSize(stream->stream_type, inbandMetadataTrackDispatchType, 2); 2343 for ( unsignedj = 0; j < stream->descriptors->len; ++j) {2345 for (guint j = 0; j < stream->descriptors->len; ++j) { 2344 2346 const GstMpegtsDescriptor* descriptor = static_cast<const GstMpegtsDescriptor*>(g_ptr_array_index(stream->descriptors, j)); 2345 for ( unsignedk = 0; k < descriptor->length; ++k)2347 for (guint k = 0; k < descriptor->length; ++k) 2346 2348 appendByteAsHex(descriptor->data[k], inbandMetadataTrackDispatchType); 2347 2349 } … … 2393 2395 gint64 start = -1, stop = -1; 2394 2396 gst_toc_entry_get_start_stop_times(entry, &start, &stop); 2395 2396 uint32_t truncatedGstSecond = static_cast<uint32_t>(GST_SECOND);2397 2397 if (start != -1) 2398 cue->setStartTime(MediaTime(sta tic_cast<int64_t>(start), truncatedGstSecond));2398 cue->setStartTime(MediaTime(start, GST_SECOND)); 2399 2399 if (stop != -1) 2400 cue->setEndTime(MediaTime(st atic_cast<int64_t>(stop), truncatedGstSecond));2400 cue->setEndTime(MediaTime(stop, GST_SECOND)); 2401 2401 2402 2402 GstTagList* tags = gst_toc_entry_get_tags(entry); … … 2496 2496 void MediaPlayerPrivateGStreamer::asyncStateChangeDone() 2497 2497 { 2498 if (!m_pipeline || m_ didErrorOccur)2499 return; 2500 2501 if (m_ isSeeking) {2502 if (m_ isSeekPending)2498 if (!m_pipeline || m_errorOccured) 2499 return; 2500 2501 if (m_seeking) { 2502 if (m_seekIsPending) 2503 2503 updateStates(); 2504 2504 else { 2505 2505 GST_DEBUG_OBJECT(pipeline(), "[Seek] seeked to %s", toString(m_seekTime).utf8().data()); 2506 m_ isSeeking = false;2506 m_seeking = false; 2507 2507 m_cachedPosition = MediaTime::invalidTime(); 2508 2508 if (m_timeOfOverlappingSeek != m_seekTime && m_timeOfOverlappingSeek.isValid()) { … … 2524 2524 void MediaPlayerPrivateGStreamer::updateStates() 2525 2525 { 2526 if (!m_pipeline || m_didErrorOccur) 2526 if (!m_pipeline) 2527 return; 2528 2529 if (m_errorOccured) 2527 2530 return; 2528 2531 2529 2532 MediaPlayer::NetworkState oldNetworkState = m_networkState; 2530 2533 MediaPlayer::ReadyState oldReadyState = m_readyState; 2531 GstState pending, state; 2534 GstState pending; 2535 GstState state; 2532 2536 bool stateReallyChanged = false; 2533 2537 … … 2549 2553 break; 2550 2554 2551 m_ shouldResetPipeline = m_currentState <= GST_STATE_READY;2552 2553 bool didBuffering = m_ isBuffering;2555 m_resetPipeline = m_currentState <= GST_STATE_READY; 2556 2557 bool didBuffering = m_buffering; 2554 2558 2555 2559 // Update ready and network states. … … 2565 2569 case GST_STATE_PAUSED: 2566 2570 case GST_STATE_PLAYING: 2567 if (m_ isBuffering) {2571 if (m_buffering) { 2568 2572 if (m_bufferingPercentage == 100) { 2569 2573 GST_DEBUG_OBJECT(pipeline(), "[Buffering] Complete."); 2570 m_ isBuffering = false;2574 m_buffering = false; 2571 2575 m_readyState = MediaPlayer::HaveEnoughData; 2572 m_networkState = m_d idDownloadFinish? MediaPlayer::Idle : MediaPlayer::Loading;2576 m_networkState = m_downloadFinished ? MediaPlayer::Idle : MediaPlayer::Loading; 2573 2577 } else { 2574 2578 m_readyState = MediaPlayer::HaveCurrentData; 2575 2579 m_networkState = MediaPlayer::Loading; 2576 2580 } 2577 } else if (m_d idDownloadFinish) {2581 } else if (m_downloadFinished) { 2578 2582 m_readyState = MediaPlayer::HaveEnoughData; 2579 2583 m_networkState = MediaPlayer::Loaded; … … 2591 2595 // Sync states where needed. 2592 2596 if (m_currentState == GST_STATE_PAUSED) { 2593 if (!m_ areVolumeAndMuteInitialized) {2597 if (!m_volumeAndMuteInitialized) { 2594 2598 notifyPlayerOfVolumeChange(); 2595 2599 notifyPlayerOfMute(); 2596 m_ areVolumeAndMuteInitialized = true;2600 m_volumeAndMuteInitialized = true; 2597 2601 } 2598 2602 2599 if (didBuffering && !m_ isBuffering && !m_isPaused && m_playbackRate) {2603 if (didBuffering && !m_buffering && !m_paused && m_playbackRate) { 2600 2604 GST_DEBUG_OBJECT(pipeline(), "[Buffering] Restarting playback."); 2601 2605 changePipelineState(GST_STATE_PLAYING); 2602 2606 } 2603 2607 } else if (m_currentState == GST_STATE_PLAYING) { 2604 m_ isPaused = false;2605 2606 if ((m_ isBuffering && m_isLiveStream) || !m_playbackRate) {2608 m_paused = false; 2609 2610 if ((m_buffering && !isLiveStream()) || !m_playbackRate) { 2607 2611 GST_DEBUG_OBJECT(pipeline(), "[Buffering] Pausing stream for buffering."); 2608 2612 changePipelineState(GST_STATE_PAUSED); 2609 2613 } 2610 2614 } else 2611 m_ isPaused = true;2615 m_paused = true; 2612 2616 2613 2617 GST_DEBUG_OBJECT(pipeline(), "Old state: %s, new state: %s (requested: %s)", gst_element_state_get_name(m_oldState), gst_element_state_get_name(m_currentState), gst_element_state_get_name(m_requestedState)); … … 2634 2638 case GST_STATE_CHANGE_FAILURE: 2635 2639 GST_DEBUG_OBJECT(pipeline(), "Failure: State: %s, pending: %s", gst_element_state_get_name(m_currentState), gst_element_state_get_name(pending)); 2636 // Change failed .2640 // Change failed 2637 2641 return; 2638 2642 case GST_STATE_CHANGE_NO_PREROLL: … … 2640 2644 2641 2645 // Live pipelines go in PAUSED without prerolling. 2642 m_is LiveStream= true;2646 m_isStreaming = true; 2643 2647 updateDownloadBufferingFlag(); 2644 2648 … … 2647 2651 else if (m_currentState == GST_STATE_PAUSED) { 2648 2652 m_readyState = MediaPlayer::HaveEnoughData; 2649 m_ isPaused = true;2653 m_paused = true; 2650 2654 } else if (m_currentState == GST_STATE_PLAYING) 2651 m_ isPaused = false;2652 2653 if (!m_ isPaused && m_playbackRate)2655 m_paused = false; 2656 2657 if (!m_paused && m_playbackRate) 2654 2658 changePipelineState(GST_STATE_PLAYING); 2655 2659 … … 2677 2681 if (getStateResult == GST_STATE_CHANGE_SUCCESS && m_currentState >= GST_STATE_PAUSED) { 2678 2682 updatePlaybackRate(); 2679 if (m_ isSeekPending) {2683 if (m_seekIsPending) { 2680 2684 GST_DEBUG_OBJECT(pipeline(), "[Seek] committing pending seek to %s", toString(m_seekTime).utf8().data()); 2681 m_ isSeekPending = false;2682 m_ isSeeking = doSeek(m_seekTime, m_player->rate(), static_cast<GstSeekFlags>(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE));2683 if (!m_ isSeeking) {2685 m_seekIsPending = false; 2686 m_seeking = doSeek(m_seekTime, m_player->rate(), static_cast<GstSeekFlags>(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE)); 2687 if (!m_seeking) { 2684 2688 m_cachedPosition = MediaTime::invalidTime(); 2685 2689 GST_DEBUG_OBJECT(pipeline(), "[Seek] seeking to %s failed", toString(m_seekTime).utf8().data()); … … 2715 2719 2716 2720 const GValue* locations = gst_structure_get_value(m_mediaLocations, "locations"); 2717 const char* newLocation = nullptr;2721 const gchar* newLocation = nullptr; 2718 2722 2719 2723 if (!locations) { … … 2772 2776 2773 2777 // Reset pipeline state. 2774 m_ shouldResetPipeline = true;2778 m_resetPipeline = true; 2775 2779 2776 2780 GstState state; … … 2798 2802 m_cachedPosition = MediaTime::invalidTime(); 2799 2803 MediaTime now = currentMediaTime(); 2800 if (now > MediaTime::zeroTime() && !m_ isSeeking) {2804 if (now > MediaTime::zeroTime() && !m_seeking) { 2801 2805 m_cachedDuration = now; 2802 2806 m_player->durationChanged(); … … 2806 2810 2807 2811 if (!m_player->client().mediaPlayerIsLooping()) { 2808 m_ isPaused = true;2812 m_paused = true; 2809 2813 changePipelineState(GST_STATE_READY); 2810 m_d idDownloadFinish= false;2814 m_downloadFinished = false; 2811 2815 } 2812 2816 timeChanged(); … … 2861 2865 2862 2866 // We don't want to stop downloading if we already started it. 2863 if (flags & flagDownload && m_readyState > MediaPlayer::HaveNothing && !m_ shouldResetPipeline) {2867 if (flags & flagDownload && m_readyState > MediaPlayer::HaveNothing && !m_resetPipeline) { 2864 2868 GST_DEBUG_OBJECT(pipeline(), "Download already started, not starting again"); 2865 2869 return; 2866 2870 } 2867 2871 2868 bool shouldDownload = ! m_isLiveStream&& m_preload == MediaPlayer::Auto;2872 bool shouldDownload = !isLiveStream() && m_preload == MediaPlayer::Auto; 2869 2873 if (shouldDownload) { 2870 2874 GST_INFO_OBJECT(pipeline(), "Enabling on-disk buffering"); … … 2880 2884 void MediaPlayerPrivateGStreamer::createGSTPlayBin(const URL& url, const String& pipelineName) 2881 2885 { 2882 const char* playbinName = "playbin";2886 const gchar* playbinName = "playbin"; 2883 2887 2884 2888 // MSE doesn't support playbin3. Mediastream requires playbin3. Regular … … 2903 2907 m_isLegacyPlaybin = !g_strcmp0(playbinName, "playbin"); 2904 2908 2909 // gst_element_factory_make() returns a floating reference so 2910 // we should not adopt. 2905 2911 static Atomic<uint32_t> pipelineId; 2906 2912 setPipeline(gst_element_factory_make(playbinName, … … 2968 2974 configurePlaySink(); 2969 2975 2970 if (m_ shouldPreservePitch) {2976 if (m_preservesPitch) { 2971 2977 GstElement* scale = gst_element_factory_make("scaletempo", nullptr); 2972 2978 … … 2977 2983 } 2978 2984 2979 if (!m_ canRenderingBeAccelerated) {2985 if (!m_renderingCanBeAccelerated) { 2980 2986 // If not using accelerated compositing, let GStreamer handle 2981 2987 // the image-orientation tag. … … 3002 3008 bool MediaPlayerPrivateGStreamer::canSaveMediaData() const 3003 3009 { 3004 if ( m_isLiveStream)3010 if (isLiveStream()) 3005 3011 return false; 3006 3012 … … 3022 3028 void MediaPlayerPrivateGStreamer::acceleratedRenderingStateChanged() 3023 3029 { 3024 m_ canRenderingBeAccelerated = m_player && m_player->client().mediaPlayerAcceleratedCompositingEnabled();3030 m_renderingCanBeAccelerated = m_player && m_player->client().mediaPlayerAcceleratedCompositingEnabled(); 3025 3031 } 3026 3032 … … 3070 3076 return; 3071 3077 3072 std::unique_ptr<GstVideoFrameHolder> frameHolder = makeUnique<GstVideoFrameHolder>(m_sample.get(), m_videoDecoderPlatform, m_textureMapperFlags, !m_ isUsingFallbackVideoSink);3078 std::unique_ptr<GstVideoFrameHolder> frameHolder = makeUnique<GstVideoFrameHolder>(m_sample.get(), m_videoDecoderPlatform, m_textureMapperFlags, !m_usingFallbackVideoSink); 3073 3079 3074 3080 std::unique_ptr<TextureMapperPlatformLayerBuffer> layerBuffer; … … 3112 3118 void MediaPlayerPrivateGStreamer::triggerRepaint(GstSample* sample) 3113 3119 { 3114 bool shouldTriggerResize;3120 bool triggerResize; 3115 3121 { 3116 3122 auto sampleLocker = holdLock(m_sampleMutex); 3117 shouldTriggerResize = !m_sample;3123 triggerResize = !m_sample; 3118 3124 m_sample = sample; 3119 3125 } 3120 3126 3121 if ( shouldTriggerResize) {3127 if (triggerResize) { 3122 3128 GST_DEBUG_OBJECT(pipeline(), "First sample reached the sink, triggering video dimensions update"); 3123 3129 m_notifier->notify(MainThreadNotification::SizeChanged, [this] { … … 3126 3132 } 3127 3133 3128 if (!m_ canRenderingBeAccelerated) {3134 if (!m_renderingCanBeAccelerated) { 3129 3135 LockHolder locker(m_drawMutex); 3130 if (m_ isBeingDestroyed)3136 if (m_destroying) 3131 3137 return; 3132 3138 m_drawTimer.startOneShot(0_s); … … 3136 3142 3137 3143 #if USE(TEXTURE_MAPPER_GL) 3138 if (m_ isUsingFallbackVideoSink) {3144 if (m_usingFallbackVideoSink) { 3139 3145 LockHolder lock(m_drawMutex); 3140 3146 auto proxyOperation = … … 3172 3178 // This function is also used when destroying the player (destroying parameter is true), to release the gstreamer thread from 3173 3179 // m_drawCondition and to ensure that new triggerRepaint calls won't wait on m_drawCondition. 3174 if (!m_ canRenderingBeAccelerated) {3180 if (!m_renderingCanBeAccelerated) { 3175 3181 LockHolder locker(m_drawMutex); 3176 3182 m_drawTimer.stop(); 3177 m_ isBeingDestroyed= destroying;3183 m_destroying = destroying; 3178 3184 m_drawCondition.notifyOne(); 3179 3185 } … … 3257 3263 m_colorConvertOutputCaps = adoptGRef(gst_caps_copy(caps)); 3258 3264 #if G_BYTE_ORDER == G_LITTLE_ENDIAN 3259 const char* formatString = GST_VIDEO_INFO_HAS_ALPHA(&videoInfo) ? "RGBA" : "BGRx";3265 const gchar* formatString = GST_VIDEO_INFO_HAS_ALPHA(&videoInfo) ? "RGBA" : "BGRx"; 3260 3266 #else 3261 const char* formatString = GST_VIDEO_INFO_HAS_ALPHA(&videoInfo) ? "RGBA" : "RGBx";3267 const gchar* formatString = GST_VIDEO_INFO_HAS_ALPHA(&videoInfo) ? "RGBA" : "RGBx"; 3262 3268 #endif 3263 3269 gst_caps_set_simple(m_colorConvertOutputCaps.get(), "format", G_TYPE_STRING, formatString, nullptr); … … 3280 3286 return; 3281 3287 3282 context.drawImage(gstImage->image(), rect, gstImage->rect(), { CompositeCopy, m_ canRenderingBeAccelerated ? m_videoSourceOrientation : ImageOrientation() });3288 context.drawImage(gstImage->image(), rect, gstImage->rect(), { CompositeCopy, m_renderingCanBeAccelerated ? m_videoSourceOrientation : ImageOrientation() }); 3283 3289 } 3284 3290 … … 3288 3294 UNUSED_PARAM(context); 3289 3295 3290 if (m_ isUsingFallbackVideoSink)3296 if (m_usingFallbackVideoSink) 3291 3297 return false; 3292 3298 … … 3320 3326 { 3321 3327 #if USE(CAIRO) && ENABLE(ACCELERATED_2D_CANVAS) 3322 if (m_ isUsingFallbackVideoSink)3328 if (m_usingFallbackVideoSink) 3323 3329 return nullptr; 3324 3330 … … 3401 3407 return MediaPlayer::Unknown; 3402 3408 3403 if ( m_isLiveStream)3409 if (isLiveStream()) 3404 3410 return MediaPlayer::LiveStream; 3405 3411 … … 3479 3485 3480 3486 #if USE(GSTREAMER_GL) 3481 if (m_ canRenderingBeAccelerated)3487 if (m_renderingCanBeAccelerated) 3482 3488 m_videoSink = createVideoSinkGL(); 3483 3489 #endif 3484 3490 3485 3491 if (!m_videoSink) { 3486 m_ isUsingFallbackVideoSink = true;3492 m_usingFallbackVideoSink = true; 3487 3493 m_videoSink = webkitVideoSinkNew(); 3488 3494 g_signal_connect_swapped(m_videoSink.get(), "repaint-requested", G_CALLBACK(repaintCallback), this); … … 3538 3544 unsigned MediaPlayerPrivateGStreamer::decodedFrameCount() const 3539 3545 { 3540 uint64_tdecodedFrames = 0;3546 guint64 decodedFrames = 0; 3541 3547 if (m_fpsSink) 3542 3548 g_object_get(m_fpsSink.get(), "frames-rendered", &decodedFrames, nullptr); … … 3546 3552 unsigned MediaPlayerPrivateGStreamer::droppedFrameCount() const 3547 3553 { 3548 uint64_tframesDropped = 0;3554 guint64 framesDropped = 0; 3549 3555 if (m_fpsSink) 3550 3556 g_object_get(m_fpsSink.get(), "frames-dropped", &framesDropped, nullptr); … … 3644 3650 void MediaPlayerPrivateGStreamer::attemptToDecryptWithLocalInstance() 3645 3651 { 3646 bool wasEventHandled = gst_element_send_event(pipeline(), gst_event_new_custom(GST_EVENT_CUSTOM_DOWNSTREAM_OOB, gst_structure_new_empty("attempt-to-decrypt")));3647 GST_DEBUG("attempting to decrypt, event handled %s", boolForPrinting( wasEventHandled));3652 bool eventHandled = gst_element_send_event(pipeline(), gst_event_new_custom(GST_EVENT_CUSTOM_DOWNSTREAM_OOB, gst_structure_new_empty("attempt-to-decrypt"))); 3653 GST_DEBUG("attempting to decrypt, event handled %s", boolForPrinting(eventHandled)); 3648 3654 } 3649 3655 … … 3664 3670 } 3665 3671 3666 void MediaPlayerPrivateGStreamer::setWaitingForKey(bool isWaitingForKey)3672 void MediaPlayerPrivateGStreamer::setWaitingForKey(bool waitingForKey) 3667 3673 { 3668 3674 // We bail out if values did not change or if we are requested to not wait anymore but there are still waiting decryptors. 3669 GST_TRACE(" isWaitingForKey %s, m_isWaitingForKey %s", boolForPrinting(isWaitingForKey), boolForPrinting(m_isWaitingForKey));3670 if ( isWaitingForKey == m_isWaitingForKey || (!isWaitingForKey && this->waitingForKey()))3671 return; 3672 3673 m_ isWaitingForKey = isWaitingForKey;3674 GST_DEBUG("waiting for key changed %s", boolForPrinting(m_ isWaitingForKey));3675 GST_TRACE("waitingForKey %s, m_waitingForKey %s", boolForPrinting(waitingForKey), boolForPrinting(m_waitingForKey)); 3676 if (waitingForKey == m_waitingForKey || (!waitingForKey && this->waitingForKey())) 3677 return; 3678 3679 m_waitingForKey = waitingForKey; 3680 GST_DEBUG("waiting for key changed %s", boolForPrinting(m_waitingForKey)); 3675 3681 m_player->waitingForKeyChanged(); 3676 3682 } -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
r252937 r252938 121 121 WTF_MAKE_FAST_ALLOCATED; 122 122 public: 123 static void initializeDebugCategory(); 124 123 125 MediaPlayerPrivateGStreamer(MediaPlayer*); 124 126 virtual ~MediaPlayerPrivateGStreamer(); 125 127 128 static bool isAvailable(); 126 129 static void registerMediaEngine(MediaEngineRegistrar); 127 static MediaPlayer::SupportsType extendedSupportsType(const MediaEngineSupportParameters&, MediaPlayer::SupportsType); 128 129 bool has Video() const final { return m_hasVideo; }130 bool hasAudio() const final { return m_hasAudio; } 130 131 bool hasVideo() const override { return m_hasVideo; } 132 bool hasAudio() const override { return m_hasAudio; } 133 131 134 void load(const String &url) override; 132 135 #if ENABLE(MEDIA_SOURCE) … … 136 139 void load(MediaStreamPrivate&) override; 137 140 #endif 138 void cancelLoad() final; 139 void prepareToPlay() final; 140 void play() final; 141 void commitLoad(); 142 void cancelLoad() override; 143 144 void prepareToPlay() override; 145 void play() override; 141 146 void pause() override; 142 bool paused() const final;143 bool seeking() const override { return m_ isSeeking; }147 bool paused() const override; 148 bool seeking() const override { return m_seeking; } 144 149 void seek(const MediaTime&) override; 150 151 MediaTime platformDuration() const; 152 145 153 void setRate(float) override; 146 double rate() const final; 147 void setPreservesPitch(bool) final; 148 void setPreload(MediaPlayer::Preload) final; 154 double rate() const override; 155 void setPreservesPitch(bool) override; 156 void setPreload(MediaPlayer::Preload) override; 157 149 158 FloatSize naturalSize() const final; 150 void setVolume(float) final; 151 float volume() const final; 152 void setMuted(bool) final; 153 MediaPlayer::NetworkState networkState() const final; 154 MediaPlayer::ReadyState readyState() const final; 155 void setVisible(bool) final { } 156 void setSize(const IntSize&) final; 159 160 void setVolume(float) override; 161 float volume() const override; 162 163 void setMuted(bool) override; 164 bool muted() const; 165 166 MediaPlayer::NetworkState networkState() const override; 167 MediaPlayer::ReadyState readyState() const override; 168 169 void setVisible(bool) override { } 170 void setSize(const IntSize&) override; 171 void sizeChanged(); 172 157 173 // Prefer MediaTime based methods over float based. 158 float duration() const final { return durationMediaTime().toFloat(); } 159 double durationDouble() const final { return durationMediaTime().toDouble(); } 160 MediaTime durationMediaTime() const; 161 float currentTime() const final { return currentMediaTime().toFloat(); } 162 double currentTimeDouble() const final { return currentMediaTime().toDouble(); } 174 175 float duration() const override { return durationMediaTime().toFloat(); } 176 double durationDouble() const override { return durationMediaTime().toDouble(); } 177 MediaTime durationMediaTime() const override; 178 float currentTime() const override { return currentMediaTime().toFloat(); } 179 double currentTimeDouble() const override { return currentMediaTime().toDouble(); } 163 180 MediaTime currentMediaTime() const override; 164 181 std::unique_ptr<PlatformTimeRanges> buffered() const override; 165 void seek(float time) final { seek(MediaTime::createWithFloat(time)); } 166 void seekDouble(double time) final { seek(MediaTime::createWithDouble(time)); } 167 float maxTimeSeekable() const final { return maxMediaTimeSeekable().toFloat(); } 182 void seek(float time) override { seek(MediaTime::createWithFloat(time)); } 183 void seekDouble(double time) override { seek(MediaTime::createWithDouble(time)); } 184 185 float maxTimeSeekable() const override { return maxMediaTimeSeekable().toFloat(); } 168 186 MediaTime maxMediaTimeSeekable() const override; 169 double minTimeSeekable() const final { return minMediaTimeSeekable().toFloat(); } 170 MediaTime minMediaTimeSeekable() const final { return MediaTime::zeroTime(); } 171 bool didLoadingProgress() const final; 172 unsigned long long totalBytes() const final; 173 bool hasSingleSecurityOrigin() const final; 174 Optional<bool> wouldTaintOrigin(const SecurityOrigin&) const final; 175 void simulateAudioInterruption() final; 187 double minTimeSeekable() const override { return minMediaTimeSeekable().toFloat(); } 188 MediaTime minMediaTimeSeekable() const override { return MediaTime::zeroTime(); } 189 190 bool didLoadingProgress() const override; 191 unsigned long long totalBytes() const override; 192 193 bool hasSingleSecurityOrigin() const override; 194 Optional<bool> wouldTaintOrigin(const SecurityOrigin&) const override; 195 196 void simulateAudioInterruption() override; 197 176 198 #if ENABLE(WEB_AUDIO) 177 AudioSourceProvider* audioSourceProvider() final; 178 #endif 179 void paint(GraphicsContext&, const FloatRect&) final; 180 bool supportsFullscreen() const final; 181 MediaPlayer::MovieLoadType movieLoadType() const final; 182 183 unsigned decodedFrameCount() const final; 184 unsigned droppedFrameCount() const final; 185 unsigned audioDecodedByteCount() const final; 186 unsigned videoDecodedByteCount() const final; 187 188 void acceleratedRenderingStateChanged() final; 199 AudioSourceProvider* audioSourceProvider() override; 200 #endif 201 202 void paint(GraphicsContext&, const FloatRect&) override; 203 204 bool supportsFullscreen() const override; 205 206 MediaPlayer::MovieLoadType movieLoadType() const override; 207 208 MediaPlayer* mediaPlayer() const { return m_player; } 209 210 unsigned decodedFrameCount() const override; 211 unsigned droppedFrameCount() const override; 212 unsigned audioDecodedByteCount() const override; 213 unsigned videoDecodedByteCount() const override; 214 215 void acceleratedRenderingStateChanged() override; 189 216 190 217 #if USE(TEXTURE_MAPPER_GL) … … 199 226 200 227 #if ENABLE(ENCRYPTED_MEDIA) 201 void cdmInstanceAttached(CDMInstance&) final; 202 void cdmInstanceDetached(CDMInstance&) final; 228 void cdmInstanceAttached(CDMInstance&) override; 229 void cdmInstanceDetached(CDMInstance&) override; 230 void handleProtectionEvent(GstEvent*); 231 virtual void attemptToDecryptWithLocalInstance(); 203 232 void attemptToDecryptWithInstance(CDMInstance&) final; 204 bool waitingForKey() const final; 205 206 void handleProtectionEvent(GstEvent*); 207 #endif 233 void initializationDataEncountered(InitData&&); 234 void setWaitingForKey(bool); 235 bool waitingForKey() const override; 236 #endif 237 238 static bool supportsKeySystem(const String& keySystem, const String& mimeType); 239 static MediaPlayer::SupportsType extendedSupportsType(const MediaEngineSupportParameters&, MediaPlayer::SupportsType); 208 240 209 241 #if USE(GSTREAMER_GL) … … 212 244 #endif 213 245 246 void setVideoSourceOrientation(ImageOrientation); 247 GstElement* pipeline() const { return m_pipeline.get(); } 214 248 void enableTrack(TrackPrivateBaseGStreamer::TrackType, unsigned index); 215 249 216 250 // Append pipeline interface 217 // FIXME: Use the client interface pattern, AppendPipeline does not need the full interface to this class just for these two functions.218 251 bool handleSyncMessage(GstMessage*); 219 252 void handleMessage(GstMessage*); … … 238 271 }; 239 272 240 static bool isAvailable(); 241 #if ENABLE(ENCRYPTED_MEDIA) 242 static bool supportsKeySystem(const String& keySystem, const String& mimeType); 243 #endif 273 virtual bool isLiveStream() const { return m_isStreaming; } 274 MediaTime maxTimeLoaded() const; 244 275 245 276 virtual void durationChanged(); … … 248 279 virtual bool changePipelineState(GstState); 249 280 281 250 282 #if USE(GSTREAMER_HOLEPUNCH) 251 283 GstElement* createHolePunchVideoSink(); … … 261 293 void pushTextureToCompositor(); 262 294 #if USE(NICOSIA) 263 void swapBuffersIfNeeded() final;295 void swapBuffersIfNeeded() override; 264 296 #else 265 RefPtr<TextureMapperPlatformLayerProxy> proxy() const final;266 void swapBuffersIfNeeded() final;297 RefPtr<TextureMapperPlatformLayerProxy> proxy() const override; 298 void swapBuffersIfNeeded() override; 267 299 #endif 268 300 #endif … … 285 317 static void volumeChangedCallback(MediaPlayerPrivateGStreamer*); 286 318 static void muteChangedCallback(MediaPlayerPrivateGStreamer*); 319 320 // FIXME: Where is this used? 321 void handlePluginInstallerResult(GstInstallPluginsReturn); 287 322 288 323 void readyTimerFired(); … … 324 359 mutable MediaTime m_cachedDuration; 325 360 bool m_canFallBackToLastFinishedSeekPosition { false }; 326 bool m_ isChangingRate { false };327 bool m_d idDownloadFinish{ false };328 bool m_ didErrorOccur{ false };361 bool m_changingRate { false }; 362 bool m_downloadFinished { false }; 363 bool m_errorOccured { false }; 329 364 mutable bool m_isEndReached { false }; 330 mutable bool m_is LiveStream{ false };331 bool m_ isPaused { true };365 mutable bool m_isStreaming { false }; 366 bool m_paused { true }; 332 367 float m_playbackRate { 1 }; 333 368 GstState m_currentState; 334 369 GstState m_oldState; 335 370 GstState m_requestedState { GST_STATE_VOID_PENDING }; 336 bool m_ shouldResetPipeline { false };337 bool m_ isSeeking { false };338 bool m_ isSeekPending { false };371 bool m_resetPipeline { false }; 372 bool m_seeking { false }; 373 bool m_seekIsPending { false }; 339 374 MediaTime m_seekTime; 340 375 GRefPtr<GstElement> m_source { nullptr }; 341 bool m_ areVolumeAndMuteInitialized { false };376 bool m_volumeAndMuteInitialized { false }; 342 377 343 378 #if USE(TEXTURE_MAPPER_GL) … … 357 392 358 393 mutable FloatSize m_videoSize; 359 bool m_ isUsingFallbackVideoSink { false };360 bool m_ canRenderingBeAccelerated { false };361 362 bool m_ isBeingDestroyed{ false };394 bool m_usingFallbackVideoSink { false }; 395 bool m_renderingCanBeAccelerated { false }; 396 397 bool m_destroying { false }; 363 398 364 399 #if USE(GSTREAMER_GL) … … 378 413 HashSet<uint32_t> m_handledProtectionEvents; 379 414 380 bool m_ isWaitingForKey { false };415 bool m_waitingForKey { false }; 381 416 #endif 382 417 … … 384 419 385 420 private: 386 MediaTime maxTimeLoaded() const;387 GstElement* pipeline() const { return m_pipeline.get(); }388 void setVideoSourceOrientation(ImageOrientation);389 MediaTime platformDuration() const;390 bool isMuted() const;391 void commitLoad();392 421 void fillTimerFired(); 422 393 423 void didEnd(); 424 394 425 395 426 GstElement* createVideoSink(); … … 445 476 void clearTracks(); 446 477 447 #if ENABLE(ENCRYPTED_MEDIA)448 void attemptToDecryptWithLocalInstance();449 void initializationDataEncountered(InitData&&);450 void setWaitingForKey(bool);451 #endif452 453 478 #if ENABLE(VIDEO_TRACK) 454 479 GRefPtr<GstElement> m_textAppSink; … … 457 482 GstStructure* m_mediaLocations { nullptr }; 458 483 int m_mediaLocationCurrentIndex { 0 }; 459 bool m_ isPlaybackRatePaused{ false };484 bool m_playbackRatePause { false }; 460 485 MediaTime m_timeOfOverlappingSeek; 461 486 float m_lastPlaybackRate { 1 }; … … 464 489 bool m_loadingStalled { false }; 465 490 MediaPlayer::Preload m_preload; 466 bool m_ isDelayingLoad { false };491 bool m_delayingLoad { false }; 467 492 mutable MediaTime m_maxTimeLoadedAtLastDidLoadingProgress; 468 493 bool m_hasVideo { false }; … … 479 504 #endif 480 505 #endif 481 bool m_ isBuffering { false };506 bool m_buffering { false }; 482 507 int m_bufferingPercentage { 0 }; 483 508 mutable unsigned long long m_totalBytes { 0 }; 484 509 URL m_url; 485 bool m_ shouldPreservePitch { false };510 bool m_preservesPitch { false }; 486 511 mutable Optional<Seconds> m_lastQueryTime; 487 512 bool m_isLegacyPlaybin; -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp
r252937 r252938 133 133 void MediaPlayerPrivateGStreamerMSE::pause() 134 134 { 135 // FIXME: Should not need direct access to this member. This override is probably not needed. 136 m_isPaused = true; 135 m_paused = true; 137 136 MediaPlayerPrivateGStreamer::pause(); 138 137 } … … 140 139 MediaTime MediaPlayerPrivateGStreamerMSE::durationMediaTime() const 141 140 { 142 if (UNLIKELY(!m_pipeline || m_ didErrorOccur))141 if (UNLIKELY(!m_pipeline || m_errorOccured)) 143 142 return MediaTime(); 144 143 … … 148 147 void MediaPlayerPrivateGStreamerMSE::seek(const MediaTime& time) 149 148 { 150 if (UNLIKELY(!m_pipeline || m_ didErrorOccur))149 if (UNLIKELY(!m_pipeline || m_errorOccured)) 151 150 return; 152 151 … … 156 155 MediaTime current = currentMediaTime(); 157 156 if (time == current) { 158 if (!m_ isSeeking)157 if (!m_seeking) 159 158 timeChanged(); 160 159 return; 161 160 } 162 161 163 if ( m_isLiveStream)164 return; 165 166 if (m_ isSeeking && m_isSeekPending) {162 if (isLiveStream()) 163 return; 164 165 if (m_seeking && m_seekIsPending) { 167 166 m_seekTime = time; 168 167 return; … … 181 180 182 181 m_isEndReached = false; 183 GST_DEBUG("m_ isSeeking=%s, m_seekTime=%s", boolForPrinting(m_isSeeking), toString(m_seekTime).utf8().data());182 GST_DEBUG("m_seeking=%s, m_seekTime=%s", boolForPrinting(m_seeking), toString(m_seekTime).utf8().data()); 184 183 } 185 184 … … 234 233 235 234 // Always move to seeking state to report correct 'currentTime' while pending for actual seek to complete. 236 m_ isSeeking = true;235 m_seeking = true; 237 236 238 237 // Check if playback pipeline is ready for seek. … … 242 241 GST_DEBUG("[Seek] cannot seek, current state change is %s", gst_element_state_change_return_get_name(getStateResult)); 243 242 webKitMediaSrcSetReadyForSamples(WEBKIT_MEDIA_SRC(m_source.get()), true); 244 m_ isSeeking = false;243 m_seeking = false; 245 244 return false; 246 245 } … … 264 263 GST_DEBUG("[Seek] Delaying the seek: %s", reason.data()); 265 264 266 m_ isSeekPending = true;265 m_seekIsPending = true; 267 266 268 267 if (m_isEndReached) { 269 268 GST_DEBUG("[Seek] reset pipeline"); 270 m_ shouldResetPipeline = true;271 m_ isSeeking = false;269 m_resetPipeline = true; 270 m_seeking = false; 272 271 if (!changePipelineState(GST_STATE_PAUSED)) 273 272 loadingFailed(MediaPlayer::Empty); 274 273 else 275 m_ isSeeking = true;274 m_seeking = true; 276 275 } 277 276 278 return m_ isSeeking;277 return m_seeking; 279 278 } 280 279 … … 302 301 GST_DEBUG("[Seek] Cannot seek, failed to pause playback pipeline."); 303 302 webKitMediaSrcSetReadyForSamples(WEBKIT_MEDIA_SRC(m_source.get()), true); 304 m_ isSeeking = false;303 m_seeking = false; 305 304 return false; 306 305 } … … 316 315 ASSERT(m_mseSeekCompleted); 317 316 // Note: seekCompleted will recursively call us. 318 return m_ isSeeking;317 return m_seeking; 319 318 } 320 319 … … 339 338 if (!gst_element_seek(m_pipeline.get(), rate, GST_FORMAT_TIME, seekType, GST_SEEK_TYPE_SET, toGstClockTime(startTime), GST_SEEK_TYPE_SET, toGstClockTime(endTime))) { 340 339 webKitMediaSrcSetReadyForSamples(WEBKIT_MEDIA_SRC(m_source.get()), true); 341 m_ isSeeking = false;340 m_seeking = false; 342 341 m_gstSeekCompleted = true; 343 342 GST_DEBUG("doSeek(): gst_element_seek() failed, returning false"); … … 352 351 void MediaPlayerPrivateGStreamerMSE::maybeFinishSeek() 353 352 { 354 if (!m_ isSeeking || !m_mseSeekCompleted || !m_gstSeekCompleted)353 if (!m_seeking || !m_mseSeekCompleted || !m_gstSeekCompleted) 355 354 return; 356 355 … … 364 363 } 365 364 366 if (m_ isSeekPending) {365 if (m_seekIsPending) { 367 366 GST_DEBUG("[Seek] Committing pending seek to %s", toString(m_seekTime).utf8().data()); 368 m_ isSeekPending = false;367 m_seekIsPending = false; 369 368 if (!doSeek()) { 370 369 GST_WARNING("[Seek] Seeking to %s failed", toString(m_seekTime).utf8().data()); … … 377 376 378 377 webKitMediaSrcSetReadyForSamples(WEBKIT_MEDIA_SRC(m_source.get()), true); 379 m_ isSeeking = false;378 m_seeking = false; 380 379 m_cachedPosition = MediaTime::invalidTime(); 381 380 // The pipeline can still have a pending state. In this case a position query will fail. … … 392 391 bool MediaPlayerPrivateGStreamerMSE::seeking() const 393 392 { 394 return m_ isSeeking;393 return m_seeking; 395 394 } 396 395 … … 430 429 void MediaPlayerPrivateGStreamerMSE::waitForSeekCompleted() 431 430 { 432 if (!m_ isSeeking)431 if (!m_seeking) 433 432 return; 434 433 … … 481 480 void MediaPlayerPrivateGStreamerMSE::updateStates() 482 481 { 483 if (UNLIKELY(!m_pipeline || m_ didErrorOccur))482 if (UNLIKELY(!m_pipeline || m_errorOccured)) 484 483 return; 485 484 … … 500 499 break; 501 500 502 m_ shouldResetPipeline = (state <= GST_STATE_READY);503 if (m_ shouldResetPipeline)501 m_resetPipeline = (state <= GST_STATE_READY); 502 if (m_resetPipeline) 504 503 m_mediaTimeDuration = MediaTime::zeroTime(); 505 504 … … 540 539 // Sync states where needed. 541 540 if (state == GST_STATE_PAUSED) { 542 if (!m_ areVolumeAndMuteInitialized) {541 if (!m_volumeAndMuteInitialized) { 543 542 notifyPlayerOfVolumeChange(); 544 543 notifyPlayerOfMute(); 545 m_ areVolumeAndMuteInitialized = true;544 m_volumeAndMuteInitialized = true; 546 545 } 547 546 548 if (!seeking() && !m_ isPaused && m_playbackRate) {547 if (!seeking() && !m_paused && m_playbackRate) { 549 548 GST_DEBUG("[Buffering] Restarting playback."); 550 549 changePipelineState(GST_STATE_PLAYING); 551 550 } 552 551 } else if (state == GST_STATE_PLAYING) { 553 m_ isPaused = false;552 m_paused = false; 554 553 555 554 if (!m_playbackRate) { … … 558 557 } 559 558 } else 560 m_ isPaused = true;559 m_paused = true; 561 560 562 561 if (m_requestedState == GST_STATE_PAUSED && state == GST_STATE_PAUSED) { … … 579 578 580 579 // Live pipelines go in PAUSED without prerolling. 581 m_is LiveStream= true;580 m_isStreaming = true; 582 581 583 582 if (state == GST_STATE_READY) { … … 587 586 m_readyState = MediaPlayer::HaveEnoughData; 588 587 GST_DEBUG("m_readyState=%s", dumpReadyState(m_readyState)); 589 m_ isPaused = true;588 m_paused = true; 590 589 } else if (state == GST_STATE_PLAYING) 591 m_ isPaused = false;592 593 if (!m_ isPaused && m_playbackRate)590 m_paused = false; 591 592 if (!m_paused && m_playbackRate) 594 593 changePipelineState(GST_STATE_PLAYING); 595 594 … … 622 621 void MediaPlayerPrivateGStreamerMSE::asyncStateChangeDone() 623 622 { 624 if (UNLIKELY(!m_pipeline || m_ didErrorOccur))625 return; 626 627 if (m_ isSeeking)623 if (UNLIKELY(!m_pipeline || m_errorOccured)) 624 return; 625 626 if (m_seeking) 628 627 maybeFinishSeek(); 629 628 else … … 776 775 MediaTime MediaPlayerPrivateGStreamerMSE::maxMediaTimeSeekable() const 777 776 { 778 if (UNLIKELY(m_ didErrorOccur))777 if (UNLIKELY(m_errorOccured)) 779 778 return MediaTime::zeroTime(); 780 779 -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h
r252937 r252938 55 55 void updateDownloadBufferingFlag() override { }; 56 56 57 bool isLiveStream() const override { return false; } 57 58 MediaTime currentMediaTime() const override; 58 59 -
trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp
r252937 r252938 164 164 165 165 // This is only for on-the-fly reenqueues after appends. When seeking, the seek will do its own flush. 166 // FIXME: Should not be touching private parts. 167 if (!m_playerPrivate.m_isSeeking) 166 if (!m_playerPrivate.m_seeking) 168 167 m_playerPrivate.m_playbackPipeline->flush(trackId); 169 168 }
Note: See TracChangeset
for help on using the changeset viewer.