| OLD | NEW |
| 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 Loading... |
| 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 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 type); | 661 type); |
| 645 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false); | 662 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false); |
| 646 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, | 663 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, |
| 647 false); | 664 false); |
| 648 | 665 |
| 649 // Restore the state for TEXTURE_2D binding point as mentioned above. | 666 // Restore the state for TEXTURE_2D binding point as mentioned above. |
| 650 web_graphics_context->bindTexture(GL_TEXTURE_2D, texture); | 667 web_graphics_context->bindTexture(GL_TEXTURE_2D, texture); |
| 651 | 668 |
| 652 web_graphics_context->deleteTexture(source_texture); | 669 web_graphics_context->deleteTexture(source_texture); |
| 653 web_graphics_context->flush(); | 670 web_graphics_context->flush(); |
| 654 video_frame->AppendReleaseSyncPoint(web_graphics_context->insertSyncPoint()); | 671 |
| 672 SyncPointClientImpl client(web_graphics_context); |
| 673 video_frame->UpdateReleaseSyncPoint(&client); |
| 655 return true; | 674 return true; |
| 656 } | 675 } |
| 657 | 676 |
| 658 // Helper functions to report media EME related stats to UMA. They follow the | 677 // Helper functions to report media EME related stats to UMA. They follow the |
| 659 // convention of more commonly used macros UMA_HISTOGRAM_ENUMERATION and | 678 // convention of more commonly used macros UMA_HISTOGRAM_ENUMERATION and |
| 660 // UMA_HISTOGRAM_COUNTS. The reason that we cannot use those macros directly is | 679 // UMA_HISTOGRAM_COUNTS. The reason that we cannot use those macros directly is |
| 661 // that UMA_* macros require the names to be constant throughout the process' | 680 // that UMA_* macros require the names to be constant throughout the process' |
| 662 // lifetime. | 681 // lifetime. |
| 663 static void EmeUMAHistogramEnumeration(const std::string& key_system, | 682 static void EmeUMAHistogramEnumeration(const std::string& key_system, |
| 664 const std::string& method, | 683 const std::string& method, |
| (...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1352 compositor_task_runner_->PostTask(FROM_HERE, | 1371 compositor_task_runner_->PostTask(FROM_HERE, |
| 1353 base::Bind(&GetCurrentFrameAndSignal, | 1372 base::Bind(&GetCurrentFrameAndSignal, |
| 1354 base::Unretained(compositor_), | 1373 base::Unretained(compositor_), |
| 1355 &video_frame, | 1374 &video_frame, |
| 1356 &event)); | 1375 &event)); |
| 1357 event.Wait(); | 1376 event.Wait(); |
| 1358 return video_frame; | 1377 return video_frame; |
| 1359 } | 1378 } |
| 1360 | 1379 |
| 1361 } // namespace content | 1380 } // namespace content |
| OLD | NEW |