I am trying to stream a WebM format video being generated using gstreamer and individual frame being sent over websockets. A typical byte arrangement of webm file is like this (you may be already familiar with this).
EBML (head size: 12 bytes, data: 16 bytes, pos: 0, '0x0')
DocType (head size: 3 bytes, data: 5 bytes, pos: 12L, '0xcL') : 'webm\x00'
DocTypeVersion (head size: 3 bytes, data: 1 bytes, pos: 20L, '0x14L') : 2
DocTypeReadVersion (head size: 3 bytes, data: 1 bytes, pos: 24L, '0x18L') : 2
...
...
SegmentInfo (head size: 12 bytes, data: 91 bytes, pos: 192L, '0xc0L')
TimecodeScale (head size: 4 bytes, data: 3 bytes, pos: 204L, '0xccL') : 1000000
Duration (head size: 3 bytes, data: 8 bytes, pos: 211L, '0xd3L') : 0.0
MuxingApp (head size: 3 bytes, data: 31 bytes, pos: 222L, '0xdeL') : 'GStreamer plugin version 1.2.4\x00'
WritingApp (head size: 3 bytes, data: 25 bytes, pos: 256L, '0x100L') : 'GStreamer Matroska muxer\x00'
DateUTC (head size: 3 bytes, data: 8 bytes, pos: 284L, '0x11cL') : 447902803000000000L
Video (head size: 9 bytes, data: 8 bytes, pos: 295L, '0x127L')
Pixel Width (head size: 2 bytes, data: 2 bytes, pos: 351L, '0x15fL') : 640
Pixel Height (head size: 2 bytes, data: 2 bytes, pos: 355L, '0x163L') : 480
Codec Id (head size: 2 bytes, data: 6 bytes, pos: 359L, '0x167L') : 'V_VP8\x00'
Cluster (head size: 12 bytes, data: 72057594037927935L bytes, pos: 367L, '0x16fL')
TimeCode (head size: 2 bytes, data: 2 bytes, pos: 379L, '0x17bL') : 1514
SimpleBlock (head size: 4 bytes, data: 44618 bytes, pos: 383L, '0x17fL') : 'binary'
track number : 1, keyframe : True, invisible : 'no', discardable : 'no'
lace : 'no lacing', time code : 0, time code(absolute) : 1514
SimpleBlock (head size: 3 bytes, data: 793 bytes, pos: 45005L, '0xafcdL') : 'binary'
track number : 1, keyframe : False, invisible : 'no', discardable : 'no'
lace : 'no lacing', time code : 27, time code(absolute) : 1541
<<conitnued....>>
What I see, the absolute time code and relative time code is being written correctly when I redirect the gstreamer output to filesink. The same gstreamer pipeline is used to extract the byte sequences (samples). These samples are then transmitted over websocket and received on client side using MediaSource API.
My implementation of client javascript is described here. When I run the client in Firefox, the video runs smoothly without any glitches. But on Chrome, the video freezes after some time or at the beginning.
I tried modifying sourceBuffer.mode = "sequence" or "segments", none of the options work on Chrome, whereas the video feed on Firefox is totally unaffected by any value of "sourceBuffer.mode". The description of these modes is here. (I am assuming that the MediaSource API works the same way on IE and Firefox, as no documentation available on Mozilla website).
Also, mediaSource.duration is Infinity/NaN in Chrome and Firefox both.
No matter which way I try, the live feed on chrome is not at all working, whereas Firefox displays smooth video. Any suggestions, why this could be happening?
UPDATES: I upgraded to Chrome version 41 which gives more details on chrome://media-internals. The message that is shown is:
render_id: 23
player_id: 1
pipeline_state: kStopped
EVENT: WEBMEDIAPLAYER_DESTROYED
url: blob:http%3A//localhost%3A8080/172f68c8-9ff3-4983-9dcb- 396b3f843752
found_video_stream: true
video_codec_name: vp8
duration: unknown
video_dds: false
video_decoder: FFmpegVideoDecoder
error: Append: stream parsing failed. Data size=2283 append_window_start=0 append_window_end=inf
pipeline_error: pipeline: decode error
Timestamp Property Value
00:00:00 00 pipeline_state kCreated
00:00:00 00 EVENT PIPELINE_CREATED
00:00:00 00 EVENT WEBMEDIAPLAYER_CREATED
00:00:00 00 url blob:http%3A//localhost%3A8080/172f68c8-9ff3-4983-9dcb-396b3f843752
00:00:00 00 pipeline_state kInitDemuxer
00:00:01 687 found_video_stream true
00:00:01 692 video_codec_name vp8
00:00:01 692 duration unknown
00:00:01 692 pipeline_state kInitRenderer
00:00:01 694 video_dds false
00:00:01 694 video_decoder FFmpegVideoDecoder
00:00:01 695 pipeline_state kPlaying
00:00:10 989 EVENT PLAY
00:00:11 276 error Got a block with a timecode before the previous block.
00:00:11 276 error Append: stream parsing failed. Data size=2283 append_window_start=0 append_window_end=inf
00:00:11 276 pipeline_error pipeline: decode error
00:00:11 276 pipeline_state kStopping
00:00:11 277 pipeline_state kStopped
00:01:14 239 EVENT WEBMEDIAPLAYER_DESTROYED
How to fix or calculate the "append_window_end"???