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

Unified Diff: media/webm/chromeos/webm_encoder.cc

Issue 10823006: Add proper duration to WebmEncoder-created files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/webm/chromeos/webm_encoder.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/webm/chromeos/webm_encoder.cc
diff --git a/media/webm/chromeos/webm_encoder.cc b/media/webm/chromeos/webm_encoder.cc
index 0bc52d6b8674fda074c467bc5834cbe63fd195ab..62ddad0d13cb603a4974471848780daa88b89b68 100644
--- a/media/webm/chromeos/webm_encoder.cc
+++ b/media/webm/chromeos/webm_encoder.cc
@@ -84,7 +84,7 @@ bool WebmEncoder::EncodeFromSprite(const SkBitmap& sprite,
fps_.den = fps_d;
// Sprite is tiled vertically.
- size_t frame_count = sprite.height() / width_;
+ frame_count_ = sprite.height() / width_;
vpx_image_t image;
vpx_img_alloc(&image, VPX_IMG_FMT_I420, width_, height_, 16);
@@ -124,7 +124,7 @@ bool WebmEncoder::EncodeFromSprite(const SkBitmap& sprite,
if (!WriteWebmHeader())
return false;
- for (size_t frame = 0; frame < frame_count && !has_errors_; ++frame) {
+ for (size_t frame = 0; frame < frame_count_ && !has_errors_; ++frame) {
int res = libyuv::ConvertToI420(
src, src_frame_size,
image.planes[VPX_PLANE_Y], image.stride[VPX_PLANE_Y],
@@ -183,6 +183,8 @@ bool WebmEncoder::WriteWebmHeader() {
{
// All timecodes in the segment will be expressed in milliseconds.
Ebml_SerializeUnsigned(&ebml_writer_, TimecodeScale, 1000000);
+ double duration = 1000. * frame_count_ * fps_.den / fps_.num;
+ Ebml_SerializeFloat(&ebml_writer_, Segment_Duration, duration);
}
EndSubElement(); // Info
« no previous file with comments | « media/webm/chromeos/webm_encoder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698