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

Side by Side Diff: content/renderer/media/android/media_source_delegate.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: Address reviewer comments 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
« no previous file with comments | « no previous file | media/base/media_log.h » ('j') | media/base/media_log.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/renderer/media/android/media_source_delegate.h" 5 #include "content/renderer/media/android/media_source_delegate.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 22 matching lines...) Expand all
33 // The size of the access unit to transfer in an IPC in case of MediaSource. 33 // The size of the access unit to transfer in an IPC in case of MediaSource.
34 // 4: approximately 64ms of content in 60 fps movies. 34 // 4: approximately 64ms of content in 60 fps movies.
35 const size_t kAccessUnitSizeForMediaSource = 4; 35 const size_t kAccessUnitSizeForMediaSource = 4;
36 36
37 const uint8 kVorbisPadding[] = { 0xff, 0xff, 0xff, 0xff }; 37 const uint8 kVorbisPadding[] = { 0xff, 0xff, 0xff, 0xff };
38 38
39 } // namespace 39 } // namespace
40 40
41 namespace content { 41 namespace content {
42 42
43 static void LogMediaSourceError(const scoped_refptr<media::MediaLog>& media_log, 43 static void AddLogEntry(const scoped_refptr<media::MediaLog>& media_log,
44 const std::string& error) { 44 media::MediaLog::MediaLogLevel level,
45 media_log->AddEvent(media_log->CreateMediaSourceErrorEvent(error)); 45 const std::string& message) {
46 media_log->AddEvent(media_log->CreateLogEvent(level, message));
46 } 47 }
47 48
48 MediaSourceDelegate::MediaSourceDelegate( 49 MediaSourceDelegate::MediaSourceDelegate(
49 RendererDemuxerAndroid* demuxer_client, 50 RendererDemuxerAndroid* demuxer_client,
50 int demuxer_client_id, 51 int demuxer_client_id,
51 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner, 52 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner,
52 const scoped_refptr<media::MediaLog> media_log) 53 const scoped_refptr<media::MediaLog> media_log)
53 : demuxer_client_(demuxer_client), 54 : demuxer_client_(demuxer_client),
54 demuxer_client_id_(demuxer_client_id), 55 demuxer_client_id_(demuxer_client_id),
55 media_log_(media_log), 56 media_log_(media_log),
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 duration_change_cb_ = duration_change_cb; 164 duration_change_cb_ = duration_change_cb;
164 waiting_for_decryption_key_cb_ = 165 waiting_for_decryption_key_cb_ =
165 media::BindToCurrentLoop(waiting_for_decryption_key_cb); 166 media::BindToCurrentLoop(waiting_for_decryption_key_cb);
166 access_unit_size_ = kAccessUnitSizeForMediaSource; 167 access_unit_size_ = kAccessUnitSizeForMediaSource;
167 168
168 chunk_demuxer_.reset(new media::ChunkDemuxer( 169 chunk_demuxer_.reset(new media::ChunkDemuxer(
169 media::BindToCurrentLoop( 170 media::BindToCurrentLoop(
170 base::Bind(&MediaSourceDelegate::OnDemuxerOpened, main_weak_this_)), 171 base::Bind(&MediaSourceDelegate::OnDemuxerOpened, main_weak_this_)),
171 media::BindToCurrentLoop(base::Bind( 172 media::BindToCurrentLoop(base::Bind(
172 &MediaSourceDelegate::OnEncryptedMediaInitData, main_weak_this_)), 173 &MediaSourceDelegate::OnEncryptedMediaInitData, main_weak_this_)),
173 base::Bind(&LogMediaSourceError, media_log_), media_log_, false)); 174 base::Bind(&AddLogEntry, media_log_), media_log_, false));
174 175
175 // |this| will be retained until StopDemuxer() is posted, so Unretained() is 176 // |this| will be retained until StopDemuxer() is posted, so Unretained() is
176 // safe here. 177 // safe here.
177 media_task_runner_->PostTask(FROM_HERE, 178 media_task_runner_->PostTask(FROM_HERE,
178 base::Bind(&MediaSourceDelegate::InitializeDemuxer, 179 base::Bind(&MediaSourceDelegate::InitializeDemuxer,
179 base::Unretained(this))); 180 base::Unretained(this)));
180 } 181 }
181 182
182 void MediaSourceDelegate::InitializeDemuxer() { 183 void MediaSourceDelegate::InitializeDemuxer() {
183 DCHECK(media_task_runner_->BelongsToCurrentThread()); 184 DCHECK(media_task_runner_->BelongsToCurrentThread());
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 663
663 return media::ConvertSecondsToTimestamp(duration); 664 return media::ConvertSecondsToTimestamp(duration);
664 } 665 }
665 666
666 void MediaSourceDelegate::OnDemuxerOpened() { 667 void MediaSourceDelegate::OnDemuxerOpened() {
667 DCHECK(main_task_runner_->BelongsToCurrentThread()); 668 DCHECK(main_task_runner_->BelongsToCurrentThread());
668 if (media_source_opened_cb_.is_null()) 669 if (media_source_opened_cb_.is_null())
669 return; 670 return;
670 671
671 media_source_opened_cb_.Run(new media::WebMediaSourceImpl( 672 media_source_opened_cb_.Run(new media::WebMediaSourceImpl(
672 chunk_demuxer_.get(), base::Bind(&LogMediaSourceError, media_log_))); 673 chunk_demuxer_.get(), base::Bind(&AddLogEntry, media_log_)));
673 } 674 }
674 675
675 void MediaSourceDelegate::OnEncryptedMediaInitData( 676 void MediaSourceDelegate::OnEncryptedMediaInitData(
676 const std::string& init_data_type, 677 const std::string& init_data_type,
677 const std::vector<uint8>& init_data) { 678 const std::vector<uint8>& init_data) {
678 DCHECK(main_task_runner_->BelongsToCurrentThread()); 679 DCHECK(main_task_runner_->BelongsToCurrentThread());
679 if (encrypted_media_init_data_cb_.is_null()) 680 if (encrypted_media_init_data_cb_.is_null())
680 return; 681 return;
681 682
682 encrypted_media_init_data_cb_.Run(init_data_type, init_data); 683 encrypted_media_init_data_cb_.Run(init_data_type, init_data);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 configs->video_size = config.natural_size(); 758 configs->video_size = config.natural_size();
758 configs->is_video_encrypted = config.is_encrypted(); 759 configs->is_video_encrypted = config.is_encrypted();
759 configs->video_extra_data = std::vector<uint8>( 760 configs->video_extra_data = std::vector<uint8>(
760 config.extra_data(), config.extra_data() + config.extra_data_size()); 761 config.extra_data(), config.extra_data() + config.extra_data_size());
761 return true; 762 return true;
762 } 763 }
763 return false; 764 return false;
764 } 765 }
765 766
766 } // namespace content 767 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | media/base/media_log.h » ('j') | media/base/media_log.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698