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

Side by Side Diff: media/blink/webmediaplayer_impl.cc

Issue 1041353002: media-internals: Differentiate error, info, and debug log messages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Attempt to fix android compile error Created 5 years, 8 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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/blink/webmediaplayer_impl.h" 5 #include "media/blink/webmediaplayer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 #undef STATIC_ASSERT_MATCHING_ENUM 96 #undef STATIC_ASSERT_MATCHING_ENUM
97 97
98 #define BIND_TO_RENDER_LOOP(function) \ 98 #define BIND_TO_RENDER_LOOP(function) \
99 (DCHECK(main_task_runner_->BelongsToCurrentThread()), \ 99 (DCHECK(main_task_runner_->BelongsToCurrentThread()), \
100 BindToCurrentLoop(base::Bind(function, AsWeakPtr()))) 100 BindToCurrentLoop(base::Bind(function, AsWeakPtr())))
101 101
102 #define BIND_TO_RENDER_LOOP1(function, arg1) \ 102 #define BIND_TO_RENDER_LOOP1(function, arg1) \
103 (DCHECK(main_task_runner_->BelongsToCurrentThread()), \ 103 (DCHECK(main_task_runner_->BelongsToCurrentThread()), \
104 BindToCurrentLoop(base::Bind(function, AsWeakPtr(), arg1))) 104 BindToCurrentLoop(base::Bind(function, AsWeakPtr(), arg1)))
105 105
106 static void LogMediaSourceError(const scoped_refptr<MediaLog>& media_log, 106 static void AddLogEntry(const scoped_refptr<MediaLog>& media_log,
107 const std::string& error) { 107 MediaLog::MediaLogLevel level,
108 media_log->AddEvent(media_log->CreateMediaSourceErrorEvent(error)); 108 const std::string& message) {
109 media_log->AddEvent(media_log->CreateLogEvent(level, message));
109 } 110 }
110 111
111 static blink::WebEncryptedMediaInitDataType ConvertInitDataType( 112 static blink::WebEncryptedMediaInitDataType ConvertInitDataType(
112 const std::string& init_data_type) { 113 const std::string& init_data_type) {
113 if (init_data_type == "cenc") 114 if (init_data_type == "cenc")
114 return blink::WebEncryptedMediaInitDataType::Cenc; 115 return blink::WebEncryptedMediaInitDataType::Cenc;
115 if (init_data_type == "keyids") 116 if (init_data_type == "keyids")
116 return blink::WebEncryptedMediaInitDataType::Keyids; 117 return blink::WebEncryptedMediaInitDataType::Keyids;
117 if (init_data_type == "webm") 118 if (init_data_type == "webm")
118 return blink::WebEncryptedMediaInitDataType::Webm; 119 return blink::WebEncryptedMediaInitDataType::Webm;
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 data_source_->OnBufferingHaveEnough(); 830 data_source_->OnBufferingHaveEnough();
830 831
831 // Blink expects a timeChanged() in response to a seek(). 832 // Blink expects a timeChanged() in response to a seek().
832 if (should_notify_time_changed_) 833 if (should_notify_time_changed_)
833 client_->timeChanged(); 834 client_->timeChanged();
834 } 835 }
835 836
836 void WebMediaPlayerImpl::OnDemuxerOpened() { 837 void WebMediaPlayerImpl::OnDemuxerOpened() {
837 DCHECK(main_task_runner_->BelongsToCurrentThread()); 838 DCHECK(main_task_runner_->BelongsToCurrentThread());
838 client_->mediaSourceOpened(new WebMediaSourceImpl( 839 client_->mediaSourceOpened(new WebMediaSourceImpl(
839 chunk_demuxer_, base::Bind(&LogMediaSourceError, media_log_))); 840 chunk_demuxer_, base::Bind(&AddLogEntry, media_log_)));
840 } 841 }
841 842
842 void WebMediaPlayerImpl::OnAddTextTrack( 843 void WebMediaPlayerImpl::OnAddTextTrack(
843 const TextTrackConfig& config, 844 const TextTrackConfig& config,
844 const AddTextTrackDoneCB& done_cb) { 845 const AddTextTrackDoneCB& done_cb) {
845 DCHECK(main_task_runner_->BelongsToCurrentThread()); 846 DCHECK(main_task_runner_->BelongsToCurrentThread());
846 847
847 const WebInbandTextTrackImpl::Kind web_kind = 848 const WebInbandTextTrackImpl::Kind web_kind =
848 static_cast<WebInbandTextTrackImpl::Kind>(config.kind()); 849 static_cast<WebInbandTextTrackImpl::Kind>(config.kind());
849 const blink::WebString web_label = 850 const blink::WebString web_label =
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 if (load_type_ != LoadTypeMediaSource) { 900 if (load_type_ != LoadTypeMediaSource) {
900 DCHECK(!chunk_demuxer_); 901 DCHECK(!chunk_demuxer_);
901 DCHECK(data_source_); 902 DCHECK(data_source_);
902 903
903 demuxer_.reset(new FFmpegDemuxer(media_task_runner_, data_source_.get(), 904 demuxer_.reset(new FFmpegDemuxer(media_task_runner_, data_source_.get(),
904 encrypted_media_init_data_cb, media_log_)); 905 encrypted_media_init_data_cb, media_log_));
905 } else { 906 } else {
906 DCHECK(!chunk_demuxer_); 907 DCHECK(!chunk_demuxer_);
907 DCHECK(!data_source_); 908 DCHECK(!data_source_);
908 909
909 mse_log_cb = base::Bind(&LogMediaSourceError, media_log_); 910 mse_log_cb = base::Bind(&AddLogEntry, media_log_);
910 911
911 chunk_demuxer_ = new ChunkDemuxer( 912 chunk_demuxer_ = new ChunkDemuxer(
912 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnDemuxerOpened), 913 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnDemuxerOpened),
913 encrypted_media_init_data_cb, mse_log_cb, media_log_, true); 914 encrypted_media_init_data_cb, mse_log_cb, media_log_, true);
914 demuxer_.reset(chunk_demuxer_); 915 demuxer_.reset(chunk_demuxer_);
915 } 916 }
916 917
917 // ... and we're ready to go! 918 // ... and we're ready to go!
918 seeking_ = true; 919 seeking_ = true;
919 920
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 1040
1040 // pause() may be called after playback has ended and the HTMLMediaElement 1041 // pause() may be called after playback has ended and the HTMLMediaElement
1041 // requires that currentTime() == duration() after ending. We want to ensure 1042 // requires that currentTime() == duration() after ending. We want to ensure
1042 // |paused_time_| matches currentTime() in this case or a future seek() may 1043 // |paused_time_| matches currentTime() in this case or a future seek() may
1043 // incorrectly discard what it thinks is a seek to the existing time. 1044 // incorrectly discard what it thinks is a seek to the existing time.
1044 paused_time_ = 1045 paused_time_ =
1045 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime(); 1046 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime();
1046 } 1047 }
1047 1048
1048 } // namespace media 1049 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698