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

Side by Side Diff: content/renderer/media/webmediaplayer_impl.cc

Issue 312803002: Android media: VideoFrame should not store so many sync points. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ios build Created 6 years, 5 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 | « content/renderer/media/video_capture_message_filter.cc ('k') | media/base/video_frame.h » ('j') | no next file with comments »
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/webmediaplayer_impl.h" 5 #include "content/renderer/media/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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // 111 //
112 // Also our timers are not very accurate (especially for ogg), which becomes 112 // Also our timers are not very accurate (especially for ogg), which becomes
113 // evident at low speeds and on Vista. Since other speeds are risky and outside 113 // evident at low speeds and on Vista. Since other speeds are risky and outside
114 // the norms, we think 1/16x to 16x is a safe and useful range for now. 114 // the norms, we think 1/16x to 16x is a safe and useful range for now.
115 const double kMinRate = 0.0625; 115 const double kMinRate = 0.0625;
116 const double kMaxRate = 16.0; 116 const double kMaxRate = 16.0;
117 117
118 // Prefix for histograms related to Encrypted Media Extensions. 118 // Prefix for histograms related to Encrypted Media Extensions.
119 const char* kMediaEme = "Media.EME."; 119 const char* kMediaEme = "Media.EME.";
120 120
121 class SyncPointClientImpl : public media::VideoFrame::SyncPointClient {
122 public:
123 explicit SyncPointClientImpl(
124 blink::WebGraphicsContext3D* web_graphics_context)
125 : web_graphics_context_(web_graphics_context) {}
126 virtual ~SyncPointClientImpl() {}
127 virtual uint32 InsertSyncPoint() OVERRIDE {
128 return web_graphics_context_->insertSyncPoint();
129 }
130 virtual void WaitSyncPoint(uint32 sync_point) OVERRIDE {
131 web_graphics_context_->waitSyncPoint(sync_point);
132 }
133
134 private:
135 blink::WebGraphicsContext3D* web_graphics_context_;
136 };
137
121 } // namespace 138 } // namespace
122 139
123 namespace content { 140 namespace content {
124 141
125 class BufferedDataSourceHostImpl; 142 class BufferedDataSourceHostImpl;
126 143
127 #define COMPILE_ASSERT_MATCHING_ENUM(name) \ 144 #define COMPILE_ASSERT_MATCHING_ENUM(name) \
128 COMPILE_ASSERT(static_cast<int>(WebMediaPlayer::CORSMode ## name) == \ 145 COMPILE_ASSERT(static_cast<int>(WebMediaPlayer::CORSMode ## name) == \
129 static_cast<int>(BufferedResourceLoader::k ## name), \ 146 static_cast<int>(BufferedResourceLoader::k ## name), \
130 mismatching_enums) 147 mismatching_enums)
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 type); 662 type);
646 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false); 663 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false);
647 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, 664 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM,
648 false); 665 false);
649 666
650 // Restore the state for TEXTURE_2D binding point as mentioned above. 667 // Restore the state for TEXTURE_2D binding point as mentioned above.
651 web_graphics_context->bindTexture(GL_TEXTURE_2D, texture); 668 web_graphics_context->bindTexture(GL_TEXTURE_2D, texture);
652 669
653 web_graphics_context->deleteTexture(source_texture); 670 web_graphics_context->deleteTexture(source_texture);
654 web_graphics_context->flush(); 671 web_graphics_context->flush();
655 video_frame->AppendReleaseSyncPoint(web_graphics_context->insertSyncPoint()); 672
673 SyncPointClientImpl client(web_graphics_context);
674 video_frame->UpdateReleaseSyncPoint(&client);
656 return true; 675 return true;
657 } 676 }
658 677
659 // Helper functions to report media EME related stats to UMA. They follow the 678 // Helper functions to report media EME related stats to UMA. They follow the
660 // convention of more commonly used macros UMA_HISTOGRAM_ENUMERATION and 679 // convention of more commonly used macros UMA_HISTOGRAM_ENUMERATION and
661 // UMA_HISTOGRAM_COUNTS. The reason that we cannot use those macros directly is 680 // UMA_HISTOGRAM_COUNTS. The reason that we cannot use those macros directly is
662 // that UMA_* macros require the names to be constant throughout the process' 681 // that UMA_* macros require the names to be constant throughout the process'
663 // lifetime. 682 // lifetime.
664 static void EmeUMAHistogramEnumeration(const std::string& key_system, 683 static void EmeUMAHistogramEnumeration(const std::string& key_system,
665 const std::string& method, 684 const std::string& method,
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 compositor_task_runner_->PostTask(FROM_HERE, 1380 compositor_task_runner_->PostTask(FROM_HERE,
1362 base::Bind(&GetCurrentFrameAndSignal, 1381 base::Bind(&GetCurrentFrameAndSignal,
1363 base::Unretained(compositor_), 1382 base::Unretained(compositor_),
1364 &video_frame, 1383 &video_frame,
1365 &event)); 1384 &event));
1366 event.Wait(); 1385 event.Wait();
1367 return video_frame; 1386 return video_frame;
1368 } 1387 }
1369 1388
1370 } // namespace content 1389 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/video_capture_message_filter.cc ('k') | media/base/video_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698