Add key frame seeking to webmdec and webm_video_source.

This is for the frame parallel's pause/seek/resume unit test.

Change-Id: Ie235f86ca5f3d525896222766f6d610e6682fd76
diff --git a/test/webm_video_source.h b/test/webm_video_source.h
index 11d3d23..650bc52 100644
--- a/test/webm_video_source.h
+++ b/test/webm_video_source.h
@@ -69,6 +69,18 @@
     }
   }
 
+  void SeekToNextKeyFrame() {
+    ASSERT_TRUE(vpx_ctx_->file != NULL);
+    do {
+      const int status = webm_read_frame(webm_ctx_, &buf_, &buf_sz_, &buf_sz_);
+      ASSERT_GE(status, 0) << "webm_read_frame failed";
+      ++frame_;
+      if (status == 1) {
+        end_of_file_ = true;
+      }
+    } while (!webm_ctx_->is_key_frame && !end_of_file_);
+  }
+
   virtual const uint8_t *cxdata() const {
     return end_of_file_ ? NULL : buf_;
   }
diff --git a/webmdec.cc b/webmdec.cc
index 4383e8e..d591f3e 100644
--- a/webmdec.cc
+++ b/webmdec.cc
@@ -41,6 +41,7 @@
   webm_ctx->block_frame_index = 0;
   webm_ctx->video_track_index = 0;
   webm_ctx->timestamp_ns = 0;
+  webm_ctx->is_key_frame = false;
 }
 
 void get_first_cluster(struct WebmInputContext *const webm_ctx) {
@@ -182,6 +183,7 @@
   }
   *bytes_in_buffer = frame.len;
   webm_ctx->timestamp_ns = block->GetTime(cluster);
+  webm_ctx->is_key_frame = block->IsKey();
 
   mkvparser::MkvReader *const reader =
       reinterpret_cast<mkvparser::MkvReader*>(webm_ctx->reader);
diff --git a/webmdec.h b/webmdec.h
index 29b815d..1cd35d4 100644
--- a/webmdec.h
+++ b/webmdec.h
@@ -28,6 +28,7 @@
   int block_frame_index;
   int video_track_index;
   uint64_t timestamp_ns;
+  int is_key_frame;
 };
 
 // Checks if the input is a WebM file. If so, initializes WebMInputContext so