Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle buffer offset in servosrc #239

Merged
merged 4 commits into from Apr 19, 2019
Merged

Conversation

@ceyusa
Copy link
Contributor

ceyusa commented Apr 18, 2019

Seeking requires a strict handling of each buffer offset. Though appsrc do some offset handling, but only for live stream (not seeking). When random-access is enabled the application must take care of marking each buffer offset correctly.

This patch extends servosrc's method push_buffer() so it will count the current offset and stamps it on the pushed buffer. Also, it honors the buffer's block size defined in appsrc, splitting the input data in several buffers if it's bigger, fixing some problems with the buffering mechanism in playbin.

When a seek operation is done, the current media offset must be updated with the requested position.

As per media/player design, it is required that the user must push synchronized the data from the requested position by the seek.

@ceyusa ceyusa force-pushed the ceyusa:offset-handling branch from 0f263f1 to a1cdb87 Apr 18, 2019
@ceyusa
Copy link
Contributor Author

ceyusa commented Apr 18, 2019

@ferjm r?

ceyusa added 3 commits Apr 17, 2019
Seeking requires a strict handling of each buffer offset. Though
appsrc do some offset handling, but only for live stream (not
seeking). When random-access is enabled the application must take care
of marking each buffer offset correctly.

This patch extends servosrc's method push_buffer() so it will count
the current offset and stamps it on the pushed buffer. Also, it honors
the buffer's block size defined in appsrc, splitting the input data in
several buffers if it's bigger, fixing some problems with the
buffering mechanism in playbin.

When a seek operation is done, the current media offset must be
updated with the requested position.

As per media/player design, it is required that the user must push
synchronized the data from the requested position by the seek.
Rather that "guess" when the source element has enough data in its
adapter, let's just use the its signal to semaphore when to fail
push_data() method.
@ceyusa ceyusa force-pushed the ceyusa:offset-handling branch from 8642849 to 2aafa4b Apr 19, 2019
@ferjm
ferjm approved these changes Apr 19, 2019
Copy link
Member

ferjm left a comment

Looks great. Thanks! r=me

.push_data(Vec::from(&buffer[0..size]))
{
println!("Can't push data: {:?}", e);
//break;

This comment has been minimized.

@ferjm

ferjm Apr 19, 2019

Member

Remove this comment?

This comment has been minimized.

@ceyusa

ceyusa Apr 19, 2019

Author Contributor

Actually it is a hack left behind. Let bring back the break if it is not a enough data.

@ceyusa
Copy link
Contributor Author

ceyusa commented Apr 19, 2019

@bors-servo r=ferjm

@bors-servo
Copy link
Contributor

bors-servo commented Apr 19, 2019

📌 Commit b393c7f has been approved by ferjm

@bors-servo
Copy link
Contributor

bors-servo commented Apr 19, 2019

Testing commit b393c7f with merge 61630b3...

bors-servo added a commit that referenced this pull request Apr 19, 2019
Handle buffer offset in servosrc

Seeking requires a strict handling of each buffer offset. Though appsrc do some offset handling, but only for live stream (not seeking). When random-access is enabled the application must take care of marking each buffer offset correctly.

This patch extends servosrc's method push_buffer() so it will count the current offset and stamps it on the pushed buffer. Also, it honors the buffer's block size defined in appsrc, splitting the input data in several buffers if it's bigger, fixing some problems with the buffering mechanism in playbin.

When a seek operation is done, the current media offset must be updated with the requested position.

As per media/player design, it is required that the user must push synchronized the data from the requested position by the seek.
@bors-servo
Copy link
Contributor

bors-servo commented Apr 19, 2019

☀️ Test successful - checks-travis
Approved by: ferjm
Pushing 61630b3 to master...

@bors-servo bors-servo merged commit b393c7f into servo:master Apr 19, 2019
2 checks passed
2 checks passed
Travis CI - Pull Request Build Passed
Details
homu Test successful
Details
@ceyusa ceyusa deleted the ceyusa:offset-handling branch Apr 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.